Question about "triggerlevel"

3 次查看(过去 30 天)
Hee Dong Yoon
Hee Dong Yoon 2018-7-11
回答: dpb 2018-7-11
Hi all, I have a question about "triggerlevel" when using psychportaudio in psychtoolbox. I am trying to record audio data when a voice input is above a certain threshold. I believe that "triggerlevel" in the code below is doing that work. I would like to know what that trigger level of 0.1 stands for. Does it represent the input audio's amplitude or frequency? what is the unit used here?
  • This code below is from function SimpleVoiceTriggerDemo(triggerlevel) https://github.com/Psychtoolbox-3/Psychtoolbox-3/blob/master/Psychtoolbox/PsychDemos/SimpleVoiceTriggerDemo.m
% Sound is captured from the default recording device, waiting
% until the amplitude exceeds some 'triggerlevel'.
%
% If the triggerlevel is exceeded, sound capture stops, returning the
% estimated time of "voice onset" in system time.
if nargin < 1
triggerlevel = 0.1;
fprintf('No "triggerlevel" argument in range 0.0 to 1.0 provided: Will use default of 0.1...\n\n');
end
while level < triggerlevel
% Fetch current audiodata:
[audiodata offset overflow tCaptureStart]= PsychPortAudio('GetAudioData', pahandle);
% Compute maximum signal amplitude in this chunk of data:
if ~isempty(audiodata)
level = max(abs(audiodata(1,:)));
else
level = 0;
end
% Below trigger-threshold?
if level < triggerlevel
% Wait for five milliseconds before next scan:
WaitSecs(0.005);
end
end

采纳的回答

dpb
dpb 2018-7-11
"that trigger level of 0.1 stands for."
It's amplitude of the input signal in whatever units it is at that point; that's totally dependent upon what the device returns how it is set up and whether the level variable has been converted to engineering units or scaled or whatever at the point at which it is being compared.
One would guess it's probably V or mV but that's purely speculation without supporting info.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio Plugin Creation and Hosting 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by