Skip to content

Measurements

Jaakko Pasanen edited this page Dec 10, 2019 · 25 revisions

Welcome to the measurement guide. Here you'll find instructions and comments about what gear is needed and how to do the measurement using Audacity. Guide goes through the measurement principles using a stereo recording for simplicity. Surround recordings with one, two or multiple speakers is detailed after the stereo recording. If you have access to a surround setup, it's recommended to limit things which could go wrong and do the stereo recording first and do the surround setup recording only after that.

Measurement Gear

Binaural microphones, audio interface, headphones and speakers are required to measure HRIR. Optionally you can have a calibrated measurement microphone for doing room correction.

Recommendation here is, if you can afford it, to buy Sound Professionals MS-TFB-2 binaural microphones with XLR connectors and Behringer UMC202HD audio interface.

Microphones

Microphones used for HRIR measurements need to be small enough to fit inside your ears and have some kind of plug or hook for keeping the microphone capsule in place during the measurements. The Sound Professionals binaural microphones have been proven to work well for the task. They have a small electret capsule and a plastic hook which helps securing the microphones. Pictured below is the basic model with cable taped to a loop in order to get the cable exit ears from front and help further hold the microphones in place.

Microphones are placed as close to ear canal opening as possible. Having the mics too far away from the ear canal could affect how the outer ear affects the sound and having the mics crammed too tightly into the ear canal could have huge dampening effect on the high frequencies.

Binaural microphones

Some commercially available binaural microphones are:

Model Noise Sensitivity Price
The Sound Professionals SP-TFB-2 36 dB -30 dB $89
The Sound Professionals SP-TFB-2 with XLR 36 dB -30 dB $199.95
The Sound Professionals MS-TFB-2 19 dB -32 dB $149.95
The Sound Professionals MS-TFB-2 with XLR 19 dB -32 dB $259.95
Roland CS-10EM <34 dB -40 dB ~$80
Microphone Madness MM-BS-8 32 dB -35 db $99
Soundman binaural microphone line-up ? ? €65-145
Core Sound binaural microphones 30 dB -66 dB $230
Core Sound high-end binaural microphones with 4060 capsule 28 dB -34 dB $990
Core Sound high-end binaural microphones with 4061 capsule 23 dB -44 dB $990
Primo EM258 capsules (DIY option) 20 dB -32 dB $21

Low noise is very desirable for the binaural microphones because lower noise means better signal to noise ratio for the HRIR. All of these mics are electret microphones and as such require bias voltage (plug-in power) between 2 to 12 volts. These are typically designed to be used with digital recorders. The Sound Professionals mics with XLR connectors can be used with normal USB audio interfaces which offer significantly lower equivalent input noise performance than digital recorders. USB audio interfaces don't normally have plug-in power and therefore cannot be used with electret mics. XLR versions of The Sound Professionals mics have adapters which convert 48 volts of phantom power to 9 or 12 volts of plug-in power for the capsules. Core sound mics come with a battery box so they can be used with audio interfaces without turning on phantom power. Core sound also has a separate product for turning phantom power and XLR connectors to a plug-in power and TRS jack.

Audio Interface

Audio interface

Audio interface is the microphone input for the PC. Excellent noise performance can be had very cheaply with Behringer UMC202HD but other popular options such as Focusrite 2i2 2.Gen should work just as well. Just make sure the audio interface has two microphone inputs!

As mentioned above, most USB audio interfaces don't have plug-in power for electret mics and cannot be used with them without adapters. It is possible to buy or build an adapter which converts phantom power from XLR to plug-in power on 3.5 mm stereo jack, use mics which have this built in or use a battery box which provides the plug-in power.

When using audio interface that can provide phantom power make sure you never, ever have it turned on if you are about to plug in anything else than microphones which require phantom power! 48 volts is enough to fry any electronics device!

Alternative to a normal USB audio interface is a digital recorders which can function as a USB audio interface. Most digital recorders cannot so the options here are limited. One suitable option is Zoom H1n although optimal results cannot be guaranteed since H1n has a whopping 20 dB higher input noise than Behringer UMC202HD.

Finally it is possible to measuring HRIRs with digital stereo recorders which cannot act as USB audio interface but in this case you have to play the sine sweep on PC, use the recorder without being connected to PC and then manually transfer the recorded files from the recorder's SD card to PC.

Speakers and Headphones

speakers

In theory any decent speakers and around ear headphones work but the end result will depend on the performance of the speakers and headphones.

Low harmonic distortion is wanted for the speakers because measurements should be done with relatively high volume for better signal to noise ratio. Exponential sine sweep measurement method used by Impulcifer cancels out most of the harmonic distortion of the speakers but some residual distortion may remain. Frequency response and transient response is not so important because Impulcifer can do room correction better than what is physically possible with real speakers and sine sweeps don't have transients at all so that aspect of the speakers isn't modeled by HRIR. All in all speakers don't have to be expensive high-end devices but any decent affordable HiFi speaker should do the job sufficiently.

