Blueprint audio library

Hi everyone!

We are a small team of people that are relatively new to creating games, and we happen to be starting a new project these days. With UE4 coming out we’re really psyched about moving away from Unity, as the toolset in UE4 looks absolutely kickass, and the visual scripting style would suit our team a lot better allowing everyone within the team to take on more responsibilities than before – but we have a problem

We rely heavily on music and being able to analyze audio for our projects’ concept to work(think Audiosurf, Beat Hazard and the like.) We already have a rudimentary system up and running in Unity that was incredibly simple to accomplish with Audio.GetSpectrumData(), but we can’t find anything similar in UE4.

Does anybody have an idea how we could go about this in UE4 - preferrably through Blueprint if possible as we’re all new to C++. We’re only doing basic beat detection, working with means and modes of frequency ranges and such. Any help would be appreciated as we’re really psyched about moving over to UE4(or UE$ if I don’t let go of the shift button :o)

Also, is there a way to natively load audio files from disk in mp3/ogg/etc… and/or from the web?

Thank you for your help.

Answerhub entry here

Hi there-
Sounds like you’re working on something exciting in the audio game genre- can’t wait to hear about it :). UE4 currently does not have a function like Audio.GetSpectrumData, but we are working on a similar feature for the engine. Alas, I don’t know if and when it will be ready for release, so it will likely not be a help you on your current project.

The engine also currently only supports PCM .wav file import, 16 bit up to 48khz. When these .wav files are imported into the engine, they are converted to different platform-based formats. For the PC, the .wav files are converted to Ogg Vorbis format; you can then set an Ogg encoding quality on each asset.

Hope these answers at least clarify the current audio pipeline; we are constantly working to improve it. I’ll mention the Audio.GetSpectrumData request, and see if I can’t get that prioritized :).

Best-
Zak

Any updates on this? I too come from Unity and heavily use the built in FFT Spectrum audio data.

Check out the SoundVisualizations plugin. It exposes methods like CalculateFrequencySpectrum and GetAmplitude.

Cheers,
Michael Noland

Wow. Thank you Mr Noland! That’s what I was looking for. Keep on rock’n :slight_smile:

Stupid Question. I have the audioVisualizations plugin installed now what? Where is the documentation? The plug-in sends me to Epic Games. ?

Update:
I did find Amplitude function while messing around in Blueprints and one other function. Does any want to add real world examples of audio visualizations using this function?

I was playing around with this yesterday and had some great results :slight_smile: I’ll see if I can get a quick tutorial together soon, but I roughly did the following:

  • Setup a blueprint that plays a sound on startup.
  • Setup a Tick event that calls Sound Visualization CalculateFrequencySpectrum
  • Use the resulting frequency array to scale bars in the scene.

It was surprisingly easy to setup, took me an hour or two to get everything setup including a dynamic construction script for bars etc.

It’s cool, but I’m still trying to figure out things like:

  1. how to use audio from the microphone as an audio source.
  2. how to change the sample size to get better separation between the frequency bands.
  3. how to apply a FFT Window to the sample data to reduce leakage (Hamming, Hanning, Blackman, etc)
  4. some way to limit the frequency range (anything from 16k-40k is a bit useless in most cases)

But its a great start. Can’t stop messing it.

Glad you found it useful! It is just an experimental feature. I found that using Tick was not accurate enough and I had to use ‘GetAccurateRealTime’ when I started playback, and then again each frame and subtract the two, to get an accurate sound position.

What are you using to keep track of the position/start time for CalculateFrequencySpectrum? do you have to use a timeline for this?

Using the tick event I setup a simple graph that added the delta time to a variable, and once it was above 0 I started the sound and then the getspectrum calls.
I did notice some issues with timing though, and based on the helpful reply from JamesG above I’ll try his approach :slight_smile:

You can also control the sample length when calculating, and for some visuals (bars going up and down) I found it helpful to smooth out the peaks by going for a slightly longer time than the tick.

I’m not going to complain if someone wants to post a video of some cool stuff they have done :slight_smile:

I’ll post something once I’m further along :slight_smile:

I have been trying to set this up. The calculate frequency spectrum node… i most be doing something wrong because when i link a tick event to this node, the simulation goes super slow.
@SiggiG Could you please show a simple graph of how this is set up? maybe at screengrab? I am still trying to figure out the blueprints work :slight_smile:

thanks for the nodes :slight_smile: i was playing around with them and got some nice results but ist not insync. could you please explain or show how you got it right with the ‘GetAccurateRealTime’ because i dont get it. do i have to use the tick at all for the spectrumnode or do i have to make a custom event with the math you wrote above? please help

ok got it, perfect without the tick and ‘GetAccurateRealTime’ :slight_smile:

Any chance to know how? :slight_smile:

Yes could you please show us the blueprint logic?
:slight_smile:

Any news here? Would love to see something!

Hi, Can anyone send me the blueprint of a practical example?