Closed WHUfreeway closed 11 months ago
i changed soundsource to 48000 sample rate with float32 bit depth, the ambisonic encode function returned correct sound. but decode function still dont work.
Looking at the code above, it looks like the input buffer passed to the Ambisonics decode effect (dinBuffer
) points to the interleaved buffer containing the (interleaved) output of the Ambisonics encode effect. However, all Steam Audio effects require deinterleaved input. Can you try one of the following:
outputaudio
, using iplAudioBufferDeinterleave
, before passing it to iplAmbisonicsDecodeEffectApply
, oriplAmbisonicsEncodeEffectApply
, also call iplAmbisonicsDecodeEffectApply
to obtain a single frame of output from the Ambisonics decode effect, then accumulate it into doutputaudio
, and save both outputaudio
and doutputaudio
at the end of the loop.Let us know if neither of the above helps, or if you have any other questions.
thank you! it truly solved my problem. But there are some new.
I think the Ambisonics decode effect needs to be configured with the correct speaker layout, otherwise it defaults to panning to a single channel. Just add the line:
deffectSettings.speakerLayout.type = IPL_SPEAKERLAYOUTTYPE_STEREO;
before calling iplAmbisonicsDecodeEffectCreate
. Let me know if the issue persists after this change.
thanks for you suggestion, the output audio looks different but iplAmbisonicsDecodeEffectApply still IPL_AUDIOEFFECTSTATE_TAILREMAINING
here is outpupt audio
after db -60
i think it a audio present space information
The volume level of the output is definitely not correct. Can you try changing the following line:
params.direction = IPLVector3{ 5.0f, 5.0f, 5.0f };
to a normalized direction vector:
params.direction = IPLVector3{ 1.0f / sqrtf(3.0f), 1.0f / sqrtf(3.0f), 1.0f / sqrtf(3.0f) };
Let me know if this helps.
As for the IPL_AUDIOEFFECTSTATE_TAILREMAINING
return value, this is normal and not a cause for concern.
Thank you,the program seems to be working fine. I still have one more question that if steam audio can only accept the input audio bit depth float32 or it can support more kind of bit depth like PCM16?
Steam Audio only accepts float32 audio buffers. Conversion from other sample formats (like int16) is left to the caller.
By the way, since normalizing the direction vector passed to iplAmbisonicsEncodeEffectApply
caused the output volume level to change, we will treat that as a bug and fix it in the next release.
Sure, this issue occured when using customed hrtf, after setting float volume=1.0f in IPLHRTFSettings it turns great. I think the default value may be wrong set to 1000.0f or some large number like this.
We have just released v4.3.0 (https://github.com/ValveSoftware/steam-audio/releases/tag/v4.3.0), which fixes the issue with vector length causing a volume difference in the Ambisonics encode effect.
test version: steam audio 4.2.0 windows x64
code:
``` #include