Headphones will have major impact on the speaker virtualization quality. Frequency response, which is normally by far the most important aspect of headphones' sound quality, isn't very critical in this application because it will be equalized as a part of the HRIR measurement process. Headphones' other qualities will have direct impact on the end result and therefore fast and well resolving headphones are recommended although any decent pair of around ear headphones can create illusion of listening to speakers in a real room. Some headphones are better suited for for speaker virtualization but it's quite not known at this time which elements affect the localization, externalization and plausibility of binaural reproduction. Electrostatic headphones and Sennheiser HD 800 at least have proven themselves as reliable tools for binaural use.

Sound Device Setup

Input and output devices in Windows (or whatever OS you are on) need to be configured for the measurement process. One measurement is done with speakers and one with headphones so if you have different output devices (soundcard) for them then you need to configure both. For the sake of simplicity we will here go through the setup for using the audio interface for speaker output, headphone output and microphone input.

Go to Windows sound settings: Control panel -> Hardware and Sound -> Sound. Select your output device (audio interface), click Set Default and then click properties. Go to Advanced tab and select a format with highest possible bit number and 48000 Hz. Other sampling frequencies are possible but 48000 Hz is default on HeSuVi and covers all use cases. Click OK to close the output device properties. Output device

Next go to Recording tab on Windows sound settings, select your input device (audio interface), set it as default and select same format from the Properties as you selected for the output device. Output devices

Recording with recorder.py

recorder.py is Impulcifers own playback and recording utility. It's used from command line but has been developed specifically for recording HRIRs. A single command with 7.1 speaker system can do the whole recording process.

By default recorder.py uses system default input and output sound devices but these can also be specified if needed

python recorder.py --input_device="Zoom H1n" --output_device="Speakers (ODAC-revB USB DAC)"

On Windows the audio host API can be selected

python recorder.py --host_api=WASAPI

host API can be included in the device parameters as well in which case it will override the --host_api parameter

python recorder.py --input_device="Zoom H1n DirectSound"

In most cases you should not need to specify devices or host API and things should work just fine by using the system default devices. These options are given in case you run into problems and are getting device not found errors or if the playback or recording is not working.

All available devices can be listed

python -m sounddevice

If recorder fails to work even after playing around with sound devices and host APIs you might need to fall back to the old way of Recording with Audacity.

Stereo HRIR

It's wise to start by recording and processing a simple stereo HRIR which doesn't include any surround channels. This is a simpler introduction into the recording process and once you have the stereo HRIR nailed down you can continue to multi-channel HRIRs.

When you have your sound devices set up like described above, you can start recording. Headphones should be measred first because putting the headphones on and taking them off might move the microphones if they are not secured well and while this isn't necessarily catastrophic we'll want the microphones to be in the same position for both the headphone measurement and the speaker measurement. For this reason the headphone measurement has to be made again every time they are taken off, so you cannot reuse headphone measurement from one measurement session with the future measurements.

Put on your headphones and set the output volume to a comfortable high level. High volume is better because it ensures higher signal to noise ratio but the volume shouldn't be so high that listening to the sine sweep is uncomfortable. Also too high volume might cause significant distortion on certain headphones and speakers. recorder.py doesn't have volume adjustment but instead it always blasts full strength signal. Volume control has to be done with operating system volume control or with the physical volume knob of the amplifier. If you have any existing audio processing going on, you should disable them now.

Run recorder:

python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/headphones.wav"

This will play ascending sine sweep first on the left side and then on the right. Recorder will also record microphones at the same time and save the recorded audio into headphones.wav file in my_hrir folder.

Recorder will report the recording headroom at the end. Headroom should ideally be close to 0.0 dB without actually being that. If the reported headroom is 0.0 dB, this in most cases means the audio clipped and the recording is ruined. In this case adjust microphone level down and re-run the recording. You can also try increase headphone volume or microphone level if the headroom is a lot larger than 6 dB.

Speaker recording for a stereo setup goes exactly like the headphone recording. Unplug and take off your headphones and set the volume on speakers to a comfortable high level.

Run recorder again with different output file:

python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FL,FR.wav"

You should hear frequency sweep first from the left speaker and then from the right speaker. Check the headroom and adjust speaker volume or microphone level if needed.

Congratulations, you have your first HRIR measurement finished. Now you need to process the sine sweep recordings into head related impulse responses with Impulcifer.

python impulcifer.py --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --dir_path=data\my_hrir 

Surround HRIRs

There are multiple ways of creating surround HRIR files, even without having an access to a surround speaker setup. You can experiment with different ways and see which provide the best results for you.

Headphone recording is the same for all of the recording setups and won't be repeated later in the guide. This is the first step of any HRIR recording process.

python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/headphones.wav"

Recording with Surround Speakers

The simplest way is to use 7.1 surround speaker setup to play sine sweeps on all 7 speakers. This is an easy and fast way to do the recording because the whole thing will be done in less than a minute. The obvious caveat here is that you'll need an access to 7.1 speaker system. If the side and rear speakers are not placed well then recording surround HRIR with stereo pair or mono might turn out to be better.

Most of the measurement process is the same as for stereo recording. Surround sine sweep sequence WAV file is required which can be generated if it doesn't exist in data folder

