フィルターのクリア

How to change wavrecord to audiorecorder ?

10 ビュー (過去 30 日間)
Poison
Poison 2014 年 12 月 3 日
回答済み: Dian 2023 年 9 月 21 日
clc;
clear all;
Fs=8000; %sample rateXY
for k=1:25
clear y1 y2 y3;
display('Record cry');
pause();
x=wavrecord(Fs,Fs); %record sound
t=0.04; %threshold
j=1;
for i=1:8000
if(abs(x(i))>t) %signal>threshold
y1(j)=x(i);
j=j+1;
end
end
y2=y1/(max(abs(y1))); %y2:max absolute value of y1
y3=[y2,zeros(1,3120-length(y2))];
y=filter([1-0.9],1,y3'); %high pass filter to boost the high frequency components
%frame blocking
blocklen=240; %30ms block
overlap=80;
block(1,:)=y(1:240);
for i=1:18
block(i+1,:)=y(i*160:(i*160+blocklen-1));
end
w=hamming(blocklen);
for i=1:19
a=xcorr((block(i,:).*w'),12);
for j=1:12
auto(j,:)=fliplr(a(j+1:j+12));
end
z=fliplr(a(1:12));
alpha=pinv(auto)*z';
lpc(:,i)=alpha;
end
wavplay(x,Fs);
X(k,:)=reshape(lpc,1,228);
Y(k,:)=input('Enter no.(1-Eairh, 2-Eh, 3-Heh, 4-Neh, 5-Owh)');
end
save('lpcdata.mat','X','Y');
Hi, can someone help me. I'm newbie in Matlab. How to change the usage of wavrecord to audiorecorder in the codes above?
  1 件のコメント
M_B
M_B 2019 年 11 月 25 日
Hi is this code for speaker recognition?

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

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 12 月 3 日
Poison - just replace your line of code
x=wavrecord(Fs,Fs);
with the following
% create the recorder
recorder=audiorecorder(Fs,8,1);
% record one second of data
record(recorder,1);
% get the samples
x = getaudiodata(recorder);
And you should be able to continue as before. See audio recorder for details.
  2 件のコメント
Poison
Poison 2014 年 12 月 4 日
Thank you
Sherin Yazir
Sherin Yazir 2020 年 2 月 26 日
It works. Thank you so much

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

その他の回答 (1 件)

Dian
Dian 2023 年 9 月 21 日
clear all;
Fs = 8000;
recObj = audiorecorder(Fs, 16, 1);
disp('Start speaking.');
recordblocking(recObj, 5);
disp( ' End of recording, ');
y = getaudiodata(rec0bj);
audiowrite( ' aiueo.wav', y, Fs);

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by