Playing custom generated audio wave data

Hello!
For one of my projects, I’m procedurally generating audio data that I need to play in real time (ie, I generate “chunks” of audio data, where each chunk is dianamically generated as the program runs based on certain factors like airspeed, throttle etc) and although I looked everywhere, I couldn’t find a way to play these as I generate them (the usual approach of compiling all the sounds into a package won’t work as these sounds are generated in realtime).

I’m using using an out-of-process c++ application, but can switch to in-process WASM if required.

You’ll have plenty of options in this case, just use an audio engine like OpenAL:

https://www.openal.org/

Or just use the DirectX SDK and use DirectSound, xAudio/xAudio2

can switch to in-process WASM if required.

That would be worse, considering your specifications: it can’t be done right now without an upgrade of the MSFS SDK. The feature to play sounds dynamically has been discussed here:

Oh, this is perfect! I saw the thread you mentioned and I feared I’d have to write custom code for audio listeners etc but OpenAL seems to be exactly what I need! Thank you so much!

Ah but now I run into a different issue, in order to accurately render the audio in OpenAL I need to get the position (atleast 6Dof) of the players current camera (relative to something) and as far as I can see there is currently no way to do this with the SDK.

That’s another reason why we are waiting for a Camera API: not only to create cameras on the fly and control them, but also to get the current camera position, to represent the listener’s “ears”.

2 Likes