Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Stereo -> Binaural using impulse responses (Read 25909 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Stereo -> Binaural using impulse responses

I'm trying to find a good way to convert stereo -> binaural.

So far I've experimented with impulse responses (convolution), based on

- HRTF measurements by MIT
- calculations about echos in rooms taking into account
-- shift due to distance differences
-- attenuation due to distance differences
-- echos with non-flat frequency response depending on material covering walls etc.

Attatched to this thread there's a zip with two flac'ed impulse responses.

Here's how to create a binauralized .wav for testing:
Code: [Select]
1. Load a file to fb2k (necessary DSPs: "Convolver", "Reverse stereo channels".

2. Put these DSPs (in this order) to active DSPs:
2.1. Resampler (SSRC), set to 44100 Hz [b]if the source file is sampled != 44100 Hz[/b]
2.2. Reverse stereo Channels
2.3. Convolver

3. Convolver settings:
3.1. load prototype_X_1_eq01.flac
3.2. Disable "Auto level adjust", leave other parameters on default values

4. Diskwriter settings:
4.1. Choose some output directory you'll find later;)
4.2. Choose a filename like %_filename%_X (X because we create the crossfeed signal now)
4.3. Enable "Use DSP", disable replaygain
4.4. Use 16bit for output. Soxmix won't understand 24 or 32 bit.

5. Write: Convert -> Run conversion

Now create the 2nd file we need:

6. Remove "Reverse stereo Channels" from Active DSPs

7. Convolver settings: 3.1. load prototype_II_1_eq01.flac, leave other settings allone.

8. Diskwriter settings:
8.1. Choose some output directory you'll find later;)
8.2. Choose a filename like %_filename%_II (II because the file we create now is 'parallel' - left speaker -> left ear and vice versa)
8.3. All other settings must be the same (see 4.)

9. Write: Convert -> Run conversion

10. Now use Soxmix (SOX is a commandline sound editor avail. at soureforge, I include Soxmix.exe in the .zip) to mix both files like this:
Soxmix file_X.wav file_II.wav file_binaural.wav


For comparison to the original you might want to use replaygain (trackgain) as the volume is decreased.

Attatched to the 2nd post in this thread I'll upload an example I created exactly as described above.

Enjoy testing. This is a first trial but IMO results are at least comparable with existing sollutions. I hope Garf will find this motivating enough to add crossfeed functionality to fb2k Convolver (or maybe someone else's interested).

Any feedback is welcome, I'd be glad to discuss details with everyone interested, but this post is already long enough
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #1
Here's the sample (musepack q5)
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #2
Quote
Here's the sample (musepack q5)

Not bad!  That's a really pleasant effect...

Stereo -> Binaural using impulse responses

Reply #3
Thanks fewtch.

Now there's something even better:

HRTF (Head Related Transfer Function) plugin for foobar2000 by Mike Grundmann. Here is the related thread at Head-Fi.

What it does is this:

It takes a whole set of impulse responses from IRCAM LISTEN HRTF DATABASE. The positions of the speakers can be chosen freely, the plugin takes the corresponding impulse responses from the database and computes the binaural simulation of the speaker positions. For recording HRTF impulse resonses IRCAM doesn't use dummy heads like KEMAR but test persons with in ear microphones. So far there exist more than 50 different sets of HRTFs, there should be something suitable for everyone.

It's a bit tricky to set up, so here are some hints additionally to the instructions given on the download page:

1. Use the DEMO SOUNDS (noise moving arround your head) to find out which set of HRTFs will give good results for you. I'll upload a zip file with mpc -q 2.6 versions - good enough for choosing the best 5-10 "candidates"; for making a choice out of them using the uncompressed samples are recommendable.

2. If you have chosen the demo that gives the most reallistic impression (e.g. IRC_1043_P345.wav) download the corresponding set of HRTF samples from here.

3. Put the plugin in fb2k components folder; put the samples you want to use in  \components\HRTF\ together with the "files" file (text file without extension). The "files" file can be either created as suggested on the plugin's homepage or use the file (files.zip) I uploaded at the head-fi thread and edit the file names according to the HRTF set you use (using find+replace function of windows notepad).

4. Now it should work. Enjoy. For files with sampling rate != 44.1kHz resampling to 44.1kHz before the plugin is necessary ATM.

BTW: It's possible to "hack" it to make it use any impulse response you want, e.g. the one I provided in the 1st post of this thread.

edit:
P.S.:
The zip is > 7 MB and contains 51 similar short samples of annoying noise moving arround ones head. Please only download if you plan to use it for finding the right HRTF set for the plugin. If you're just curious, get *one* sample here.
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #4
Quite difficult to get it to work! I tried both fb 0.7.5/4 normal and full, but it crashed when entering the DSP Manager. For some strange reason the spesial installer worked fine.

Tip on making the files file: use "dir /b > files" instead, that way you shouldn't need to edit the file.

Anyway, this is a very good stereo->binarual plugin!

The moving noise demo sound moves counter-clockwise seen from above. I had trouble visualizing the source of the noise until I realized which way the sound moved.

Stereo -> Binaural using impulse responses

Reply #5
???

nice effect but I wait till a proper plugin comes along which wont crash my machine

Stereo -> Binaural using impulse responses

Reply #6
There's a new version. Now HRTF data and "files" file need to be located in C:\HRTF (will probably change soon). With this version I don't get crashs anymore. Only problem left I noticed (besides somewhat complicated installation): audio CD playback is choppy here.

As there have been reports about problems get it working, here's how it works for me:
Win2kSP4
foobar2000 0.7.5 full install with Case's special installer
foo_dsp_hrtf.dll in foobar2000\componets\ folder
HRTF files, e.g. "IRC_1047_C_R0195_T000_P000.wav" in c:\HRTF\ folder
"files" file in c:\HRTF\ folder. The HRTF file names stored in "files" must be seperated by the symbol with hex notation 0Ah (To create it in notepad press Alt-10). I attatch the "files" file working here (zipped) to this post.
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #7
For some reason I can't get any of the attachments right. No matter what file the browser downloads quite a small file, then says "unexpected end of archive" when trying to open it. Am I the only one experiencing this? Happens with both Mozilla Firebird and IE, and with all attachments at HA.

Stereo -> Binaural using impulse responses

Reply #8
Hey all,  I'm the fellow who put together this plugin.  If you're interested, it no longer crashes on FLAC/CD audio.  Setup is still tough, but this is for three reasons.

1) I don't own the HRTF data and thus cannot distribute it (without permission).

2) Writing an installer could prove to be a time consuming task for me.  (I'm lazy.)

3) the HRTF directory is hardcoded for now because this was intended to be a quick and dirty proof of concept.

So if you want to play around with some really interesting HRIR (Head Related Impulse Response) files, get this plugin and give it a spin.

Eventually I'll add other stuff and probably announce it in the 3rd party fb2k forum.

Enjoy.

Stereo -> Binaural using impulse responses

Reply #9
Hi cayuga - welcome at HA!

ad 1) The HRIR files are quite big, so distributing them together with the plugin would be quite space/bandwith expensive for you anyway.

