Generating a click stimuli

11 views (last 30 days)
mohadeseh zamani
mohadeseh zamani on 22 Nov 2021
Answered: colordepth on 20 Mar 2025
Hello everybody
I want to generate a sound (a 5 dB sound) with a specefic charictristics ( frequency=250, I=3.1*10^(-12), duration=1) when I run this program no sound generate, but this amplitude can generate 5 dB sound and 5 dB is one of the hearing thresholds of people therefore people can hear it. ( if I increase its amplitude (For example I=1) after that I can hear the sound (it is a click),but I want to generate a click stimuli with this amplitude that it can generate a 5 db sound). In your opinion it is related to the click stimuli and we can not hear a click stimuli like a pure tone??
anyone can help me?? I totally stuck it.
Here is the formula of the dB:
I0=10^(-12) %% reference sound intensity
dB=10*log10(I/I0);
I=3.1*10^(-12);
dB=10*log10((3.1*10^(-12))/10^(-12) )= 4.9136 dB (=~ 5 dB)
clc
clear
close all;
f=250;
P=1;
I=3.1*10^(-12); %% If I increase its amplitude (for example I=1), I can hear but I do not want
%I=1; %% I=1 can generate a audible sound
n=100;
SamplingRate_Hz=44100;
t = 0 :(1/SamplingRate_Hz) : (P/f);
y=I*sin(2*pi*f*t);
xt_ramped = toneburst(SamplingRate_Hz,y);
sound(xt_ramped,SamplingRate_Hz);
figure; plot(t,xt_ramped)
%% Here is the function that is use in this program.
function xt_ramped = toneburst(SamplingRate_Hz,y)
xt =y;
fs=SamplingRate_Hz;
ramp_dur=0.0025; %ramp duration in seconds
%% Check out this ramp
%setup ramp
rampSamps = floor(fs*ramp_dur);
window=hanning(2*rampSamps)'; %hanning window is cosine^2 this will change depending on the kind of ramp you want
w1=window(1:ceil((length(window))/2)); %use the first half of hanning function for onramp
w2=window(ceil((length(window))/2)+1:end); %use second half of hanning function of off ramp
w_on_xt = [w1 ones(1,length(xt)-length(w1))];
w_off_xt = [ones(1,length(xt)-length(w2)) w2];
xt_ramped = xt.*w_on_xt.*w_off_xt;
end

Answers (1)

colordepth
colordepth on 20 Mar 2025
I am not an acoustics expert, but I understand that if we can hear the pure tone click sound at 'I' equals 1, then it should be possible to adjust its value to get the desired output of 5 dB.
Your calculation for 'I' (3.1e-12) is correct to achieve 5 dB in theory, but in practice, you might not hear it because the actual output depends on a multitude of factors like the speakers' frequency response, its impedance, the computer's audio gain settings etc.
To get closer to the desired 5 dB output, you’ll need to measure the actual sound level using a dB meter. Start with an audible 'I' value, play the sound, and adjust 'I' incrementally while monitoring the output with the meter. I am not sure how well the meter will handle short clicks, but the idea is using some form of audio sensing to measure the output amplitude. This will compensate for real-world variables like your hardware setup and the system audio settings.

Community Treasure Hunt

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

Start Hunting!