Clear Filters
Clear Filters

Is there automatic gain in audiorecorder or soundsc?

2 views (last 30 days)
I am collecting data using audiorecorder and playing it using soundsc. I collect for a fixed time - 10 seconds. I collect the results of striking individual piano keys one at a time. For the low (bass) keys that have a long sustain time I have no problem when I play the collected sound back using soundsc. However, on the treble keys that have short sustain times I get a growing loud background noise once the note has died away but 10 seconds has not elapsed. Is there some kind of automatic gain control going on with audiorecorder or soundsc that tries to amplify the background noise once the note has died away?
Here is the script that demonstrates the phenomena:
===============================
clear; close all
%===read a note from analog input
NBits=24; Fs=44100; NChannel=1; RecordLength=10;
recObj = audiorecorder(Fs, NBits, NChannel);
disp('press Enter to start the process and wait 2 s for red RECORD light')
pause; pause(2)
figPos=[ 1234 747 140 50]; fh=figure('Position',figPos,'color',[1 0 0]); % red light text(5,50,'Recording!!'); axis([1 100 1 100]); disp('!!!RECORDING IN PROGRESS!!! '); pause(.5)
recordblocking(recObj, RecordLength);
fh1=figure('Position',figPos,'color',[0 1 0]); % green light disp('End of Recording.'); pause(.5) close(fh)
y = getaudiodata(recObj);
Fs=recObj.SampleRate;
soundsc(y,Fs);
=================================
Thanks,
Dave

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!