The plugin works fine without any noticable problems here now - thanks alot.

Seems like now it's time to create some customized imulse responses ...
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #10
Quote
Seems like now it's time to create some customized imulse responses ...

hehe.
thats the BIG problem

all my plugin does, is to generate a very simple impulse-response (the coefficients for a double FIR filter line), and then feed the audio signal through it...

i could adopt it so that it would be possible to load a predefined waveform (impulse-response), but i did not implement it yet, as i have not found *any* IR that works for me.
(at least not any one that works better that the very simple thing my plugin creates.)

btw - @cayuga - if you are interested in my "headplug" - look here and give it a try:
http://members.liwest.at/hustbaer/

bye,
--hustbaer

Stereo -> Binaural using impulse responses

Reply #11
I've been trying to create customized IRs for cayuga's plugin to improve the effect (details here) and noticed this: If the impulse .wav files are longer than 512 samples (e.g. using the "RAW" HRIR set instead of the "COMPENSATED", the plugin refuses to work/crashs. This can be avoided by cutting customized IRs to 512 samples but it would be great if this would work with IRs of different length (doesn't have to be 2 seconds of course  ).
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #12
I'm actually away from my home computer for a couple of weeks...  I must have for some reason hardcoded 512 as a sample length limit (I rarely do that kind of thing) so it should be a quick fix once I return home.

Stereo -> Binaural using impulse responses

Reply #13
/me hugs DPLII reciever.

Stereo -> Binaural using impulse responses

Reply #14
I can't get the plugin working with 0.7.7b or 0.8 beta 8, which are the only ones I can download.  It crashes upon entering the DSP manager.  Is there a place I can download the version of 0.7.5 that works with it?  Or, optimally, is there an update to the plugin somewhere that'd let me use it?  Thanks for the help...this plugin sounds like it has a lot of promise if I could just try it out.

Stereo -> Binaural using impulse responses

Reply #15
Hi. Here it has worked flawlessly* with all 0.8 betas I used so far.

*(when entering DSP manager there's a short delay, ~ 0.5 seconds)

To get it to work you have to put a correct set of HRTF data to c:\HRTF\
The files must be 44.1kHz stereo, 512 samples long and named like this:
"IRC_10??_C_R195_T???_P???.wav"
e.g.
IRC_1047_C_R0195_T000_P000.wav
IRC_1047_C_R0195_T000_P015.wav
IRC_1047_C_R0195_T000_P030.wav
...
!!! Use the "compensated" files (512 samples long), not the "raw" ones (2048 samples) !!!
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #16
very nice!  i have yet to find the perfect head for myself, but i'm having fun moving the speakers around nonetheless...

could this be used as a special downmix for headphone listening of 5.1?  as i don't have a 5.1 receiver, but like to play with 5.1 sound, this would be extremely cool.  i could do it in separate passes and mix the files together manually, but with enough spare CPU i think it could be done in realtime.

(hmm... i think i'll try it out - turn a 5.1 file into stereo pairs, and feed these thru foobar with corresponding speaker positions).

Stereo -> Binaural using impulse responses

Reply #17
5.1 -> binaural would be great indeed. In December (IIRC) I've talked with the cayuga about this. He had the idea to add exactly this feature, and I sent him some 5.1 files for testing. I guess we have to wait - or someone has to code a similar plugin...
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #18
Quote
...To get it to work you have to put a correct set of HRTF data to c:\HRTF\...

Ah...so before there are samples in c:\HRTF\ it simply crashes?  All right...I guess I was getting ahead of myself, trying to make sure it'd work before finding the samples.  Thanks!

EDIT: Tried it with HRTF samples in the directory, and file named "FILES" in directory also.  Foobar still crashes when I try to enter DSP Manager.

EDIT2: I did get it working...I need to work on my reading comprehension.

Stereo -> Binaural using impulse responses

Reply #19
From an 5.1 AC3 sample I've created a HRTF downmix as MugFunky suggested, like this:
- Use fb2k for ac3 -> 6ch .wav decoding
- Load .wav to CEP and create 3 stereo files: front L/R, rear L/R and centre+subwoofer channel (What was the correct name again?  )
- Use fb2k + resampler + foo_hrtf + diskwriter to apply HRTF
- Mix 3 resulting files together using CEP

I've tried with the 3 impulse responses that are best for my ears and with 2 different virtual speaker setups:

1. quadrophonic + centre channel, speakers at -135, -45, 0, 45 and 135°

2. stereo + 3 additional channels equally distributed, speakers at -120, -30, 0, 30, 120°.

In the attatched .zip file I've put the for me best sounding result, a plain fb2k 5.1 -> stereo downmix and a transcode to 6ch AAC (I was too lazy to find out how to cut AC3 directly) for comparison.
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #20
oh, man... you are WAY too cool for school.

very nice stuff.  i'm not sure my head is the right shape for that particular sample (the soundfield was oddly helical rather than circular), but the mere fact that i could localise where each sound came from was good.

i've yet to find the right head-shape for myself, but i haven't been looking too hard.

Stereo -> Binaural using impulse responses

Reply #21
wow, interesting effect.  I've been playing with the plugin, trying out different HRIR sets.  It does an interesting job of widening the stereo field (such as in the 6ch dolby demo tigre did a mixdown of... when the thunder struck I thought one of the computers in my workplace exploded).  It does a real number on the balance of the music... I had to use foobar's EQ to compensate for all the muddiness.  It's a nice start tho.  It does a good job of increasing the size of orchestral music, which the grados are especially bad at portraying.  Ang generic music becomes less punchier, but sounds bigger.  It'd be cool if people could make headphone-specific HRIR sets
seanny.net

Stereo -> Binaural using impulse responses

Reply #22
Quote
1. Use the DEMO SOUNDS (noise moving arround your head) to find out which set of HRTFs will give good results for you. I'll upload a zip file with mpc -q 2.6 versions - good enough for choosing the best 5-10 "candidates"; for making a choice out of them using the uncompressed samples are recommendable.
.....


@ tigre

the download link to the mpc file seems to be broken.
It would be very kind of you if you could check the link to: demo_mpc_2.6.zip


Thanks

Stereo -> Binaural using impulse responses

Reply #23
Quote
the download link to the mpc file seems to be broken.
It would be very kind of you if you could check the link to: demo_mpc_2.6.zip

I've uploaded it again - should work now. (You're lucky that I haven't had a space problem on that particular partition of my HDD since uploading last time.  ).
Let's suppose that rain washes out a picnic. Who is feeling negative? The rain? Or YOU? What's causing the negative feeling? The rain or your reaction? - Anthony De Mello

Stereo -> Binaural using impulse responses

Reply #24
Thanks, you saved me from downloading hundreds of mb