Spatializing Monophonic Signals with ofxHOA

Hello, I’m doing a fairly large project involving virtual reality and 3D sound. I’m trying to use the binaural decoder in the 3D example within the ofHOA addon and whenever I attempt to use this function I get no sound. Is there something more I need to do more than simply un-commenting that example?

@cabral1349 , I’ve noticed you’re fairly active on this site. Is there something I’m missing with this?

Hi, normaly this example should work out of the box just by changing the commented line.
I’ve tested it here and I’ve ran into the same problem as you. This is probably due to some change in the way the library handles the binaural decoder, since the 2Dexample also no longer works.
I’m no longer working with the HOA team, but I’ll look into it.

Which is your OS and openframeworks version?

It seems that the library now uses the function processBlock(const T** inputs, T** outputs) to perform the binaural decoding. I’ve not figured out how to make it work in oF. I’ll meet Pierre Guillot, one of the maintainers, friday october 9th. If you don’t receive an answer from github until then I’ll ask him directly

@Garrett_Burnett I’ve posted a working example of binaural 2D. It’s slightly different from the other examples, but I think you’ll understand it. I changed a bit the coding style, preffering a less raw pointer approach.
Feel free to ask any questions!

Ah! That was you! Thanks so much, it does work, though the audio is a bit clicky. This will be perfect for me to study.

it’s been a pleasure =)
What is clicky about the sound? Here it’s working fine… maybe it’s just the ofxHoa built-in oscillator. It’s not a very good oscillator, it’s there just for demonstration purposes.
Please try it out with ofxStk or other audio sources and tell me if you got good results.

@cabral1349 would love to see/hear any tests you have with ofxStk and ofxHoa. I was having a bit of trouble getting this working myself.

my examples are kinda heavy, but I’ll make something this week and put on github for you

1 Like

Thank you so very much for doing this. I cannot express how helpful it is.

so, here’s a simple example @Garrett_Burnett and @michaelpromeo

https://github.com/claudiocabral/hoaStk

I recommend to compile it in release since it’s a very heavy process.
I get lots of clicks when compiling in debug mode and 20% more CPU consumption

@cabral1349 Thanks so much! Great example.

1 Like

One last thing I’ve just been told: you can use the setCropSize(int i ) function to change the resolution of the binaural convolution. The maximum size is 512, and by setting it to 256 I have a much lighter process without a loss in quality that I can perceive (my cpu usage dropped to 26%)
I’ve pushed this changes to the repo.

@cabral1349 Thanks so much for your help. I understand so much more now. Any chance you’d be able to show a binaural example of multiple 3D sources? I’m having issues with binaural on the current 3D sources project.

I don’t know if I’ll have the time to do an example anytime soon, but here are a few considerations:

  • It will work like the Binaural 2D example, but you should have a Decoder::Binaural<Hoa3d, float> instead of a Hoa2d one.

  • Our binaural models only work at 44.1khz because we don’t provide de hrir filters for other sample rates.

  • 3D binaural is not very reliable, when the sound goes up people here all sorts of different things.

  • That said, when I made the addon we didn’t have a semisphere of speakers to test the ofxHoaCoordinates in 3D. So even though I think they work properly, they were only tested with the binaural decoder.

Whenever I have the time again I’ll rework the examples to clarify those things and also test the 3D example in a semisphere (now that I’m no longer working there they have one…)

Oh wow! I think I’m getting close. If you have the chance could you take a look at my code?