kcat / openal-soft

OpenAL Soft is a software implementation of the OpenAL 3D audio API.
Other
2.16k stars 522 forks source link

Specify which sounds are treated with HRTF in games #710

Open softsoundd opened 2 years ago

softsoundd commented 2 years ago

Would like to use HRTF in my games, but currently I can only apply this globally which affects other sources that shouldn't have the filter applied, such as music - making it sound muddy/out of phase. Is there a way for OALSoft to bypass specific sounds while enabling HRTF for others? Or would this require modification on the game side?

kcat commented 2 years ago

You can set the AL_DIRECT_CHANNELS_SOFT source property (part of the AL_SOFT_direct_channels_remix extension) to disable panning virtualization on a given source. This would require changing the game/engine since it's opt-in functionality. Behavior changes for the source when used, as certain features it may expect (stereo angles, spatialization) will no longer work if it's forced on.

It's worth noting, though, that unless the music is a binaural recording/mix, listening to it on headphones with direct channels may not be pleasant. The normal behavior simulates what it would sound like if it was on speakers. Whether or not it sounds "muddy" will depend on the person; HRTFs work best when they're individualized, or closely match your particular head and ear shape, so a generic one will work better for some people than others. You can try using different HRTFs to see if another may sound better.