SpHr_HilbertCarrierCues [ Flags ]  srcFilterBank


Spatial cues are obtained using the Hilbert transformation.


Parameters

srcFilterBank  Specifies the single precision 'filter bank' for which cues are obtained. See SpHr_FilterBankBiquad. Left channel frequency bands are specified by columns in layer 0. Right channel frequency bands are specified by columns in layer 1.


srcFilterBank(startX, endX)  Specifies an x-range in the source wave.


srcFilterBank[startP, endP]  Specifies a point-range in the source wave.


Flags

/ITD = [ destWaveName ]    

    Interaural time differences (ITD) in seconds. If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_ITDs'. The wave single precision and is always overwritten.


/CFs = centerFrequenciesWave

    If centerFrequenciesWave is passed, Interaural phase differences (IPDs) are divided by center frequency to obtain ITDs.

    If this flag is omitted, phases for the left and right channels are divided by sampling rate and analytic frequency. The right channel is then subtracted from the left.


/HP = highPassFrequency

    If the /CF flag is omitted, very low analytic frequencies, usually due to DFT artifacts can result very large ITD values. Frequencies below highPassFrequency are set to zero. If the /HP flag is omitted, highPassFrequency is set to 20 Hz.


/IPD = [ destWaveName ]

    Interaural phase differences (IPD) in cycles. If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_IPDs'. The wave single precision and is always overwritten.


/ILD = [ destWaveName ]

    Interaural level differences (ILD) in decibels (dB). If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_ILDs'. The wave single precision and is always overwritten.


/ABL = [ destWaveName ]    

    Average binaural level (ABL) in decibels (dB). If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_ABLs'. Values are always in decibels re: 20 µPa, ABL = 20*log((Env[p][q][0]+Env[p][q][1])/(0.00002*2)) The wave single precision and is always overwritten.


/Freq = [ destWaveName ]

    Analytic frequency. Values in layer 0 correspond to the left channel. Values in layer 1 correspond to the right channel. If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_Freqs'. The wave single precision and is always overwritten.


/Phi = [ destWaveName ]

    Analytic phase. Values in layer 0 correspond to the left channel. Values in layer 1 correspond to the right channel. If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_Phase'. The wave single precision and is always overwritten.


/En = [ { dB, destWaveName } ]

    Envelopes. Values in layer 0 correspond to the left channel. Values in layer 1 correspond to the right channel. This wave is single precision and always overwritten.

    /dB= 0: Envelopes are linearly scaled in Pascals (Pa).

    /dB= 1: Envelopes are scaled in decibels (20*log(En)/20 µPa).

    If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_Envs'. 


/dtEn = [ { dB, destWaveName } ]

    Derivatives of zero-crossing envelopes. Values in layer 0 correspond to the left channel. Values in layer 1 correspond to the right channel. Note that times obtained using the /X flag corresponding to these values are in a single layer. This wave is single precision and always overwritten.

    /dB= 0: Envelope derivatives are linearly scaled in Pascals (Pa).

    /dB= 1: Envelope derivatives are scaled in decibels (20*log(En)/20 µPa).

    If destWaveName is omitted, the destination wave uses srcWaveName or nameStr (see /N flag) as a prefix and appends '_dtEnvs'.


/DF = dfRef    dfRef is an optional datafolder reference. Destination waves are written to this existing datafolder, overriding any datafolder specified by destWaveNames. Waves are written to the current datafolder if not specified here or in destWaveNames.


/N = nameStr    nameStr is an optional string to take the place of srcWaveName if destWaveNames are not specified.


/Cues = bitMask

    Bit mask used to determine which cues are generated. Set bit 0 for Xs, bit 1 for Ns, bit 2 for ITDs, bit 3 for IPDs, bit 4 for ILDs, bit 5 for ABLs, bit 6 for frequency, bit 7 for envelopes, bit 8 for envelope derivatives, bit 9 for phase.


/dB = [ db ]    

    Filter bank envelopes (see /En) flag are scaled in decibels re: 20 µPa. Without this flag, envelopes are linearly scaled (Pa). This flag may be overridden by the first parameter of the /En flag and is meant to be used with the /Cues flag or when the /En flag passes no parameters.

    /dB=0: Envelopes are linearly scaled in Pascals (Pa). Default.

    /dB=1: Same as /dB alone. Values are in decibels. 20*log(En)/20 µPa.


/dtdB = [ dtdb ]    

    Filter bank envelope derivatives (see /dtEn flag) are scaled in decibels re: 20 µPa. Without this flag, envelope derivatives are linearly scaled (Pa). This flag may be overridden by the first parameter of the /dtEn flag and is meant to be used with the /Cues flag or when the /dtEn flag passes no parameters.

    /dtdB =0: Envelope derivatives are linearly scaled in Pascals (Pa). Default.

    /dtdB =1: Same as /dB alone. Values are in decibels. 20*log(En)/20 µPa.


Notes

    If srcFilterBank does not have a DFT-compatible number of rows it is temporarily re-dimensioned and then reverted to its original number of rows. Specify an x-range or point-range that is not DFT-compatible to avoid DFT artifacts near the start and end of srcFilterBank. When this is done, the next larger DFT-compatible number of rows will be used, with rows added equally both before and after the selected range.


Example

Function SpHr_HilbertCarrierCues_Example()

    variable fs = 48000

    // Generate binaural noise burst in independent background signal

    SpHr_SignalBinaural/ms=400/Ramp=20/dB=30/HP=50/Sp=1/Ind=1 fs, NoiseBurst

    variable ITD = 0.2 // ms

    SpHr_SignalBinaural/Sum/ms=200/Ramp=20/dB=70/HP=50/Buff={100,100}/Sp=1/Ind=0/ITD={ITD,1} fs, NoiseBurst

    // Generate filter bank

    SpHr_FilterCenterFreqs/R/Type=(2) 100, 500, 3, CFs // log

    SpHr_FilterBankBiquadCoefs 48000, CFs, coefBank

    SpHr_FilterBankBiquad /RMS/Dest=FilterBanks CFs, coefBank, NoiseBurst

    killwaves/Z coefBank, NoiseBurst

    // Generate ITDs using Hilbert transformation

    SpHr_HilbertCarrierCues/CFs=CFs /ITD=ITDs FilterBanks

    killwaves/Z FilterBanks

    Display/K=1/W=(35,45,553,311) as "Carrier ITDs"

    AppendToGraph ITDs[][0] /TN=Hz_100

    AppendToGraph ITDs[][1] /TN=Hz_224

    AppendToGraph ITDs[][2] /TN=Hz_500

    ModifyGraph mode=3,marker=19,msize=1.5

    ModifyGraph rgb(Hz_100)=(0,0,65535),rgb(Hz_224)=(2,39321,1)

    SetAxis left -0.001,0.001

    ModifyGraph zero(left)=1,zeroThick(left)=0.5

    Label left "ITD (\\U)"

    Label bottom "time (\\U)"

    TextBox/C/N=text0/F=0/B=1/H={15,0,5}/A=MT/X=0.00/Y=0.00 "\\sb+06\\Z10CF (Hz)\r\\s(Hz_100) 100\r\\s(Hz_224) 224\r\\s(Hz_500) 500"

    SetDrawEnv ycoord= left,dash= 2,linethick= 0.50

    DrawLine 0,ITD/1000,1,ITD/1000

End

Contact: Brian