Extract and display a "sound wave"

Hello everyone,

To guide the player across a level (think Saria’s music in Ocarina of Time’s Lost Woods), I’d like to show the intensity of a Musical Clue as a sound wave.

I need to somehow retrieve the sound wave and make it bigger or smaller depending on the music level.

image

Since sound waves ARE displayed in the Editor I’m hopeful there might be a way to access them? Any idea where I should start?

I could also do some kind of flipbook animation, OR extract the desired wave myself and put all the data into a table, I don’t really know what’s the most optimal way to go. The sound wave doesn’t need to match PERFECTLY the music in exact real-time, although it would be a plus.

Thanks for your suggestions :slight_smile:
Best regards

Are these wavs songs or just sounds? I’m thinking your flip book idea has promise. Perhaps open these songs or sounds in your DAW of choice and then make some screen shots of said waves to be used in your game.

Hello there, thanks for your answer :slight_smile:
These are musics, and I’m using TimeSynth to play and queue them. After giving it some thoughts I ended up unsure about the flipbooks since TimeSynth musics are playing almost independently from framerate and I’d probably have a hard time syncing them with their “waves”.

What I did is that I activated the Spectral Analysis Option in the TimeSynth component.
image

Then at launch I add all the frequencies I’d like to analyze

Then on tick I display them by drawing on a Render Target the result for each frequency’s magnitude (Begin Draw Canvas => Draw all my lines => End Draw Canvas)

It’s pretty tedious but performance wise it seems ok. Here’s the result :
https://imgur.com/a/ 1sH0Bxo
(you’ve got to remove the space. Couldn’t paste the whole link as it displayed uncorrectly in the forum)

I can either make a curve or a wave form, it’s the same data displaying differently. Pretty happy with the end result, I think I’ll make do with that. Even if a dedicated sound designer might think the wave does not represent the music correctly, I think it looks fine for most peons like me ^^

I saw your pic and think that is a pretty clever solution. So in your For Loop you have 40 index’s of frequencies like say 200 hz, 800 hz 1200, etc etc??? Or is it just referencing all of your song files? Either way, like you said it may not be perfect, but at least you have some peace of mind knowing that the graphic is generated based on the real things it represents. I think the biggest graphic equalizer I have seen or used is 32 bands. So then I guess technically you could add even more frequencies and yield a much more accurrate render of the sound files.

Thanks :smiley:
I hope it’ll be useful to somebody else in the future!

The For Loop from 1 to 40 fills up a local float array on Begin Play with Frequencies I want to track with a 50 increment each time. So it’s going 50Hz, 100Hz, …, 2000Hz. It is then passed to the TimeSynth component.

The biggest “problem” with my method is that the Magnitude I get from each frequencies is weird. It feels like it’s more weighted towards low frequencies. That’s why I have a “select float” node where I divide low frequencies by 30 and all the other frequencies by only 10. I found these figures by tweaking but it could still be improved and I’d like to understand how the magniture really works because right now it’s unclear.