Download

Creating Audio Files in UE4 ?

Hey mates !

I wondered if it is possible to create audio files ( wav. or whatever) in UE4.

I am about to finish my thesis and it is about creating gun sounds parametrically for games ( FPS/ action or anything else) . I finished my equations and they work on paper when calculated. Now I need to create them.

PureData (pd) proved very limiting because it doesn’t allow me to control waveform as I wish. I am wresting with MATLAB now and I just remembered UE4 and thought why not ?

So mates. Any way ?

P.S. : Why don’t we have a “Audio” thread like C++ and Rendering ones ? I think it is important for some games.

Yes, you could write a custom C++ synthesizer class to handle gun sounds. Nothing out of the box though. PD is actually quite powerful and definitely does allow you to modify a waveform in all imaginable ways.

However, I’d recommend checking out JUCE library or even just writing it all from scratch.

So you mean I should also write how the sound will be generated fundementally not just my algorithms ? Hmm… Sounds like may take a while.

Problem with pd was I was unable to turn my eqautions into waveforms exactly. As far as I could see it always required some kind oscilator, phasor, sin,cos whatever. Is there a way you know how can I do that ?

Thanks for replying mate :smiley:

I assumed that was what you were trying to do. It’s not really clear to me what you want to achieve. If you already have the raw PCM data that makes up the waveform, all you’d need to do is generate the .wav headers and Unreal engine could then play them back. If you already have the .wav files then again, just play them back…However, if you are attempting to generate the waveform data, then there are hundreds of different ways in which this could be achieved. Usually through techniques such as additive/wavetable synthesis or subtractive synthesis.

What kind of data does your equations spit out?

A Friedlander equation graph and it’s values (Here). Basically amplitude values for each discrete time value.

Okay, great. Take a look at the following API: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Sound/USoundWaveStreaming/index.html You’ll need to generate all the samples for the entire waveform and pass these to the buffer ready for playback. Or if you’d prefer to write these to a file to be saved and played back at another time.