jaakkopasanen/Impulcifer

BR impulse response has lower delay to left ear than to right.

rpx91 opened this issue · 37 comments

rpx91 commented

I did a re-recording sitting closer to my speakers. For the rear channels I elevated them on the Gorilla stands I have. But I'm getting an error below. I haven't changed anything in the measurement process at all.

(venv) C:\Users\dushy\Impulcifer>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,FC,X  --compensate_headphones
Traceback (most recent call last):
  File "impulcifer.py", line 167, in <module>
    main(**create_cli())
  File "impulcifer.py", line 43, in main
    hrir.crop_heads()
  File "C:\Users\dushy\Impulcifer\hrir.py", line 151, in crop_heads
    raise ValueError(speaker + ' impulse response has lower delay to left ear than to right.')
ValueError: BR impulse response has lower delay to left ear than to right.

If you need my recording.wav let me know and I can upload it

rpx91 commented

I think I understand now why this has happened. From your post on Headfi:

PCs don't have latency consistency in recording meaning the channel delay will be whatever which is not usable for binaural speaker virtualization. I however came up with a method to correct channel delays in post-processing. This correction syncs the channels by the ear which first receives the signal: left ear for left side speakers and right ear for right side speakers. Delay between left speaker and left ear should be the same as between right speaker and right ear. I then looked up head breadth for adults in wikipedia and made some calculations about how much faster signal from each speaker should arrive at ear compared to center of head. Center of the head is a reference point where all speakers should have equal delay. Variance in head breadths is so small that it has next to no effect on actual channel delays. I'm using the following delays with sampling rate of 48 kHz: 5 samples for front and back, 10 samples for center and 0 samples for side channels. This seems to be working wonders. I still need to do some testing to confirm that the break points will have good imaging (between front left and side left, front right and side right, back left and back right).

Me raising the rear channels messed with those calculations.

@rpx91 please can i get your hrir files i will test it i don't have microphone gear. how many channels placed in audaicity in your data files.

Actually raising rear speakers higher should not create this problem. If the rear speakers are 30 degrees on each side from the rear center then the signal from back right (BR) speaker surely should arrive first to the right ear microphone. I don't see any way how having the speakers higher up would make the space-time warp in a way that left ear receives the signal first.

I would assume there has been some other mistake during the measurement process or then there is a bug in the code. Can you try recording again with the rear channels in a higher position and see if the problem persists. If it does then I would like to take a look at your recording files.

@venkatesh63 If you simply want to test running Impulcifer and try how the results sound like you can use the demo files in data/demo. See the documentation: https://github.com/jaakkopasanen/Impulcifer#demo.

Or were you trying to test something else?

rpx91 commented

OK - it probably is user error. I'll give it another go next week.

I was able to output a working HRIR by splicing in another measurement anyway - I was trying close milked measurements - turns out I didn't like how they sounded so I need to do another measurement in my theater anyway.

@jaakkopasanen i'm just simply running Impulcifer.

rpx91 commented

There's no real point in sharing the HRIR's because the idea of this project is to record your own.

But if you want to try with mine I've uploaded it here. There's no headphone compensation so that it has a shot at sounding halfway decent. I guess it's like a Out of Your Head HRIR.

Thanks mate @rpx91. i will try your copy.

rpx91 commented

I ran it again on a new measurement in a different room and I'm getting the same error. I'm certain I'm doing it right.

Is this something to do with the measurement technique of trying to use the same stereo pair to get all the channels? When I point my left ear directly at the left channel it becomes the Side Left. The right channel then becomes the back right. Because of the angles is that a hard calculation to make? If my room is particularly reflective?

Here's the command I ran so you get the order right of the recording.wav

python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FR,BR,SL,SR,BL,FC,X --compensate_headphones

Here's my recording.wav

When you point your left ear directly at the left speaker the right speaker becomes front left so that's probably not what you want to do. When you point you left ear directly at the right speaker it becomes side left and the left speaker becomes back left.

The demo measurement is done with two speakers. First I looked at the center, then pointed right ear directly at left speaker, then pointed left ear directly at right speaker and lastly looked directly at right speaker. This produces speaker order: --speakers=FL,FR,SR,BR,BL,SL,X,FC.

Perhaps you confused the speaker order?

rpx91 commented

Jesus, I just swapped the rear channels. BR should have been BL and vice versa.

I don't know what it's been so difficult for me to grasp the order. I'll close this down now - thanks :)

