How do I decrease sound exponentially when a user press button stop on my player app ?
古いコメントを表示
% 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 件のコメント
Jan
2017 年 10 月 4 日
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?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Audio Processing Algorithm Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!