steam-audio icon indicating copy to clipboard operation
steam-audio copied to clipboard

Simulation of reflections

Open mpaoliello opened this issue 1 year ago • 4 comments

Hello,

I'm trying to implement a sample to simulate both direct and reflection sounds, as mentioned here: https://github.com/ValveSoftware/steam-audio/issues/301#issuecomment-1942251929

While direct sound seems to work fine, reflections on the other hand sound a bit strange.

I would also like to know if it's possible to distinguish between early and late reflections, as I was asked to do so for my project.

Based on samples that I found and with a bit of GPT magic, I ended up with this sample, but I'm not finding a way to get the reflection sound correctly (both early and late).

At first, I tried a convolution (early) + parametric (late) setup, then later switched to hybrid, but with almost no difference in the strange sound.

I also tested (what I think is) the same setup for settings, parameters, and geometry in Unity, and there it sounds very good.

Here's the source code I ended up with: https://github.com/mpaoliello/steam-audio-reflection-sample/blob/main/SteamAudioReflectionSample.cpp

Can someone help me understand what I'm doing wrong? Many thanks!

mpaoliello avatar Oct 09 '25 07:10 mpaoliello

In case someone stumble upon the same issue, I fixed by using two IPLReflectionEffect and IPLAmbisonicsDecodeEffect, one pair for early and the other for late reflections. Reusing the same instance for both caused the distorsion noise issue.

mpaoliello avatar Oct 28 '25 07:10 mpaoliello

I also encountered the same problem, but I only used one Reflection effect. Have you found a solution yet? I also use the C API

ZheYinX avatar Feb 16 '26 14:02 ZheYinX

Hello, in my case I had to separate early and late reflections as an assignment. I am not sure if the crackling is similar, it also only came from the right ear, mine was more from everywhere. I solved the issue by not using the same instance of IPLReflectionEffect and IPLAmbisonicsDecodeEffect for both early and late reflections.

For example this

// Early
iplReflectionEffectApply(refl, &rp, &inMono, &outEarlyReflectionBuffer, nullptr);
iplAmbisonicsDecodeEffectApply(decode, &dpar, &outEarlyReflectionBuffer, &outEarlyAmbisonicDecodeBuffer);
// Late
iplReflectionEffectApply(refl, &rp, &inMono, &outLateReflectionBuffer, nullptr);
iplAmbisonicsDecodeEffectApply(decode, &dpar, &outLateReflectionBuffer, &outLateAmbisonicDecodeBuffer);

Became this

// Early
iplReflectionEffectApply(refl1, &rp, &inMono, &outEarlyReflectionBuffer, nullptr);
iplAmbisonicsDecodeEffectApply(decode1, &dpar, &outEarlyReflectionBuffer, &outEarlyAmbisonicDecodeBuffer);
// Late
iplReflectionEffectApply(refl2, &rp, &inMono, &outLateReflectionBuffer, nullptr);
iplAmbisonicsDecodeEffectApply(decode2, &dpar, &outLateReflectionBuffer, &outLateAmbisonicDecodeBuffer);

mpaoliello avatar Feb 16 '26 15:02 mpaoliello

Thank you. I see. We're not having the same problem. Your problem is caused by sharing the same example, but mine doesn't seem to be. Mine only has a popping noise in the right ear. So you know how to solve my problem?

ZheYinX avatar Feb 16 '26 16:02 ZheYinX