0

Hey just to continue the thread would like to ask you something about wavwrite. I am trying to get a mat file (T01DATA.mat) to be played. Tryed with sound() with no actual solution; thanks to you I undertand why. Modified it to get the file into a variablethis way:

s = load("T01DATA.mat");

Checked for s and got a pretty decent proof that the method was successful. Then I try to get it to a wav file and chaos appears.

wavwrite(s,"out.wav");

I get this :

Screenshot

So I did this then:

wavwrite("T01DATA.mat","out.wav");

Now I get a wav file, but I am not 100% sure that the signal was written correctly. All I get is a 0 seconds recording.

Hennes
  • 65,804
  • 7
  • 115
  • 169

1 Answers1

0

For anyone checking this: The solution is simpler than I thought. By loading a file into Octave:

load("filename.ext");

Octave automatically saves it in the variable "y". This is because Octave can import variables from the .mat file. When loading the file Octave sees the name of the column and the vectors, so it automatically imports the data inside the variable.

s = load("T01DATA.mat"); #Making this whole code unnecessary)

In order to get the .wav file from the .mat you can only implement wavwrite() with "y" and everything will be perfect.

wavwrite(y,Fs,"out.wav");

This will create the out.wav inside the folder you are working. You can check it with

pwd