


VOICEBOX set global parameters for Voicebox functions Y=(FIELD,VAL)
Inputs: F is a field name
V is a new value for the field
Outputs: Y is set equal to the structure of parameters if the
f and v inputs are both present or both absent. If only
input f is specified, then y is set to the value of the
corresponding field or null if it doesn't exist.
This routine contains default values for constants that are used by
other functions in the VOICEBOX toolbox. Values in the first section below,
entitled "System-dependent directory paths" should be set as follows:
PP.dir_temp directory for storing temporary files
PP.dir_data default directory to preappend to speech data file names
when the "d" option is specified in READWAV etc.
PP.shorten location of SHORTEN executable. SHORTEN is a proprietary file compression
algorithm that is used for some SPHERE-format files. READSPH
will try to call an external decoder if it is asked to
read such a compressed file.
PP.sfsbin location of Speech Filing Sysytem binaries. If the "c" option
is given to READSFS, it will try to create a requested item
if it is not present in the SFS file. This parameter tells it
where to find the SFS executables.
PP.sfssuffix suffix for Speech Filing Sysytem binaries. READSFS uses this paremeter
to create the name of an SFS executable (see PP.sfsbin above).
Other values defined in this routine are the defaults for specific algorithm constants.
If you want to change these, please refer to the individual routines for a fuller description.

