Home > vbmeg > functions > device > trigger_timing > vb_get_voice_onset.m

vb_get_voice_onset

PURPOSE ^

Find voice onset time that smoothed signal exceed the threshold value

SYNOPSIS ^

function [ix ,y0, yave] = vb_get_voice_onset(y,level,parm)

DESCRIPTION ^

 Find voice onset time that smoothed signal exceed the threshold value
    [ix ,yh, yave] = vb_get_voice_onset(y,level,parm)
 y   : voice signal
 level : threshold level
 parm  : parameter structure

 --- Voice onset extraction procedure
 1. Smoothed amplitude (yave) is calculated by moving average of abs(y) 
    with time window length of t_smooth (10ms : 100Hz)
 2. Gamma distribution is fitted to the 'yave' histgram 
 3. Default threshold value (y0) is determined 
    from estimated gamma distribution
 4. threshold value yh = y0 * level
 5. Voice onsets are extracted where 'yave' exceed the threshold
 
 --- Condition for voice onset
 1. Period length that 'yave' exceed the threshold is larger than 't_period'
 
 --- Optional parameter for voice onset
 parm.t_period : minimum period length that yave exceeds the threshold [50 ms]
 --- Usually following parameters need not be changed
 parm.p_val : P-value corresponding to the threshold  [0.0001]
 parm.t_smooth : moving average window length         [10 ms]
 --- Output
 ix : extracted onset time index
      if extracted voise length is less than threshold_r, it is rejected
 y0 : amplitude threshold value estimated by using smoothed signal histogram
 yave : smoothed signal by moving average
      
 2009-6-11 Masa-aki Sato
 2011-12-15 Masa-aki Sato
   Parameters to control onset condition are changed
 2012-2-22 Masa-aki Sato
   threshold determination is changed

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ix ,y0, yave] = vb_get_voice_onset(y,level,parm)
0002 % Find voice onset time that smoothed signal exceed the threshold value
0003 %    [ix ,yh, yave] = vb_get_voice_onset(y,level,parm)
0004 % y   : voice signal
0005 % level : threshold level
0006 % parm  : parameter structure
0007 %
0008 % --- Voice onset extraction procedure
0009 % 1. Smoothed amplitude (yave) is calculated by moving average of abs(y)
0010 %    with time window length of t_smooth (10ms : 100Hz)
0011 % 2. Gamma distribution is fitted to the 'yave' histgram
0012 % 3. Default threshold value (y0) is determined
0013 %    from estimated gamma distribution
0014 % 4. threshold value yh = y0 * level
0015 % 5. Voice onsets are extracted where 'yave' exceed the threshold
0016 %
0017 % --- Condition for voice onset
0018 % 1. Period length that 'yave' exceed the threshold is larger than 't_period'
0019 %
0020 % --- Optional parameter for voice onset
0021 % parm.t_period : minimum period length that yave exceeds the threshold [50 ms]
0022 % --- Usually following parameters need not be changed
0023 % parm.p_val : P-value corresponding to the threshold  [0.0001]
0024 % parm.t_smooth : moving average window length         [10 ms]
0025 % --- Output
0026 % ix : extracted onset time index
0027 %      if extracted voise length is less than threshold_r, it is rejected
0028 % y0 : amplitude threshold value estimated by using smoothed signal histogram
0029 % yave : smoothed signal by moving average
0030 %
0031 % 2009-6-11 Masa-aki Sato
0032 % 2011-12-15 Masa-aki Sato
0033 %   Parameters to control onset condition are changed
0034 % 2012-2-22 Masa-aki Sato
0035 %   threshold determination is changed
0036 %
0037 % Copyright (C) 2011, ATR All Rights Reserved.
0038 % License : New BSD License(see VBMEG_LICENSE.txt)
0039 
0040 % Moving average window size
0041 if isfield(parm,'t_smooth'),
0042     t_smooth = parm.t_smooth;
0043 else
0044     t_smooth = 10; % 10 ms : 100 Hz
0045 end
0046 % sample length for moving average
0047 tau  = fix( parm.fsamp * t_smooth /1000 ); 
0048 
0049 % Moving average with length tau
0050 %yave = filter( ones(tau,1)/tau, 1, abs(y));
0051 yave = filtfilt( ones(tau,1)/tau, 1, abs(y));
0052 
0053 if ~isfield(parm,'plot_mode'), parm.plot_mode = []; end;
0054 
0055 % Estimate threshold by fitting Gamma distribution to histgram
0056 if ~isfield(parm,'p_val'), parm.p_val = 0.0001; end;
0057 
0058 [y0, A ,hy ,ylist] = vb_gamma_dist_param(yave, parm.p_val(1));
0059 
0060 if ~isempty(parm.plot_mode) && parm.plot_mode > 0
0061     vb_show_hist_threshold(y0, A ,hy ,ylist);
0062 end
0063 
0064 if ~isempty(level)
0065     y0 = y0 * level;
0066 end
0067 
0068 
0069 % extract onset
0070 % find event start (signal exceed the threshold)
0071 
0072 if isfield(parm,'t_period')
0073     t_period  = parm.t_period * parm.fsamp /1000;
0074 else
0075     t_period  = 100 * parm.fsamp /1000;
0076 end
0077 
0078 % Period length that 'yave' exceed 'y0' should be larger than 't_period'
0079 ix = vb_trigger_onset(yave,y0,t_period);
0080 
0081 return

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005