It can be a tricky thing. The very first time I got virtualization working was when I mixed up the channels by accident. I had interpreted HeSuVi's channel order wrong and was trying to put the channels in wrong order. One day I made a mistake with Audacity and it started working :D

rpx91 commented

I'm certain I've got the order right now but I'm still getting the error. I believe this is because the position of the back left and right speakers are so close together due to the stereo process and spinning to try and get the other channels.

I'm placing my stereo speakers around 35 degrees apart. In a real 7.1 setup the rear channel spacing would be further apart and the one I got working was when I left my speakers in their normal 45-50 degree spacing.

rpx91 commented

I realise now it's like trying to squeeze a 7.1 system into a small room - those rear channels just don't get the separation so 5.1 is sufficient.

It's only when you do a big measurement it'll work. I've been trying to get a measurement closer in to reduce the room a little so the separation with SB and SL is minimal. Almost like a mono channel.

Have you managed to get stereo measurement working for back channels at all?

I understood that you did two measurements, one with 35 degrees between the physical speakers and another with 45 degrees between the physical speakers and of these two the 45 degree one works but 35 degree one doesn't. Was the measurement process exactly the same for both of these? If this is the case then this is truly interesting.

I'm going to take a look at your measurements. Could you share both the 35 degree and 45 degree measurements (if this is indeed what you did)? What is the speaker order you used in the Impulcifer command?

Ideally the angle between speakers should be 60 degrees. Less than that and there will be a gap between front and side channels that's greater than 60 degrees. Stereo image illusion starts to collapse quite soon after 60 degrees. In any case I would like to have Impulcifer working with narrower angles.

rpx91 commented

When I'm citing angles I mean the angle from 0 degrees is 45. The total angle would be 90 degrees (left channel 45 degrees from my nose, right channel 45 degrees from my nose).

But that's an estimate - the measurements were taken on different days. But I can physically see from where the speaker was - the difference between the BR and BL was tiny.

I've uploaded my recording.wav here

Order of both is: FL,FR,SR,BR,BL,SL,FC,X.

2.2m Eye Level is the one that won't work.

The KEFR300 in Theater Room is the one that works, that was wider apart.

I could do more scientific testing in my office that has decent speaker setup, but the room doesn't sound very good. So I'm having to run the recordings in my main theater and I can only do that when we're not busy.

One suggestion: if Impulcifer can't calculate the back channels, rather than erroring out can it just compute the channels that are good? I was always re-running the command with the X ignore switch for the back channels. My suggestion makes it a little easier.

My goal in having all these different measurements is seating distance. i found in testing that when you use a HRIR that's measured at a distance and you're watching a movie on a tablet - it feels wrong. In those cases Dolby Headphone actually sounds better than my Impulcifer HRIR. But in the situation where you're in the same room - it sounds amazing - that's because the brain is expecting it. My idea with close up measurements was to try and eliminate that issue.

Of course if the virtual room corrections means I can shorten RT and reflections it's going to be much easier.

I'm doing a refurb of my theater and it'll soon have space for 7 floor channels so the next time I do a 7.1 setup I'm just going to rely on the mono track and make my own 7 channel one. It's SO much easier than spinning around with a load of cables dangling off you on a laptop! Currently I have a 5.2.4 setup which is why I rely on the spinning method.

rpx91 commented

Just ignore everything I've written in this thread - I had the idea to listen back to my sweeps and make sure I'd had the order right. It just occured to me now that I could actually play the sweep back and localise it.

Turns out I didn't label the Audacity tracks correctly. Jesus F Christ!!!! It's obviously working fine

I'll close this issue now if you want :)

I see now how the back channels might have delay issues when the speakers are 90 degrees apart. When one speaker is directly at your side then the other is going to be directly behind you and then it's not so certain that the delays would behave nicely.

I could replace the error with a warning so that Impulcifer won't stop processing when it encounters delay issues. Then it would be up to the user to check how it sounds and what might be the problem.

rpx91 commented

Yep that's exactly it. Turns out I can hear the issue too. The channels are directly behind me in some recordings so I still get the error. Other recordings I was just mixing up the channels so they computed fine. That's what made the issue hard to resolve

Your proposed solution sounds ideal. I don't mind if the back channels don't have much desperation. Have a few recordings I'd use this on

It all makes a lot more sense now. Was the reason for 90 degree speaker angle that you moved closer to the speakers for near field HRIR without moving the speakers themselves?

rpx91 commented

I replaced the errors with warnings and now the processing completes. I tested both KEFR300 and 2.2m Eye Level. Both sound fine and I hear no problems with KEFR300. 2.2m Eye Level back right (BR) channel sounds like it's on the left side just like the detected delay indicates. Back left (BL) channel sounds like it's directly behind me.