0001 function y=voicebox(f,v) 0002 %VOICEBOX set global parameters for Voicebox functions Y=(FIELD,VAL) 0003 % 0004 % Inputs: F is a field name 0005 % V is a new value for the field 0006 % 0007 % Outputs: Y is set equal to the structure of parameters if the 0008 % f and v inputs are both present or both absent. If only 0009 % input f is specified, then y is set to the value of the 0010 % corresponding field or null if it doesn't exist. 0011 % 0012 % This routine contains default values for constants that are used by 0013 % other functions in the VOICEBOX toolbox. Values in the first section below, 0014 % entitled "System-dependent directory paths" should be set as follows: 0015 % PP.dir_temp directory for storing temporary files 0016 % PP.dir_data default directory to preappend to speech data file names 0017 % when the "d" option is specified in READWAV etc. 0018 % PP.shorten location of SHORTEN executable. SHORTEN is a proprietary file compression 0019 % algorithm that is used for some SPHERE-format files. READSPH 0020 % will try to call an external decoder if it is asked to 0021 % read such a compressed file. 0022 % PP.sfsbin location of Speech Filing Sysytem binaries. If the "c" option 0023 % is given to READSFS, it will try to create a requested item 0024 % if it is not present in the SFS file. This parameter tells it 0025 % where to find the SFS executables. 0026 % PP.sfssuffix suffix for Speech Filing Sysytem binaries. READSFS uses this paremeter 0027 % to create the name of an SFS executable (see PP.sfsbin above). 0028 % Other values defined in this routine are the defaults for specific algorithm constants. 0029 % If you want to change these, please refer to the individual routines for a fuller description. 0030 0031 % Bugs/Suggestions 0032 % (1) Could allow a * at the end of F to act as a wildcard and return/print a part structure 0033 0034 % Copyright (C) Mike Brookes 2003 0035 % Version: $Id: voicebox.m 713 2011-10-16 14:45:43Z dmb $ 0036 % 0037 % VOICEBOX is a MATLAB toolbox for speech processing. 0038 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0039 % 0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0041 % This program is free software; you can redistribute it and/or modify 0042 % it under the terms of the GNU General Public License as published by 0043 % the Free Software Foundation; either version 2 of the License, or 0044 % (at your option) any later version. 0045 % 0046 % This program is distributed in the hope that it will be useful, 0047 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0048 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0049 % GNU General Public License for more details. 0050 % 0051 % You can obtain a copy of the GNU General Public License from 0052 % http://www.gnu.org/copyleft/gpl.html or by writing to 0053 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0055 0056 persistent PP 0057 if isempty(PP) 0058 0059 % System-dependent directory paths and constants 0060 0061 PP.dir_temp='F:\TEMP'; % directory for storing temporary files 0062 PP.dir_data='E:\dmb\data\speech'; % default directory to preappend to speech data file names 0063 PP.shorten='C:\bin\shorten.exe'; % location of shorten executable 0064 PP.flac='C:\bin\flac.exe'; % location of flac executable 0065 PP.sfsbin='F:\Program Files\SFS\Program'; % location of Speech Filing Sysytem binaries 0066 PP.sfssuffix='.exe'; % suffix for Speech Filing Sysytem binaries 0067 PP.memsize=50e6; % Maximum amount of temporary memory to use (Bytes) 0068 0069 % DYPSA glottal closure identifier 0070 0071 PP.dy_cpfrac=0.3; % presumed closed phase fraction of larynx cycle 0072 PP.dy_cproj=0.2; % cost of projected candidate 0073 PP.dy_cspurt=-0.45; % cost of a talkspurt 0074 PP.dy_dopsp=1; % Use phase slope projection (1) or not (0)? 0075 PP.dy_ewdly=0.0008; % window delay for energy cost function term [~ energy peak delay from closure] (sec) 0076 PP.dy_ewlen=0.003; % window length for energy cost function term (sec) 0077 PP.dy_ewtaper=0.001; % taper length for energy cost function window (sec) 0078 PP.dy_fwlen=0.00045; % window length used to smooth group delay (sec) 0079 PP.dy_fxmax=500; % max larynx frequency (Hz) 0080 PP.dy_fxmin=50; % min larynx frequency (Hz) 0081 PP.dy_fxminf=60; % min larynx frequency (Hz) [used for Frobenius norm only] 0082 PP.dy_gwlen=0.0030; % group delay evaluation window length (sec) 0083 PP.dy_lpcdur=0.020; % lpc analysis frame length (sec) 0084 PP.dy_lpcn=2; % lpc additional poles 0085 PP.dy_lpcnf=0.001; % lpc poles per Hz (1/Hz) 0086 PP.dy_lpcstep=0.010; % lpc analysis step (sec) 0087 PP.dy_nbest=5; % Number of NBest paths to keep 0088 PP.dy_preemph=50; % pre-emphasis filter frequency (Hz) (to avoid preemphasis, make this very large) 0089 PP.dy_spitch=0.2; % scale factor for pitch deviation cost 0090 PP.dy_wener=0.3; % DP energy weighting 0091 PP.dy_wpitch=0.5; % DP pitch weighting 0092 PP.dy_wslope=0.1; % DP group delay slope weighting 0093 PP.dy_wxcorr=0.8; % DP cross correlation weighting 0094 PP.dy_xwlen=0.01; % cross-correlation length for waveform similarity (sec) 0095 0096 % RAPT pitch tracker 0097 0098 PP.rapt_f0min=50; % Min F0 (Hz) 0099 PP.rapt_f0max=500; % Max F0 (Hz) 0100 PP.rapt_tframe=0.01; % frame size (s) 0101 PP.rapt_tlpw=0.005; % low pass filter window size (s) 0102 PP.rapt_tcorw=0.0075; % correlation window size (s) 0103 PP.rapt_candtr=0.3; % minimum peak in NCCF 0104 PP.rapt_lagwt=0.3; % linear lag taper factor 0105 PP.rapt_freqwt=0.02; % cost factor for F0 change 0106 PP.rapt_vtranc=0.005; % fixed voice-state transition cost 0107 PP.rapt_vtrac=0.5; % delta amplitude modulated transition cost 0108 PP.rapt_vtrsc=0.5; % delta spectrum modulated transition cost 0109 PP.rapt_vobias=0.0; % bias to encourage voiced hypotheses 0110 PP.rapt_doublec=0.35; % cost of exact doubling or halving 0111 PP.rapt_absnoise=0; % absolute rms noise level 0112 PP.rapt_relnoise=2; % rms noise level relative to noise floor 0113 PP.rapt_signoise=0.001; % ratio of peak signal rms to noise floor (0.001 = 60dB) 0114 PP.rapt_ncands=20; % max hypotheses at each frame 0115 PP.rapt_trms=0.03; % window length for rms measurement 0116 PP.rapt_dtrms=0.02; % window spacing for rms measurement 0117 PP.rapt_preemph=-7000; % s-plane position of preemphasis zero 0118 PP.rapt_nfullag=7; % number of full lags to try (must be odd) 0119 0120 % now check some of the key values for validity 0121 0122 if exist(PP.dir_temp)~=7 % check that temp directory exists 0123 PP.dir_temp = winenvar('temp'); % else use windows temp directory 0124 end 0125 0126 [fnp,fnn,fne]=fileparts(mfilename('fullpath')); 0127 if exist(PP.shorten)~=2 % check that shorten executable exists 0128 PP.shorten=fullfile(fnp,'shorten.exe'); % next try local directory 0129 if exist(PP.shorten)~=2 % check if it exists in local directory 0130 PP.shorten='shorten.exe'; % finally assume it is on the search path 0131 end 0132 end 0133 0134 if exist(PP.flac)~=2 % check that flac executable exists 0135 PP.flac=fullfile(fnp,'flac.exe'); % next try local directory 0136 if exist(PP.flac)~=2 % check if it exists in local directory 0137 PP.shorten='flac.exe'; % finally assume it is on the search path 0138 end 0139 end 0140 0141 end 0142 if nargin==0 0143 if nargout==0 0144 % list all fields 0145 nn=sort(fieldnames(PP)); 0146 cnn=char(nn); 0147 fprintf('%d Voicebox parameters:\n',length(nn)); 0148 0149 for i=1:length(nn); 0150 if ischar(PP.(nn{i})) 0151 fmt=' %s = %s\n'; 0152 else 0153 fmt=' %s = %g\n'; 0154 end 0155 fprintf(fmt,cnn(i,:),PP.(nn{i})); 0156 end 0157 else 0158 y=PP; 0159 end 0160 elseif nargin==1 0161 if isfield(PP,f) 0162 y=PP.(f); 0163 else 0164 y=[]; 0165 end 0166 else 0167 if isfield(PP,f) 0168 PP.(f)=v; 0169 y=PP; 0170 else 0171 error(sprintf('''%s'' is not a valid voicebox field name',f)); 0172 end 0173 end