Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pathing simulation #37

Open
levidavidmurray opened this issue Jan 18, 2024 · 3 comments
Open

Add pathing simulation #37

levidavidmurray opened this issue Jan 18, 2024 · 3 comments
Labels
feature New feature

Comments

@levidavidmurray
Copy link
Contributor

Relevant docs

My understanding is that pathing is an alternative to reflections for sound propagation. As per the docs, this is useful when sound has to propagate large distances, bend around corners, or pass through multiple openings.

See here for my use case:

pathing-case-2.mp4

I've tried playing around with the material transmission settings, as well as the player's occlusion radius, occlusion samples, transmission rays, and reflection distance, but couldn't get anything to sound how I'd expect it to. I figure this is mostly due to the closed off nature of these tunnels as I had no issues with this elsewhere—see here:

output.mp4

I figured I'd open an issue for tracking this. I've done some preliminary work to try to get pathing working, but have yet to see it work without crashing.

@stechyo stechyo added the feature New feature label Jan 19, 2024
@stechyo
Copy link
Owner

stechyo commented Jan 20, 2024

To which audio buffer are you applying the pathing effect? I still have to try this for reflections, but if you’re applying the pathing effect to a buffer that has been processed by the direct effect, try applying it to the raw “in” buffer. When you apply pathing to the direct effect audio buffer, it has already been processed by occlusion so it makes it aggressively muted on corners.

@stechyo
Copy link
Owner

stechyo commented Jan 20, 2024

Do check out my previous comment's suggestion if it's relevant. I'll test some more but I'll prolly open a one-line PR that changes this line:
https://github.com/stechyo/godot-steam-audio/blob/58c70bcc5d3c7c53b0adafc9e63956fd48fb1096/src/stream.cpp#L121C3-L121C68

iplAudioBufferDownmix(gs->ctx, &ls->bufs.direct, &ls->bufs.mono);

into

iplAudioBufferDownmix(gs->ctx, &ls->bufs.in, &ls->bufs.mono);
direct-refl.mp4
in-refl.mp4

Second video is the changed code as the name suggests. I imagine this is what you're going for, and it feels a lot more realistic to me (sound bounces around the rock corners). Try the same for padding if you haven't done so.

@levidavidmurray
Copy link
Contributor Author

Do check out my previous comment's suggestion if it's relevant. I'll test some more but I'll prolly open a one-line PR that changes this line: https://github.com/stechyo/godot-steam-audio/blob/58c70bcc5d3c7c53b0adafc9e63956fd48fb1096/src/stream.cpp#L121C3-L121C68

iplAudioBufferDownmix(gs->ctx, &ls->bufs.direct, &ls->bufs.mono);

into

iplAudioBufferDownmix(gs->ctx, &ls->bufs.in, &ls->bufs.mono);

I can't thank you enough for this. While trying to get pathing simulations working, I fell down a rabbit hole trying to restructure things to be a bit more like the Unreal SteamAudio integration. Definitely bit off more than I could chew here and lost all motivation to work on it.

Applying reflections to the input buffer rather than the direct buffer, as you said, solves my problems and is now working exactly as I'd expect! ❤️

WORKING_2.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants