Intensity of a noise
8 ビュー (過去 30 日間)
古いコメントを表示
Hi. I have an question. can we determine intensity of tones in matlab? for example I use the code below for creating a noise and I want to be at 60 dB, can any one help me please!
nsamples = floor(noise_dur*fs);
noise_all_Hz=randn(nsamples,1);
% Take fft of the noise
noise_fft = fft(noise_all_Hz);
freqs= [0:size(noise_fft,1)-1]/size(noise_fft,1)*fs;
% Get index for your Frequencies
[~,idx_950] = min(abs(freqs-950));
[~,idx_1050] = min(abs(freqs-1050));
% "zero out" all other bins
noise_fft(1:idx_950) = randn(idx_950,1)*1e-3;
noise_fft(idx_1050:end) = randn(size(noise_fft,1)-idx_1050+1,1)*1e-3;
% Get back time signal
noise = ifft(noise_fft,'symmetric');
noise=noise';
2 件のコメント
Shae Morgan
2020 年 8 月 31 日
Hi Parisa,
dB measures are relative comparisons. In order to know what you want to be 60 dB, you'll need to know some reference value. For example, if you want some sound to be 60 dB relative to the softest sound the average human can hear, you'll need to find dB SPL, which is some comparison of sound pressure relative to that soft sound. Now, in the programming, MATLAB doesn't do measures of micropascals (units of sound pressure), but it does measure voltage. So to convert voltages into dB you'll need to know some reference voltage that equates to the softest voltage a human can hear in your particular system. this depends on a LOT of factors (sound card, computer volume, program volume, circuit noise, etc.).
I'd suggest it probably makes more sense to buy an inexpensive sound pressure meter - measure the sound coming from your speakers, and then adjust the rms amplitude of your signal until the desired intensity is reached.
Hope this helps!
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!