フィルターのクリア

Click in the beginning and end of pure tone

12 ビュー (過去 30 日間)
Dominik Deml
Dominik Deml 2023 年 5 月 15 日
コメント済み: Les Beckham 2023 年 5 月 21 日
I am wondering why there is a kind of clicking sound in the beginning
but especially in the end of a pure tone.
What I am doing:
spl_rms = 60;
spl_p0 = 20e-6;
spl_max = spl_p0 * 10^(60/20) * sqrt(2);
fs = 20000;
fsig = 1000;
n = 0:1*fs - 1;
t = n/fs;
sig = spl_max*sin(2*pi*fsig*t);
sound(sig, fs);
What is the reason for this clicking sound in the end?
What can I do against it, so how can I modify `sig` to improve this?
  2 件のコメント
Rik
Rik 2023 年 5 月 15 日
I don't see any reason why that would be the case. Are you sure the problem is in Matlab and not your audio device?
You could try to add a low amplitude signal (essentially 0) at the end of sig, to see whether the click is at the end of any sound() call, or whether is is in your signal.
Dominik Deml
Dominik Deml 2023 年 5 月 18 日
Sorry, my fault. It is not because of Matlab, it is because of my audio device BUT I want to use Matlab to fix this problem.

サインインしてコメントする。

採用された回答

Les Beckham
Les Beckham 2023 年 5 月 15 日
編集済み: Les Beckham 2023 年 5 月 15 日
Try adding ramps at the beginning and end to avoid the discontinuities of starting and stopping the tone.
spl_rms = 60;
spl_p0 = 20e-6;
spl_max = spl_p0 * 10^(60/20) * sqrt(2);
fs = 20000;
fsig = 1000;
n = 0:1*fs - 1;
t = n/fs;
sig = spl_max*sin(2*pi*fsig*t);
ramp = linspace(0, 1, 200);
sig(1:200) = sig(1:200) .* ramp;
sig(end-199:end) = sig(end-199:end) .* flip(ramp);
tiledlayout('Horizontal', 'TileSpacing', 'compact')
nexttile
plot(sig)
xlim([1 500])
grid on
nexttile
plot(sig)
xlim([19500 20000])
grid on
% sound(sig, fs);
  4 件のコメント
Dominik Deml
Dominik Deml 2023 年 5 月 19 日
Wow, thank you so much!
Les Beckham
Les Beckham 2023 年 5 月 21 日
You are quite welcome.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by