<< Chapter < Page Chapter >> Page >
Generating the illusion of directional sound using calculated directional transfer functions.

Directional test signal creation

In order to test the accuracy of our calculated HRTFs, we used 5.1 surround sound test files used to calibrate home theater systems. We first had to downsample these files from their original sampling rate of 48000 Hz to our sampling rate of 41000 Hz. Since the files were all meant to be played at the same time, each file only played sound part of the time. Therefore, we had to cut out the unused parts of each file and create new sound files which included only the testing segment of each directional file. After this process was complete, we were left with five signals, each of which specified which direction the sound was supposed to come from.

Directional sound playback

We then simulated these signals coming from particular directions using the equation from the HRTF calculation:

H Channel ( ω ) IN ( ω ) H Directional ( ω ) = OUT ( ω ) size 12{H_ ital "Channel" \( ω \) cdot ital "IN" \( ω \) cdot H_ ital "Directional" \( ω \) = ital "OUT" \( ω \) } {}

In this case H Channel size 12{H_ ital "Channel"} {} is the earbud to ear channel transfer function. Unfortunately, we weren’t able to characterize this channel with our available resources, so in this instance we assumed that H Channel = 1 size 12{H_ ital "Channel"=1} {} . This left us with the following equation:

IN ( ω ) H Directional ( ω ) = OUT ( ω ) size 12{ ital "IN" \( ω \) cdot H_ ital "Directional" \( ω \) = ital "OUT" \( ω \) } {}

By applying this equation to each calculated H Directional ( ω ) size 12{H_ ital "Directional" \( ω \) } {} for both ears we were able to generate a series of synthesized sound files for each ear which when played in stereo would mimic a cound coming from a particular direction by using the following code:

L_OUT=[SYNTH_FL_L, SYNTH_FC_L, SYNTH_FR_L, SYNTH_RR_L, SYNTH_RL_L];

L_OUT=L_OUT';

R_OUT=[SYNTH_FL_R, SYNTH_FC_R, SYNTH_FR_R, SYNTH_RR_R, SYNTH_RL_R];

R_OUT=R_OUT';

FINAL_OUT=[L_OUT, R_OUT];

sound(FINAL_OUT, Fs);

In this code, the SYNTH terms are the vectors corresponding to the filtered test signals for front-left, front-center, front-right, rear-right, and rear-left directions. With the left and right ear outputs arranged as shown in FINAL_OUT, the sound command plays the first set of terms to the left speaker/headphone and the second set of terms to the right speaker/headphone as we desired.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, The science of surround sound. OpenStax CNX. Dec 18, 2010 Download for free at http://cnx.org/content/col11254/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'The science of surround sound' conversation and receive update notifications?

Ask