MATLAB Answers

How to read Audio File into Vector?

120 ビュー (過去 30 日間)
dieter alfred
dieter alfred 2020 年 7 月 15 日
コメント済み: dieter alfred 2020 年 7 月 15 日
Hello, I have to read a Audio File (.wav) into a vector.
I know how to plot it:
info = audioinfo('sound.wav');
[y, Fs] = audioread('sound.wav');
t = 0:1/Fs:info.Duration;
t = t(1:end-1);
plot(t,y);
xlabel('Time');
ylabel('Audio Signal');
But this Sript does not read the Audio into a Vector.
I also tried to read every single Sample, but this is to complex and I get error after error. Is there a simple way to do this?
  2 件のコメント
dieter alfred
dieter alfred 2020 年 7 月 15 日
Sorry, I cannot upload the file, because the forum doesnt accept the .wav filetype. And I have already deleted the code with the error messages. But next time I will upload everything.

サインインしてコメントする。

採用された回答

Sugar Daddy
Sugar Daddy 2020 年 7 月 15 日
編集済み: Sugar Daddy 2020 年 7 月 15 日
[y, Fs] = audioread('sound.wav');
sound_duration = length(y)/Fs;
t = 0:1/Fs:sound_duration;
t = t(1:end-1);
%%
soundsc(y,Fs);
%%
plot(t,y);
xlabel('Time');
ylabel('Audio Signal');
  1 件のコメント
dieter alfred
dieter alfred 2020 年 7 月 15 日
Thank you very much for your answer.

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by