Error while recording using audio recorder object

4 次查看(过去 30 天)
Everytime I work with this code, I'm getting errors like this.I'm not unable to rectify the problem and solve it.Could anybody please help?
How can I give the audiodata to ffname?
Error using audioread>readaudio (line 143)
The filename specified was not found in the MATLAB path.
Fs=8000;
ch=1;
nbits=16;
Nseconds=5;
recorder=audiorecorder(Fs,nbits,ch);
disp('Start speaking..')
recordblocking(recorder,Nseconds);
disp('End of Recording.');
record_file=getaudiodata(recorder);
ffname = sprintf('%s%s',record_file);
[st_dat,fs1] = audioread(ffname);
st_speech = resample(st_dat,fs,fs1);
st_y(1,:) = pyulear(st_speech,order,nfft,fs);

采纳的回答

Jan
Jan 2021-9-16
record_file=getaudiodata(recorder);
ffname = sprintf('%s%s',record_file);
getaudiodata replies a numerical array with the signal. The name with the part "file" is missleading. Then you try to convert this array to a string using %s%s as format. Afterwards you try to use this string as a file name, but of course there is no such file.
Why do you try a read a file at all, if you do have the signal already?

更多回答(0 个)

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by