Back to Computing Page

Simulating Free Space via Headphones
Programming Note No. 4
Ravi Kochhar
Dept. of Physiology
Univ. of Wisconsin - Madison
Feb. 14, 1992
Rev: Mar. 4, 1992
Rev. level : 1.002

The program FF is used to deliver "Free Field" stimuli to the cat's eardrum via a pair of headphones and probe tubes. The aim is to simulate free space, i.e. to present a pair of stimuli, one to the left ear and one to the right, shaped in such a way that they are identical to what the cat would have heard in free space from a speaker at a particular location in space. This note is a description of the procedure used to compute the waveforms which are presented via the headphones. Typically this procedure is used once during each experiment, after the headphones have been calibrated but before any single unit recordings are started.

The computer program that does the waveform computation is named FFSTIM. At present it computes click waveforms, henceforth referred to as "corrected clicks". Each pair of corrected clicks (one for the left ear and one for the right) corresponds to a unique location in space. Corrected clicks are computed from all locations in space from -180 deg to +180 deg azimuth and -36 deg to +90 deg elevation, spaced 4.5 deg apart in both azimuth and elevation. These 3600+ corrected clicks are then stored on disc for use during the experiment. With some extensions FFSTIM could be used to compute corrected waveforms other than clicks, such as noise bursts or other natural sounds. The program runs on a VAX/VMS computer, but is fairly system independent.


For input, FFSTIM uses "raw click waveforms" recorded in an anechoic chamber by Musicant, Chan and Hind (ref 1). These raw clicks are recordings made at the eardrum of the cat using a small probe microphone. Two recordings (one each for the left and right ear) are made for each of approximately 1800 positions of a loudspeaker positioned every 4.5 degrees in space. The loudspeaker is positioned at each location in space under computer control using a motor driven arm to within a precision of better than a small fraction of one degree. The raw clicks consist of recordings of the waveform at each eardrum digitized using an analog-to-digital converter with a sampling interval of between 4 and 8 microsecs. Most of the recordings are in response to a brief (10 microsec) rectangular pulse delivered to the loudspeaker, and the duration of the raw click sampling period is either 6.4 or 8 millisecs. There is also a "free field calibration" recording made for each microphone with the cat removed, and the microphone placed at the location where the center of the cat's head would have been. This free-field calibration is used later by FFSTIM to correct for the characteristics of the loudspeaker and the probe microphone. All of the 3600+ raw click waveforms, along with the free-field calibration, are stored in a data file for later user by FFSTIM. A full description of the procedure and other details of these raw click recordings are available in ref. no. 1.

The following is a description of the steps taken by FFSTIM to convert the raw clicks into corrected clicks.

The first 11 steps below are carried out one waveform at a time.

(1) Each raw click waveform is read from the disc. Any baseline (DC) shift is removed, and the beginning and end of the waveform are matched by applying a cosine taper window to the time domain. This is done to remove any low frequency artifacts from the subsequent FFT, and any DC shifts introduced by the amplifiers or other recording apparatus. The raw click waveforms are each 1024 or 2048 points in length. (This removal of DC and application of the cosine taper window is currently being done by the program "PIN" even before the waveforms are read by FFSTIM).

(2) An amplitude and phase spectrum is computed using an FFT routine. The amplitude is converted to units of dB rel. to 1 volt rms, and the phase is stored in units of radians.

(3) An upper frequency corner is determined arbitrarily. This is done by searching the amplitude spectrum in 2 KHz bands until the first such band is found, with 75 percent of the points within that band below -90 dB. If the corner is greater than 30 KHz then it is fixed at 30 KHz. The reason for this step is to eliminate any data at very high frequencies which is below the noise floor. The upper frequency corner is used in subsequent steps.

(4) The amplitude and phase spectra are then corrected for the microphone and loudspeaker characteristics using the free-field calibrations. Two free-field calibrations are stored, one for the left and the other for the right ear (see above). These free-field calibrations are converted to the frequency domain using an FFT, and then subtracted from the spectra of the raw click waveform. Amplitude spectra (in dB) and Phase spectra (in radians) are subtracted separately. The resultant click waveform at this point is now independent of the characteristics of the loudspeaker, microphone and recording amplifiers, etc.

