フィルターのクリア

Recording and reading audio in realtime

8 ビュー (過去 30 日間)
Michael Salvati
Michael Salvati 2017 年 5 月 10 日
回答済み: Puneet Rana 2017 年 5 月 12 日
I am trying to use the Audio System Toolbox to record audio to a file in real-time, and read from the file in real-time as well, but am having issues. In the RealTimeStreaming example, this is done, but I cannot seem to imitate it. The audio recording works fine, but when I play the file in real time, all I get is a popping sound out the speakers. Can someone correct whatever error I have in the code?
deviceReader = audioDeviceReader;
setup(deviceReader);
fileWriter = dsp.AudioFileWriter(...
'mySpeech.wav',...
'FileFormat','WAV');
File = dsp.AudioFileReader('mySpeech.wav');
Fs = File.SampleRate;
Out = audioDeviceWriter('SampleRate', Fs);
disp('Speak into microphone now.');
tic;
while toc < 10
acquiredAudio = deviceReader();
fileWriter(acquiredAudio);
step(Out,Fs);
end
disp('Recording complete.');
release(deviceReader);
release(fileWriter);

回答 (1 件)

Puneet Rana
Puneet Rana 2017 年 5 月 12 日
Hi Michael,
What do you want the audioDeviceWriter to play? The recorded audio? The audio from a file? In either case, the second input to step() method of audioDeviceWriter object needs to be the audio you want to play. In your code, you are just passing a scalar 'Fs' to it.
HTH,
Puneet

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by