Matlab Recording Audio Onset

27 views (last 30 days)
minmi
minmi on 28 Nov 2017
Answered: Walter Roberson on 28 Nov 2017
I was wondering if there was a way to start recording audio in Matlab once someone starts talking instead of setting a specific time before the recording starts. I am trying to see if I can record verbal responses to stimuli that is shown on screen and I want to be able to get the time from onset of stimuli to when the person starts talking AND a recording of what the person says. If anyone knows if this is possible using Matlab or Psychtoolbox functions, I would greatly appreciate it.

Answers (1)

Walter Roberson
Walter Roberson on 28 Nov 2017
"I was wondering if there was a way to start recording audio in Matlab once someone starts talking instead of setting a specific time before the recording starts."
No, not unless you have the audio connected to a data acquisition device from National Instruments and you use the Data Acquisition Toolbox and you configure a trigger; https://www.mathworks.com/help/daq/ref/addtriggerconnection.html . The device cannot have been configured as an audio device; addtriggerconnection() specifically says that audio devices are not permitted for this. The example at https://www.mathworks.com/help/daq/acquire-voltage-data-using-a-digital-trigger.html is a useful reference.
You would have to be a bit careful in devising the trigger, taking into account input levels https://www.kfs.oeaw.ac.at/manual/3.8/html/userguide/461.htm and that idle is often center of the range rather than minimum.
It can be done, but this is probably not what you should be doing.
Instead, you should be using the Audio System Toolbox (or DSP toolbox if your MATLAB is not recent enough for Audio System Toolbox) for continuous audio acquisition instead of using audiorecord() or similar. You would use silence detection to determine whether to keep the audio buffer or not. You can search the Answers forum for more about silence detection .

Community Treasure Hunt

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

Start Hunting!