How can i record with a microphone?
Show older comments
I'm working on a program that have to make a noise reduction. The audio in input arrives, in theory, from an external microphone. The record will be convert in a Wav file and then I can work on it. The problem is when I record, because I don't know where the audio come from. I have always the same wave form.
fprintf('-> Step 1/5 Registrazione file: \n\n');
recOg=dsp.AudioRecorder ('OutputNumOverrunSamples', true);
rec=dsp.AudioFileWriter('prova.wav', 'FileFormat', 'WAV')
disp('Stai registrando');
fprintf('\n');
tic;
while tic<5
[audioIn,nOverrun] = step(recOg);
step(rec,audioIn);
if nOverrun > 0
fprintf('La registrazione ha sforato di %d samples\n'...
,nOverrun);
end
end
release(recOg);
release(rec);
disp('Fine della registrazione');
This is the part of the code where I acquire the audio file
1 Comment
Walter Roberson
on 25 Nov 2024
These days you would use https://www.mathworks.com/help/audio/ref/audiodevicereader-system-object.html instead of dsp.AudioRecorder.
Answers (1)
Piyumal
on 25 Nov 2024
Edited: Walter Roberson
on 25 Nov 2024
fprintf('-> Step 1/5 Registrazione file: \n\n');
recOg=dsp.AudioRecorder ('OutputNumOverrunSamples', true);
rec=dsp.AudioFileWriter('prova.wav', 'FileFormat', 'WAV')
disp('Stai registrando');
fprintf('\n');
tic;
while tic<5
[audioIn,nOverrun] = step(recOg);
step(rec,audioIn);
if nOverrun > 0
fprintf('La registrazione ha sforato di %d samples\n'...
,nOverrun);
end
end
release(recOg);
release(rec);
disp('Fine della registrazione');
1 Comment
Walter Roberson
on 25 Nov 2024
Categories
Find more on Audio Processing Algorithm Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!