Audio Visualization Plugin 101

Hahah, thanks! I suck at explaining things sometimes…

kvick’s explanation of linear interpolation is really good and explains why lerp is the one to use rather than interp as I mentioned. Interp is framerate independent (it uses world delta time) and as you need it to control something visual…you see where I’m going with this…

It’s refreshing to see other people doing audio visual stuff rather than generic zombie survival games, I’m also writing an audio visual program using ue4 so it’s cool to see others using it in similar ways.

I’m keen on seeing what you end up with so make sure you upload some vids here :slight_smile:

Just to clarify this, the delay node simply halts the signal flow for the given duration, an input of zero would not halt the signal at all therefore the node has no purpose other than to act as a reroute node.

In this case if a duration value was set, everything before the node will be executed on tick and everything beyond the node would execute after the given delay, so with a value of 1 it would execute each second.

Okay, here is where i’m at, i still cannot get the get amplitude to output every kickdrum on this blueprint as is, the tempo is about 130bpm.

However, i did manage to pickup the second kick through multiplying by “2” the “game time in seconds” using the (float*float), but it seemed out of sync

Lol, I actually just recommended lerp because it’s what I’m familiar with, I’m pretty new to UE but I did notice there was a FInterpTo. I used it on a character controller to control the camera, not sure I even understand exactly what it’s doing, seemed to be smoother than standard lerp.

Earlier today , I tried out your blueprint script, with some modifications. I did notice what you’re talking about, it seemed like the audio clip I was playing would loop but the Get Amplitude function wouldn’t be spitting out new values. It’s like it just used the file once and then said I’m done! I did try something before using that function, I tied it to the first person controller shooting the gun and it seemed to trigger every time, but when I made a loop it didn’t.

Not exactly sure why, I started looking into the source code to try and track it down, I’ll let you know if I find anything.

EDIT**

Okay, so I found out why mine wasn’t working lol. I got something going now, it’s a bit loopy looking I’m not too good at organizing my blueprints in an orderly fashion, also just had to compress everything in order to get a screenshot of everything!

So leme try and explain what I did in this chaos.

I actually in writing this realized 1 error in my logic and 1 thing that just kind of improved the script by writing all this out :P.
Seems like such a big explanation for really just saying, the volume drives the brightness lol.

&stc=1&d=1437551070

We start at begin play.
First cast(convert) the sound in the audio component to a sound wave, just preliminary stuff to be used later.
Then call the SoundReady event,
Play audio
Wait until file is done playing
Call SoundReady event and loop it all over again
right after that, iterate on an integer timesPlayed by adding 1 to it.

In the time between each frame that this event gets called.
For every frame, in each frame
Get the average amplitude for the amount of time between this and the previous frame (Delta Seconds a.k.a. delta time)
Set the intensity of the light to that average number

Now there’s a little bit of math involved, I realized why it wasn’t looping for me, which was honestly total luck that I tried this :stuck_out_tongue:
At the bottom left section, with all the green float bits,
I get the current time since the game started, lets call this Y,
I also get the number of times the sound has been played and multiply it by the duration of the sound clip, lets call this X
I then take Y and subtract it by X

I assumed that the file had stopped outputting data because the game time had exceeded the duration within the sound clip being played, which is what I had originally been plugging into it.
So depending on how many times it’s been run the range of time will always be between zero and the duration of the clip.

Say it takes 2 seconds for the clip to play, game has been running for 3 seconds, so I subtracted 2 and the resulting number is 1.
So now plug that resulting 1 into GetAmplitude.

Because if I only had Game time in seconds, it would be inputting 3, therefore going over the duration of the sound clip!

and over on the right I just multiplied the out amplitude data by 3 to give it a bigger… amplitude :P.

I think it’s a pretty cool effect, no lerping necessary!

Though if you want to do anything but play a sound over and over and over limited to it’s duration, you’re going to have to get a bit more complicated, it’s a good start though!.

I attempted to add a ‘GetAmpltude’ node yesterday so I could have a crack at this but couldn’t find it…Is it part of the visualization plugin?

Yes it is apart of the audio visualization plugin

Kvck you solved the audio loop issue I was having with this at the start, though for the way I intend to use this would be to have separate parts all in equal length to the song so no looping needed, but this could useful for extra sounds not apart of the original score and in short files.

“Finterp To” actually filtered out the flicker when inserting it after array GET plugged in at current, target set to 10 Detla Time set to .01 and speed to 99.

i just realized i dont have the sound ready event!

I did this in Hitfilm Pro, but if UE4 ever got the Audio interaction options done right, the sky would be the limit!!!

Hi, I’m trying to do a similar thing so I’m posting my issue here.

I’ve created a separate track for kick drums and making a blueprint to react to its amplitude.

The problem is that kick durm track is playing exactly 2x slower than the main track. When I multiply the Get Game Time node with 2, it’s in sync.
BUT it ends exactly in the middle of the track (I’m guessing the real track duration ends, I could export WAV with a longer length, but this just seems weird)
The main track is played by an Ambiend Sound and works well.

Does anyone have any idea, what might cause stretching out the kick drum track? (The sound node is a public variable and it doesn’t change anything when I choose the track right in the node)

Very cool. Is this Audio stuff still not packageable in 4.9 though? love that cat thing

re: x2 Issue - We’re having the exact same problem - multiplying the start time by 2 fixes sync (we use timer handles instead of game time), but that means the duration is cut in half. This seems like it could just be a bug with Get Amplitude where it’s not correctly reading the start time input? I can’t see anywhere we could be going wrong.

hey guys. it’s really nice to see people working on these kinds of projects.
do you know of a way to use live audio instead of a wave or media player sounds? I’m working on a VJ app.

hey

this is what i came up with https://forums.unrealengine.com/showthread.php?4138-Audio-Virtualization-WIP-teaser-vid&p=32921&viewfull=1#post32921

its old and i hadnt the time to finalize it, but in the near fututre i will start over again :cool:

Could i Paypal you some money to get your file? Or maybe teach me how you did it?

I can confirm the problem with the Get Amplitude node. It’s sampling the audio file at 0.5 the speed and if you speed it up 2x, then the sampling stops in the middle, because it thinks it’s finished… I posted the issue here
Sound Visualization Get Amplitude node sampling at half the speed - Audio - Epic Developer Community Forums , but obviously nothing happened, since it’s still persisting on 4.15.1