Question about "triggerlevel"
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
dpb
il 11 Lug 2018
"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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio Plugin Creation and Hosting in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!