SpHr_HRIRMeasures [ flags  ] [ DataSet=, ColorsWave=,  AzElFile=, IRsFile= ]


Calculates DFT-based measurements of Head-Related Impulse Responses (HRIR). Measurements are available for 3 Neumann KU100 DataSets, made available by the Institute of Communication Systems, University of Applied Sciences. http://audiogroup.web.th-koeln.de


Suggested Parameters

DataSet = dataset

    Determines which set of HRIR measurements are used. 

    Neumann KU100 dummy head HRIRs data sets:

    dataset = 1:  Full sphere equiangular 2° gaussian quadrature with 16020 nodes. Default when the DataSet keyword is omited or 1 > set > 5.

    dataset = 2:  Circular horizontal turn with resolution of 1°. Dummy head turned using a thin, rotating microphone stand. 

    dataset = 3:  Similar to dataset = 2 but the dummy head was turned using the complete 3D robot arm and rotation mount used in data set 1.


ColorsWave = { srcWaveName, LayerIndex, CTString, ReverseCT, destWaveName, [ ScaleType_or_minVal, maxVal ] }

    Generates a single R, G, B, A valued wave, in the range [0,1],  for coloring a gizmo surface (see surfaceColorWave property). The ColorsWave keyword is incompatible with all other flags (except /DF). 

    srcWaveName is a wave generated by one of the flags below when DataSet = 1.

    LayerIndex specifies the layer for which the RGBA wave is to be generated. Values generally correspond to the index of a frequency passed by the /XWav flag or frequency generated by the /XLog flag.

    CTString String corresponding to a built-in color table (see CTabList() function).

    ReverseCT Specifies in the color table values should be reversed.

    destWaveName Destination for the generated RGBA wave.

    ScaleType_or_minVal Specifies how srcWaveName values are scaled when generating destWaveName:

    ScaleType_or_minVal = 0 use only selected layer for scaling (default if ScaleType is omitted).

    ScaleType_or_minVal = 1 use only selected layer for scaling and scale values so that they are symmetric around zero.

    ScaleType_or_minVal = 2 use all layers for scaling.

    ScaleType_or_minVal = 3 use all layers for scaling and scale values so that they are symmetric around zero.

    maxVal   If maxVal is not omitted, values in destWaveName are scaled between minVal and maxVal regardless of values passed by srcWaveName. To use one of the automatic ScaleTypes mentioned above, maxVal must be omitted.


Optional Flags

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


/Ramp = { on, off }

    Specifies the length of on and off ramps, in milliseconds, applied to HRIRs. If omitted, default ramps of 0.15 ms and 0.7 ms are used, respectively.


DFT ouput flags

    These flags control DFT-based analyses on the HRIRs.

    When DataSet = 1, ouput is transposed so that azimuth varies along the X-axis, elevation varies along the Y-axis, and frequency varies along the Z-axis. Use MaxtixOp with transposeVol parameter to obtain alternative transpositions.

    When DataSet = 2 or 3, azimuth varies along the X-axis and frequency varies along the Y-axis.


/Pnts = DFTPnts

    Number of DFT points. The flag is ignoed if DFTPnts < 128. If DFTPnts is incompatible with the DFT algorithm, the next larger compatible number of points is used. Compatible sizes are = f * 2n, where f is 1, 3, 5, or 15 and n is at least 3 see:  https://developer.apple.com/documentation/accelerate/1450061-vdsp_dft_zop_createsetup?language=objc


/MagL = { MagLDestWaveName [, dB ] }

    MagLDestWaveName destination for left ear DFT magnitude values.

    dB = 0: output is linear (Pa)

    dB = 1: output is in dB, computed as 20*log(mag)

    dB = 2: output is in dB, referenced to 20 µPa, computed as 20*log(mag/0.00002) (Default if dB is omitted)


/MagR = { MagRDestWaveName [, dB ] }

    Same as /MagL but for the right ear.


/PhiL = { PhiLDestWaveName [, unwrap ] }

    PhiLDestWaveName specifies the destination wave for DFT phase values.

    unwrap = 0: values are wrapped (Default if unwrap is omitted)

    unwrap = 1: values are unwrapped using π modulus.


/PhiR = { PhiRDestWaveName [, unwrap ] }

    Same as /PhiL but for the right ear.


/IPD = { IPDDestWaveName [, unwrap ] }

    IPDDestWaveName specifies the destination wave for interaural phase difference (IPD) values.

    unwrap = 0: IPD is computed using wrapped phase values.

    unwrap = 1: IPD is computed using unwrapped phase values. (Default if unwrap is omitted)