python impulse_response_estimator.py --dir_path=data --fs=48000 --speakers=FL,FC,FR,SR,BR,BL,SL --tracks=7.1 --duration=5

This will generate file where the sine sweeps in the order given by --speakers, so starting from front left and continuing clock-wise. Output test signal and the sequence will be written to data folder.

Speaker recording requires different sweep sequence file and needs to write a file whose name matches recorded speakers

python recorder.py --play="data/sweep-seg-FL,FC,FR,SR,BR,BL,SL-7.1-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FL,FC,FR,SR,BR,BL,SL.wav"

Impulcifer reads the speaker order from the file name so the processing step stays the same

python impulcifer.py --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --dir_path=data\my_hrir 

Recording with Stereo Speakers

7 channel HRIR can be recorded with a stereo speaker pair either by looking at 4 different directions or moving speakers around in the room. In both cases a stereo sequence sine sweep is used and 4 different recordings are made.

Standard 7.1 surround speaker setup defines the speaker angles to be

  • FL 30 degrees left
  • FC 0 degrees, directly in front
  • FR 30 degrees right
  • SR 90 degrees right
  • BR 150 degrees right
  • BL 150 degrees left
  • SL 90 degrees left

All but front center speaker are 60 degrees apart from it's neighbors and this is assumed and required to get the speaker angles right in the 7 channel HRIR. If the angle between the physical left speaker and the physical right speaker is less than 60 degrees, there will be more than 60 degrees between virtual side left and virtual front left, between virtual side right and virtual front right and between virtual back left and virtual back right. Having an angle greater than 60 degrees between speakers will often cause a gap in imaging in the middle of the two speakers. This might not be catastrophic because pinpoint imaging outside of front speakers is not crucial.

Similarly if the angle between the physical speakers is greater than 60 degrees then there might be a gap in the center of the sound image. This is going to be a lot worse than the previous alternative because vocals and other important things are often placed in the middle of the front speakers' image. Fortunately the speaker angle can be adjusted very easily without moving the speakers. Simply move closer towards the front center for larger speaker angle or further away for smaller speaker angle.

Let's take a look at the 4 stages of the recording process. This example is using sine sweep sequence with two tracks, first is the left channel and the second is the right channel. In every step the physical left speaker plays the sine sweep first, followed by a short silence and the right speaker sine sweep. Just like in stereo recording process

Step 1 Looking in the middle of the speakers. This is what is done during stereo recording process. The physical left speaker stays front left speaker and the physical right speaker stays front right speaker. Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FL,FR.wav"
Step 2 Looking 120 degrees left. The physical left speaker is at the direction of side right speaker (90 degrees right) and the physical right speaker is at the direction of back right speaker (150 degrees right). Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/SR,BR.wav"
Step 3 Looking 120 degrees right. The physical left speaker is at the direction of back left speaker (150 degrees left) and the physical right speaker is at the direction of side left speaker (90 degrees left). Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/BL,SL.wav"
Step 4 Looking directly at the physical right speaker which becomes front center speaker. The physical left speaker doesn't match any of the surround setup speaker directions so we will ignore it when processing. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FC.wav"

Once again command for processing stays the same

python impulcifer.py --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --dir_path=data\my_hrir 
Moving Speakers Around

An alternative way to the panorama method above is to move the speakers around in the room. The same principle holds that in each step the physical speakers' directions must match some of the virtual speakers in the HRIR. Here is one option how to do it.

Step 1 Normal front speaker recording. Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FL,FR.wav".
Step 2 The physical left speaker moved to left side and the physical right speaker moved to the right side. Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/SL,SR.wav".
Step 3 The physical left speaker moved to the location of back left speaker and the physical right speaker moved to the location of the back right speaker. Run python recorder.py --play="data/sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/BL,BR.wav".
Step 4 The physical left speaker moved to the center and the physical right speaker is at it's own position. The sine sweep won't be played at the right speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FC.wav".

Processing is the same old

python impulcifer.py --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --dir_path=data\my_hrir 

Recording with Mono Speaker

Recording process with a single speaker is similar to two speakers but this time sine sweep is played only on one speaker, either left or right. This guide assumes the single speaker is connected to left speaker terminals in the amplifier thus we'll play sine sweeps on the left channel.

Speakers can be recorded in any order, here we'll start from front left and continue clockwise.

Step 1 Looking 30 degrees right of the speaker. In other words the speaker is 30 degrees to your left. This is the direction of front left speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FL.wav".
Step 2 Looking directly at the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FC.wav".
Step 3 Looking 30 degrees left of the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/FR.wav".
Step 4 Looking 90 degrees left of the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/SR.wav".
Step 5 Looking 150 degrees left of the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/BR.wav".
Step 6 Looking 150 degrees right of the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/BL.wav".
Step 7 Looking 90 degrees right of the speaker. Run python recorder.py --play="data/sweep-seg-FL-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav" --record="data/my_hrir/SL.wav".

And the processing goes as usual

python impulcifer.py --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --dir_path=data\my_hrir 
Clone this wiki locally
You can’t perform that action at this time.