(5) A lower frequency corner is determined. The lower freq corner is determined by scanning the amplitude spectrum of the click for the lowest amplitude between 1500 Hz and 2000 Hz. The frequency at which this lowest amplitude occurs is used as the lower frequency corner.

(6) The click waveform above the upper frequency corner is next low-pass filtered using a Butterworth filter with the following filter function :


where CORN is the upper frequency corner freq from step (3) above and FREQ is the current frequency. The reason for the application of this filter is to discard the energy at frequencies which are above the freq. range of interest, and which are often down in the noise level of the recording microphone. The use of the Butterworth filter was suggested by Joe Chan. It results in a smooth transition between the amplitudes at freqs. below and above the upper freq. corner. It also keeps the spectral amplitudes of the mid-frequency components unchanged. Failure to apply this filter usually results in some high-frequency ringing in the final time domain waveform.

(7) The click waveform is next corrected for the characteristics of the headphone to be used during the FF data collection. The headphones (one for the left ear and one for the right), should have been calibrated using NEUCAL before FFSTIM is run. The relevant amplitude (in dB) and phase (in radians) calibration curve is subtracted from the current click waveform spectrum. This is one of the most important steps in the whole process, because it means that what is presented at the cat's eardrum will be independent of the features of any particular headphone used for sound delivery during the FF data collection.

One of the very important steps in the correction process is the use of headphones with fairly smooth amplitude transfer functions. The corrected clicks will not closely approximate the desired originals if there are any sharp notches and peaks in the amplitude spectrum of the headphone calibration. These sharp notches and peaks often mean sharp phase reversals which cannot be properly compensated. The development of a headphone with the proper smooth calibration has been described by Chan et. al.( ref no. 2).

(8) A linear roll-off is applied to the amplitude spectrum below the lower corner frequency. The lower freq. corner is the frequency that was determined in step (5) above. The roll-off has a slope of 12 dB/octave. This is done because the source loudspeaker produces very little energy at frequencies below 1500 Hz, and the difference spectrum obtained after step (7) can show high spurious amplitudes simply due to poor signal to noise levels at those frequencies. This step was suggested by Alan Musicant.

(9) The corrected click waveform is then converted back to the time domain using an inverse FFT routine.

(10) The click waveform is next delayed by 1/4th of the total time window. This is done in the time domain to make sure that any portion of the waveform that may have been shifted into "negative" time by the FFT procedure is moved back to its proper place. Since both the left and right ear click waveforms are shifted by an equal time, there is no net effect on the interaural delay.

(11) The click waveform is then stored in a temporary disc file in GW format.

(12) Steps (1) through (11) are repeated for all the 3600+ click waveforms.

(13) Finally, the waveforms are read, one at a time, from the temporary disc file, scaled by the same multiplier so that the units are suitable for the GEWAB used with the stimulus system (DSS), corrected for a minor DC offset in the DSS output, and stored in a waveform storage file for use during data collection. The final waveforms are stored in 16-bit GW format in file FF.DAT to save space, and since 16-bits is also the resolution of the DAC used with the DSS, so no accuracy is lost. Since all waveforms are multiplied by the same scale factor, there is no affect on interaural intensity difference.

Of the above, steps (1),(2),(4),(7),(9),(10) and (11) are the essential steps of this method. The remaining steps are important either for the specific nature of our set-up or for second-order fine tuning.


  1. Musicant A., Chan J. and Hind J. (1990), "Direction dependent spectral properties of cat external ear : New data and cross species comparisons", J.Acoust.Soc.Am, 87,757-781.

  2. Chan J., Musicant A., and Hind J.,(1993) "An insert earphone system for delivery of spectrally shaped signals for physiological studies.", J.Acoust.Soc.Am., 93, 1496-1501.

Back to Top

If you have any questions about this document,please send them by e-mail to

Return to Documentation Page
Back to The Basement

This page last modified on : May. 2, 2000