How to play audio frame by frame

Hi,

I have a requirement to play audio frame by frame in UE.

Expected behavior (Steps):

  1. Open Wav file
  2. Read a frame (Say, 1024samples)
  3. Process the frame
  • This is NOT : SoundCue or UE provided audio processing feature
  1. Play processed frame
  2. Repeat steps 2, 3 and 4 until end of wav file
  3. Close Wav file

Please explain the ways to implement above behavior.
C++ example is fine.

Thank you.

I don’t know how to do steps 1 and 2 but steps 3 and 4 you will probably need to a USynthComponent Class. That will expose the OnGenerateAudio method which allows you to process individual samples in the audio render thread by exposing an audio buffer which you fill with whatever you want! The default class has some example code which is very useful. I have seen methods for streaming audio data already held in UE4 in their docs but never used them. I would think using that is much better than opening the wav file and dealing with the headers and how the data is stored + converting to float as that is not as easy as it sounds. Also have a look at some of the UE4 Source like the RingModulation in UE4 source code: Engine/Source/Runtime/SignalProcessing/Public/DSP/RingModulation.h as what you are describing is very similar to a Source Effect.