How can I extract the time length (in miliseconds) between two audio signals?

21 visualizzazioni (ultimi 30 giorni)
I have a psychology experiment paradigm which asks participants to give a verbal response immediately after they hear a beep sound. Participants may or may not respond to the beep, and their response could be quick or slow. I need to extract the time length between the end of the beep sound and the start of their verbal response. Such time length should be measured in miliseconds as the total time allowed for each response was 3 seconds (3000 ms). There are hundreds of trials so I would like to find a way to do the extraction automatically. How should I achieve this? Carload thanks to any suggestions!

Risposte (2)

Star Strider
Star Strider il 25 Ott 2025
Considering the nature of this problem, probably the best option is to estimate the signal envelops with the Signal Processing Toolbox envelope function (use the 'peak' option with an appropriate window), decide on a threshold, and measure the time the envelope crosses the threshold.
It may be necessary to use a filter to eliminate noise. If you are using the lowpass function (or any of its friends) for this, use the ImpulseResponse='iir' name-value pair for best results.
This approach as worked for me in the past.
It will probably be necessary to experiment to get the result you want.
  13 Commenti
Wade
Wade il 30 Ott 2025
Since you've separated the audio into three different signal fragments according to their frequency, I wonder if there is a way to play each of them so that I can doublecheck which is which.
Star Strider
Star Strider il 30 Ott 2025
You would have to run my code to separate the signals, do the filtering, and then listen to each one separately.
This only works with Google Chrome with MATLAB Online (I will not use Google Chrome), so I ran it on my desktop instead.
This works --
wavfile = websave('sample-1.zip','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1842543/sample-1.zip')
UZ = unzip(wavfile)
[s,Fs] = audioread(UZ{1});
L = size(s,1)
t = linspace(0, L-1, L).'/Fs;
s500 = bandpass(s(:,1), [250 750], Fs, ImpulseResponse='iir');
s2000 = bandpass(s(:,1), [1900 2100], Fs, ImpulseResponse='iir');
s2500 = bandpass(s(:,1), [2600 2700], Fs, ImpulseResponse='iir');
% sound(s500, Fs) % Voice
% sound(s2000, Fs) % Squeak
% sound(s2500, Fs) % Squeak
That should work as written. (I just tested it.) I commented -out the sound calls. When you run that, un-ciomment them one at a time to listen to that particular vector.
The two that I labelled 'Squeak' sound similar to me, although they are obviously different in the pspectrum 'spectrogram' plot (they are not much different in frequency). I do not recognize much in the 'Voice' vector.
I also experimented with several different ways of finding the envelope (using a lowpass filter) and of finding the beginning of the signal (finding the peak and then finding the last lowest value of the preceeding 10E+3 index range). None of those worked satisfactorally because of the noise in the signal.
These data are extremely difficult to work with, largely because I rarely work with speech signals, only with signals from various sorts of biomedical instrumentation.
.

Accedi per commentare.


Walter Roberson
Walter Roberson il 26 Ott 2025

Categorie

Scopri di più su Measurements and Spatial Audio in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by