SpHr_HRIR [ flags  ] [ DataSet, AzElFile, IRsFile ]


Retrieves Head-Related Impulse Responses (HRIR) from a chosen dataset. HRIRs for the Neumann KU100 dummy head are currently available. Made available by the Institute of Communication Systems, University of Applied Sciences. http://audiogroup.web.th-koeln.de


Suggested Keyword Parameters

DataSet = dataset

    Determines which HRIR measurement set is returned, used for convolution, or passed to DFT functions.

    Neumann KU100 dummy head HRIRs data sets:

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

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

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

    dataset = 4:  Equidistant spherical Lebedev grid with 2354 nodes.

    dataset = 5:  Equidistant spherical Lebedev grid with 2702 nodes.


Optional Flags

/Ind = index    Specifies the index for the HRIRs returned, used for convolution, or passed to DFT functions. This flag overrides the /Deg and /Rad flags.


/Deg = { azimuth [, elevation] }

    Specifies the azimuth and elevation, in degrees, for which HRIRs are returned, used for convolution, or passed to DFT functions. azimuth can range from -180° to 178° (Dataset =1) or 179° (Dataset = 2) with 0° being directly in front of the dummy head. elevation ranges from -88.5° to 88.5° (Dataset =1) with 0° being in front of the dummy head. If omitted, elevation is 0°. Values closest to azimuth and elevation in the selected DataSet are set as variables V_Az and V_El. The closest index is set as V_Index.


/Rad = { azimuth [, elevation] }

    Specifies the azimuth and elevation, in radians, for which HRIRs are returned, used for convolution, or passed to DFT functions. azimuth can range from -π to ~π with 0 being directly in front of the dummy head. elevation can range from approximately -π/2 to π/2 with 0 being directly in front of the dummy head. If omitted, elevation is 0. Values closest to azimuth and elevation in the selected DataSet are set as variables V_Az and V_El. The closest index is set as V_Index.


/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.


/Imp = impulseWaveName

    Specifies the destination for HRIRs corresponding to directions specified by the /Deg, /Rad, or /Ind flag.


/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.


/Conv = { SrcWaveName, [ DestWaveName ] }

    Convolves SrcWaveName with the selected HRIRs, writing the results to DestWaveName. If DestWaveName is omitted, SrcWaveName is overwritten.


/Az = { azimuthsDestWaveName, [ format ] }

    Returns azimuths corresponding to the selected DataSet in the wave specified by azimuthsDestWaveName.

    format = 0: values are in radians and unaltered. (Default if format is omitted).

    format = 1: values are in degrees but otherwise unaltered.

    format = 2: values are in radians and shifted so that 0 is in front of the dummy head, as required by the /Rad flag.

    format = 3: values are in degrees and shifted so that 0° is in front of dummy head, as required by the /Deg flag.


/El = { elevationsDestWaveName, [ format ] }

    Returns elevations corresponding to the selected DataSet in the wave specified by elevationsDestWaveName.

    format = 0: values are in radians and unaltered. (Default if format is omitted).

    format = 1: values are in degrees but otherwise unaltered.

    format = 2: values are in radians and shifted so that 0 is in front of the dummy head, as required by the /Rad flag.

    format = 3: values are in degrees and shifted so that 0° is in front of the dummy head, as required by the /Deg flag.


/CDFC = { cdfc [, cdfcDestWaveName ] }

    cdfc = 1, Apply Common Diffuse Field Compensation filter (CDFC). Default if /CDFC flag is omitted.

    cdfc = 0, CDFC filter is not applied.

    cdfcDestWaveName (optional) Wave specification for retrieving CDFC filter coefficients.


/HPCF = { hpStr [, hpcfDestWave ] }

    Apply Headphone correction filter.

    hpStr must be one of the following: Beyerdynamic DT250, Beyerdynamic DT770PRO 250Ohms, Beyerdynamic DT880, Beyerdynamic DT990PRO, Sennheiser HD430, Sennheiser HD480, Sennheiser HD560ovationII, Sennheiser HD565ovation, Sennheiser HD600, Sennheiser HD650, AudioTechnica ATH M50, Shure SRH940, Presonus HD7, AKG K141MK2, AKG K240DF, AKG K240MK2, AKG K271MK2, AKG K271STUDIO, AKG K601, AKG K701, AKG K702, AKG K1000 Closed, AKG K1000 Open. Spaces may be replaced with "_". Other minor string omissions or variations are allowed for some headphones.

    hpcfDestWave  (optional) Wave specification for retrieving selected HPCF coefficients.

    Another option is to use an app like Rogue Amoeba's SoundSource:  https://rogueamoeba.com/soundsource/


DFT ouput flags

    These flags control DFT-based analyses on the selected HRIRs.

/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


/Mag = { MagDestWaveName [, dB ] }

    MagDestWaveName specifies the destination wave for 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)


/Phi = { PhiDestWaveName [, unwrap ] }

    PhiDestWaveName 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.


/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 can 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 Keyword 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.


Example

Function SpHr_HRIR_Example()

    // Make gaussian noise (monaural)

    SpHr_SignalGaussian/ms=50/dB=70/Sp=1/ramp=20/HP=50 48000, Noise

    // Get HRIRs, amplitude spectra, and convolved Noise signals

    // corresponding to 10° azimuth and 10° elevation.

    SpHr_HRIR /Deg={10,10}/Imp=HRIRs/Mag=Mag/Conv={noise,SpatializedNoise}

    // Display HRIRs

    Display/K=1 HRIRs[][1]/TN=right,HRIRs[][0]/TN=left

    ModifyGraph rgb(left)=(0,0,65535)

    // Display Spatialized noises

    Display/K=1 SpatializedNoise[][1]/TN=right,SpatializedNoise[][0]/TN=left

    ModifyGraph rgb(left)=(0,0,65535)

    // Display HRIR amplitude spectra

    Display/K=1 Mag[][1]/TN=right,Mag[][0]/TN=left

    ModifyGraph rgb(left)=(0,0,65535)

End

Contact: Brian