How can i record with a microphone?

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

Answers (1)

Piyumal
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

This appears to be the same code that was posted by @Matteo Nava without any changes.

Sign in to comment.

Categories

Find more on Audio Processing Algorithm Design in Help Center and File Exchange

Asked:

on 17 Mar 2016

Commented:

on 25 Nov 2024

Community Treasure Hunt

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

Start Hunting!