-
Notifications
You must be signed in to change notification settings - Fork 14
Measurements
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.
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 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.
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 |
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 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.
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.
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.
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.
Audacity is a free audio workstation and while being simpler than it's commercial counterparts it has all the features needed for recording sine sweep measurements. Download and install Audacity from Audacity's website.
Audacity can do overdub recordings meaning that Audacity will play back the existing tracks at the same time as it is recording new tracks. Overdub recordings need to be enabled in the options for this. Go to Edit -> Preferences -> Recording and select "Play other tracks while recording (overdub)" and "Record on a new track". Overdub recordings aren't strictly necessary but make the process easier when playing the sine sweeps on one or two speakers.
When saving the recording as WAV file Audacity needs to create multi-track file. This too needs to be enabled from the options. Go to Edit -> Preferences -> Import / Export and select "Use custom mix".
Once you have the settings configured you can start recording. Open up exponential sine sweep sequence file from data\sweep-seg-FL,FR-stereo-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav
in audacity. We'll record on two speakers in this guide but it is possible to record even full 7 channel surround sound setup with just one speaker.
Input and output devices should be correctly selected if you set them as default devices in Windows Sound Settings but check once more in the tool bar that input and output device is correct (Zoom H1n in this case) and "2 (Stereo) Recording" is selected as the recording format for the input device.
Now you're ready to start recording. Headphones should be measured 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.
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. If you have any existing audio processing going on, you should disable them now.
Click the big red record button to start recording. Single ascending frequency should start playing after two seconds of silence. End the recording with stop button after the entire sweep sequence has played. Recording has to be longer than the sweep sequence.
The waveform should reach close to maximum but should never touch it. If there are samples that are at the maximum then most likely they went over it and clipped. Clipping causes massive distortion and will ruin the measurement. If the highest point of the waveform is close to maximum (or lowest is close to minimum) you can check if they are in fact within the limits by selecting the recorded track, opening Amplify tool from Effect -> Amplify, setting "New Peak Amplitude" to 0.0 dB and looking at the "Amplification (dB)" value. If the value is above zero dB you are safe.
Often the level is not going to be within optimal limits the first try and if this is the case you need to adjust mic input gain. Typically the audio interface has a physical knob for the microphone gain. If the recorded track is very low on volume, increase the mic gain and reduce the gain if the waveform clipped. Run the recording again after adjusting the mic gain and remove the old track from the small x button on the top left corner of the track.
When you have successfully recorded the frequency sweep with headphones you need to save the stereo track to a WAV file. Select the track if not selected already and go to File -> Export -> Export Selected Audio. Create a new folder inside Impulcifer-master\data
called my_hrir
and open the folder. Name the file as headphones.wav
select file type as "WAV (Microsoft) 32-bit float PCM" and click Save. Audacity will ask you about the mix, if you selected custom mix from the settings earlier, and you should select the two channel output where first track is mapped to the first output channel and the second track to second output channel.
Speaker recording for a stereo setup goes exactly like the headphone recording. Unplug your headphones and set the volume on speakers to a comfortable high level. Only the original sweep sequence must be playing and to prevent Audacity from playing the headphone recording as well you need to mute it. Click the "Solo" button on the first track control panel below the delete button. All other tracks turns grey.
Start recording with the same red record button, wait silently and without moving until the sweep sequence has played entirely and stop the recording with the stop button.
Check the speaker recording levels and export to a file called recording.wav
inside the same folder.
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 --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FR --compensate_headphones
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.
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 and since Audacity cannot play more than two channels at a time, VLC is required for the playback. Recording is still done with Audacity.
Multi-channel sine sweep sequence can be generated with impulse_response_estimator.py
python impulse_response_estimator.py --dir_path=data --fs=48000 --speakers=FL,FC,FR,SR,BR,BL,SL --tracks=7.1 --length=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.
Open the generated sine sweep sequence file data\sweep-seg-FL,FC,FR,SR,BR,BL,SL-7.1-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav
in VLC media player and stop the playback if it started automatically. Next open Audacity without any files opened (empty project). To play and record at the same time you have to first start recording in audacity and immediately after start playback in VLC from the beginning of the file. Impulcifer has a small tolerance for delays but it's better to be quite fast. You can have both windows open side by side, keep Audacity as the "active" window and move mouse cursor on top of play button on VLC. Then hit Shift+R to start recording in Audacity and click mouse button immediately after to start playback in VLC. You should have sine sweep sequence playing and Audacity recording a new track. You can of course continue on the same Audacity project if you made headphone compensation again and you have it already open, just remember to mute all tracks avoid playing them.
When the recording has finished, select the track and export it as WAV (File > Export > Export selected tracks).
Now you should have speaker recording and the headphone recording files and you can create 7 channel HRIR with Impulcifer
python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FC,FR,SR,BR,BL,SL --compensate_headphones
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 which are then exported from Audacity as one WAV that has 16 tracks.
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. | |
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). | |
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). | |
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. |
Select all four stereo tracks in Audacity and export the selected tracks as WAV file.
Impulcifer is ran similarly to the previous cases but the speaker order must be adjusted
python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FR,SR,BR,BL,SL,X,FC --compensate_headphones
X
is there in the --speakers
to tell Impulcifer to ignore the sine sweep played on the left speaker during step 4. Step 4 could have been done by looking directly at the left speaker in which case the speaker order would have been --speakers=FL,FR,SR,BR,BL,SL,FC,X
.
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. | |
Step 2 The physical left speaker moved to left side and the physical right speaker moved to the right side. | |
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. | |
Step 4 The physical left speaker moved to the center and the physical right speaker is at it's own position. The sine sweep played at the right speaker will be ignored because we already have the front right speaker recording. |
Once again only the speaker order has changed
python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FR,SL,SR,BL,BR,FC,X --compensate_headphones