Hello,
I'd like to plot .wav file in time and frequency domain.

 채택된 답변

Wayne King
Wayne King 2011년 11월 23일

12 개 추천

If this is the output of wavread, then see if you have two channels in y
[y,fs] = wavread(filename);
If y is two-channels, Nx2, then just plot one:
y = y(:,1);
dt = 1/fs;
t = 0:dt:(length(y)*dt)-dt;
plot(t,y); xlabel('Seconds'); ylabel('Amplitude');
figure
plot(psd(spectrum.periodogram,y,'Fs',fs,'NFFT',length(y)));

댓글 수: 10

Wayne King
Wayne King 2011년 11월 23일
so are these saved in a .wav file as two channels? one for the right ear and one for the left?
If so, then just do
yright = y(:,1);
yleft = y(:,2);
or however it is.
Daniel Shub
Daniel Shub 2011년 11월 24일
@John, Pardon the yelling: THE MIT KEMAR HRTFS ARE NOT GIVEN FOR THE RIGHT AND LEFT EARS. Please read the documentation about how they recorded the HRTFS.
Maurel
Maurel 2015년 12월 29일
Hi !! thanks for your helpful post. I wonder if the unit is volt or mV ? Please can you confirm me that the unit of the amplitude axe is in Volt (or mV) ? thank !!
muhammad faiz
muhammad faiz 2017년 12월 4일
hi sorry, but why it display "Undefined function or variable 'wavread'." after i run this coding "[y,fs] = wavread(filename);" ??
Florian Schüling
Florian Schüling 2018년 1월 25일
try: [y,fs] = audioread ('Filename')
maithri kodakandla
maithri kodakandla 2019년 2월 12일
thank you :)
Natalie Phillips
Natalie Phillips 2019년 3월 24일
Hello Wayne King,
Could you explain the variables and why you put them in the format you did? If you can explain your code with comments that would be helpful.
Thank you,
Natalie
Eshaan Goyal
Eshaan Goyal 2020년 10월 7일
what should be its xlabel and ylabel (for the graph which is plotted)
irtaza mazhar
irtaza mazhar 2022년 1월 26일
wht if channel is 1??
Anzzza
Anzzza 2022년 2월 9일
when you have stereo audio, you got two channels. if you can, it's easier to work with one

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2011년 11월 23일

댓글:

2022년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by