Question about "triggerlevel"

조회 수: 5 (최근 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