/ITD = { ITDDestWaveName [, unwrap ] }

    ITDDestWaveName specifies the destination wave for interaural time difference (ITD) values.

    unwrap = 0: ITD is computed as IPD/frequency, using wrapped phase values.

    unwrap = 1: ITD is computed as IPD/frequency, using unwrapped phase values. (Default if unwrap is omitted)


/Oct = OctDenom

    DFT results are smoothed with a sliding window having a width calculated as: frequency*10^(3.0103/(10*OctDenom).


/XWav = xSrcWaveName

    xSrcWaveName is the specification to a wave providing frequencies for which DFT values are interpolated. One may, for instance, pass a wave of filter-bank center frequencies using this flag.  When used, DFT destination waves should be displayed vs xSrcWaveName.


/Xlog = { numPnts [,  xlogDestWaveName, firstX, lastX ] }

    DFT frequencies are interpolated so that they are logarithmically spaced.

    numPnts is the number of points for which interpolated DFT values are obtained. 

    xlogDestWaveName  Destination for the wave of interpolation frequencies. When provided, DFT destination waves should be displayed vs  xlogDestWaveName.

    firstX  Starting interpolation frequency, limited to a value greater than the frequency of the second DFT bin. Thus, firstX must exceed 1 / ((numPnts-2)*(1/fs))), where fs is 48,000 for KU100 DataSets.

    lastX  Last interpolation frequency, limited to fs/2  or < 24,000 Hz for KU100 DataSets.


Optional Parameters

AzElFile=AzElFileString

    Optional full path and file name (HFS format) of an Igor *.ibw binary wave indicating sampled azimuths (in columns 0) and elevations (in columns 1).


IRsFile=IRsFileString

    Optional full path and file name (HFS format) of an Igor *.ibw binary wave providing HRIRs. The number of columns in IRsFile should equal the number of rows in AzElFile.


Examples

Function SpHr_HRIRMeasures_Example()

    SpHr_HRIRMeasures/Pnts=1024/Oct=24/Xlog={5,logHz,200,1000} /ITD={ITD_1,1} DataSet=1 // DataSet = 1

    Display/K=1 as "ITD DataSet = 1"; AppendImage ITD_1

    ModifyImage ITD_1 plane=2

    ModifyImage ITD_1 ctab= {-0.001,0.001,RedWhiteBlue,1}

    ModifyGraph tick=2,axThick=0.5,standoff=0

    Label left "elevation (\\U)"

    Label bottom "azimuth (\\U)"

    ColorScale/C/N=text0/F=0/B=1/H={15,0,5}/A=RC/E width=6,frame=0.00,image=ITD_1,fsize=9,tickLen=3.00,tickThick=0.50

    // DataSet = 2

    SpHr_HRIRMeasures/Pnts=1024/Oct=24/Xlog={5,logHz,200,1000} /ITD={ITD_2,1} DataSet=2

    Display/K=1 as "ITD DataSet = 2"

    AppendToGraph ITD_2[][0] /TN=$"Hz_"+num2istr(logHz[0])

    ModifyGraph rgb($"Hz_"+num2istr(logHz[0]))=(0,0,65535)

    AppendToGraph ITD_2[][1] /TN=$"Hz_"+num2istr(logHz[1])

    ModifyGraph rgb($"Hz_"+num2istr(logHz[1]))=(0,43690,65535)

    AppendToGraph ITD_2[][2] /TN=$"Hz_"+num2istr(logHz[2])

    ModifyGraph rgb($"Hz_"+num2istr(logHz[2]))=(2,39321,1)

    AppendToGraph ITD_2[][3] /TN=$"Hz_"+num2istr(logHz[3])

    ModifyGraph rgb($"Hz_"+num2istr(logHz[3]))=(65535,43690,0)

    AppendToGraph ITD_2[][4] /TN=$"Hz_"+num2istr(logHz[4])

    ModifyGraph rgb($"Hz_"+num2istr(logHz[4]))=(65535,0,0)

    Label left "ITD (\\U)"

    Label bottom "azimuth (\\U)"

    Legend/C/N=text0/J/F=0/H={15,0,5}/A=LT "Frequency\r\\s(Hz_200) 200\r\\s(Hz_299) 299\r\\s(Hz_447) 447\r\\s(Hz_669) 669\r\\s(Hz_1000) 1000"

End

Contact: Brian