Download

How to play raw PCM audio?

Hi,
I’m trying to make a music game, similar to audiosurf, and I’m using mpg123 to decode MP3 files, but i have no idea how to actually play the music from raw PCM data i get from the decoder?
I tried using USoundWave but setting RawPCMData and RawPCMDataSize results in a crash (CrashIfClientPRovidedBogusAudioBufferList).

Can anyone post a short example?

If you look in Engine/Plugins/Runtime/SoundMod you’ll find the plugin which provides MOD support which does basically what you want to do - decode on your own and present the engine with a constantly updating stream of audio data.

Should give you a place to start :slight_smile:

Thank you, i eventually figured out how to play using USoundWaveStreaming and i’ll post a code tomorrow so others can use it :slight_smile:

I’d be interested in any project example you have that can use USoundWaveProcedural (renamed in 4.9 from USoundWaveStreaming) ?

I’m trying to create a procedural audio source too

So you did get it working? Is it possible to share the code?

Guess that would be a no. =D

There’s a heap of good, up-to-date info on this from Epic’s audio programmer, hidden away in a thread on the feedback forum:
https://forums.unrealengine.com/showthread.php?121221-Stop-using-private-variables-in-virtual-functions-please!