How do I decrease sound exponentially when a user press button stop on my player app ?
Show older comments
% code
afr = dsp.AudioFileReader('track1.wav');
adw = audioDeviceWriter('SampleRate', afr.SampleRate)
app.dec =1;
while ~isDone(afr)
audioIn = afr();
audioout = audioIn * app.dec;
adw(audioout);
end
with for the stopbutton
% code
t = 0:1/441000:4;
alpha = 0.1;
app.dec = exp(- alpha *t);
Basically I just want to avoid the brutal stop (which give me bad harmonics) by decreasing the sound smoothly with an exponential when we press the button stop.
Thank you !
1 Comment
Jan
on 4 Oct 2017
Do you want to load a WAV file, fade out the sound in the last 4 seconds and save the file? Did you draw the curve?
t = 0:1/441000:4;
alpha = 0.1;
dec = exp(- alpha *t);
plot(t, dec)
Are you sure that this is the wanted amplification?
Accepted Answer
More Answers (0)
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!