How to obtain the exact onset of a sound?
4 views (last 30 days)
Show older comments
Laura Colomar
on 19 Dec 2020
Answered: Image Analyst
on 19 Dec 2020
Hello!
I am presenting a sound using the function 'soundsc'. I want to send a marker exactly when the sound starts. I was using 'GetSecs' just after the 'soundsc' function to get the onset of the stimuli. Would that be accurate enough? If not, how could I now the exact onset of my sound?
Thank you in advance!
0 Comments
Accepted Answer
Image Analyst
on 19 Dec 2020
Why can't you just read the sound and find when the magnitude exceeds a threshold that you think is required for it to be audible. Like if your sound amplitude ranges from -1 to 1, and you think the value needs to be more than 0.05 to be audible, just do
[y, fs] = audioread(filename);
startingIndex = find(abs(y) > 0.05, 1, 'first');
0 Comments
More Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!