rpx91 commented

Thanks man, I'll run the new ones tomorrow.

When I'm citing angles I mean the angle from 0 degrees is 45. The total angle would be 90 degrees (left channel 45 degrees from my nose, right channel 45 degrees from my nose).

But that's an estimate - the measurements were taken on different days. But I can physically see from where the speaker was - the difference between the BR and BL was tiny.

I've uploaded my recording.wav here

Order of both is: FL,FR,SR,BR,BL,SL,FC,X.

2.2m Eye Level is the one that won't work.

The KEFR300 in Theater Room is the one that works, that was wider apart.

I could do more scientific testing in my office that has decent speaker setup, but the room doesn't sound very good. So I'm having to run the recordings in my main theater and I can only do that when we're not busy.

One suggestion: if Impulcifer can't calculate the back channels, rather than erroring out can it just compute the channels that are good? I was always re-running the command with the X ignore switch for the back channels. My suggestion makes it a little easier.

My goal in having all these different measurements is seating distance. i found in testing that when you use a HRIR that's measured at a distance and you're watching a movie on a tablet - it feels wrong. In those cases Dolby Headphone actually sounds better than my Impulcifer HRIR. But in the situation where you're in the same room - it sounds amazing - that's because the brain is expecting it. My idea with close up measurements was to try and eliminate that issue.

Of course if the virtual room corrections means I can shorten RT and reflections it's going to be much easier.

I'm doing a refurb of my theater and it'll soon have space for 7 floor channels so the next time I do a 7.1 setup I'm just going to rely on the mono track and make my own 7 channel one. It's SO much easier than spinning around with a load of cables dangling off you on a laptop! Currently I have a 5.2.4 setup which is why I rely on the spinning method.

How to run this in impulcifer
please can you explain
@rpx91 @jaakkopasanen

rpx91 commented

Have you tried reading the documentation? I followed the instructions and it was pretty easy to get up and running.

yep i change the names now it was executing and
i copied directly in my_hrir folder is it ok.
it was getting error

C:\Users\dvenk\Documents\GitHub\Impulcifer>python impulcifer.py --dir_path=data\my_hrir --speakers=FL,FR,SR,BR,BL,SL,X,FC --test_signal=data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --compensate_headphones
C:\Users\dvenk\Documents\GitHub\Impulcifer\hrir.py:154: UserWarning: Warning: BR measurement has lower delay to left ear than to right ear. BR should be at the right side of the head so the sound should arrive first in the right ear. This is usually a problem with the measurement process or the speaker order given is not correct. Detected delay difference is 0.0625 milliseconds.
warnings.warn(f'Warning: {speaker} measurement has lower delay to left ear than to right ear. '
Traceback (most recent call last):
File "impulcifer.py", line 167, in
main(**create_cli())
File "impulcifer.py", line 52, in main
hp_irs = [hp_irs.irs['FL']['left'], hp_irs.irs['FR']['right']]
KeyError: 'FL'

i am geting this error @rpx91

please help me dude @rpx91 @jaakkopasanen

can i get new one recordings from you. please can you share.

Thanks man, I'll run the new ones tomorrow.

@venkatesh63 do you have headphones.wav file in my_hrir folder and is it a headphone sine sweep recording? You have --compensate_headphones and the error means Impulcifer couldn't find the tracks in the file. First you can try without --compensate_headphones

ok i will try without --compensate_headphones.
any new copies right now i'm using demo folder.is it enough for me i already said i don't have measurement gear for testing.

@rpx91 did you get it working? Are you still having errors?

rpx91 commented

Yep! Your updated fix worked fine.

Thanks again. Been using it for a month now and it works a treat

@jaakkopasanen i am using github desktop you changed installation instructions can i re install the impulcifer or should i pulled the repository to update your new Improved installation instructions.

@jaakkopasanen please correct your line venv\Scripts\activate to source venv/Scripts/activate. when i tried i got this error
dvenk@DESKTOP-9NBVFDS MINGW64 ~/Desktop/Impulcifer (master)
$ venv\Scripts\activate
bash: venvScriptsactivate: command not found

@venkatesh63 if you have Impulcifer already working, you don't need to install it again regardless the new installation instructions. I'm using backslashes because majority of people are on Windows and those who are on Linux or Mac probably know to use normal slashes even if the instructions say backslashes.

@jaakkopasanen ok i got it your point.
once again are your working on any new implements in recording and headphone sweeping