Использование функции wavwrite, Octave

1730
xikhari

Эй, просто чтобы продолжить тему хотел бы спросить вас кое-что о wavwrite. Я пытаюсь получить файл мата (T01DATA.mat) для воспроизведения. Попробовал sound()без фактического решения; благодаря вам, я понимаю, почему. Модифицировал его, чтобы получить файл в переменную следующим образом:

s = load("T01DATA.mat"); 

Проверено на s и получилось довольно приличное доказательство того, что метод был успешным. Затем я пытаюсь получить его в файл WAV и появляется хаос.

wavwrite(s,"out.wav"); 

Я получаю это:

Screenshot

Итак, я сделал это тогда:

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

Теперь я получаю wav-файл, но я не уверен на 100%, что сигнал записан правильно. Все, что я получаю, это 0 секунд записи.

0

1 ответ на вопрос

0
xikhari

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