Reaction to sound?

For questions about using Classic.

Post » Wed Jan 13, 2010 7:50 am

I'm working on a couple projects with Construct after starting a few days ago, and I love the program. I had a bit of a random idea to test if I COULD do something, and I'm wondering if there's any known way to make something react to music in Construct?

I know how to make music play with the Xaudio plugin, but I want to make something react to the actual beat of it, kinda like a visualizer, or an equalizer-looking effect.It doesn't even have to be specific types of sounds, just beats in general.

Is there a way to do this, or would I have to import some python scripts that can analyze audio files in order to effectively do it?
B
1
G
2
Posts: 7
Reputation: 639

Post » Wed Jan 13, 2010 10:21 am

You can get the peak/rms levels from XAudio2. Apart from that if you need something more sophisticated you might be using the wrong tool for the job. Construct is a game creator, not an advanced music/FFT analysis system!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jan 13, 2010 4:26 pm

Yeah, I figured as much. That was about all I could figure out from the wiki. I might just mess around with volume detectors and try to get it going. I don't want something SUPER advanced, but I was hoping to get a synesthetic experience going between the music and the game around it. Things would pulse colors and waves, etc., along with the music.

The volume levels idea might be basic enough to get the concept in place, though. I'll try fiddling with stuff. =P
B
1
G
2
Posts: 7
Reputation: 639

Post » Thu Jan 14, 2010 3:55 am

alright, far as I can tell, the values don't change with the music, and my attempts at even getting text to display properly with it, or anything dynamic related to the audio, isn't working. I guess I'll have to give up on the idea, unless I'm REALLY missing something. =/
B
1
G
2
Posts: 7
Reputation: 639

Post » Thu Jan 14, 2010 4:42 am

[quote="Lord Blizzard":oqarayi7]alright, far as I can tell, the values don't change with the music, and my attempts at even getting text to display properly with it, or anything dynamic related to the audio, isn't working. I guess I'll have to give up on the idea, unless I'm REALLY missing something. =/[/quote:oqarayi7]

I don't see any option to get levels for music, no, but you can for sound. Here's an example of some dynamic stuffs happening with peak levels:

http://dl.dropbox.com/u/529356/peak%20level%20test.zip

A sprite moves across the screen and makes a blippy wave when the sound is played, kind of like a heart monitor. The levels are rounded and displayed in a text box. It would pretty much be up to you to experiment with how to manipulate the data the peak levels kick back at you.

You could convert your music to one of the channel-supported formats and play it in a channel. Or you could hit up the feature request forum and ask that peak level info be added for music.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 14, 2010 5:14 am

My suggestion would be: hardcode the beat.

Unless you're going for an audiosurf kind of thing, in which case I'd say analyze the audio in a separate offline program and write down files that Construct can easily read. Kinda like audiosurf does.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Thu Jan 14, 2010 7:09 am

Deadeye, you got exactly what I was looking for. I didn't realize the peak and RMS info only worked with WAV files. I converted the mp3 over and used the WAV, and it worked perfectly. it held constant at 0 before, but now it's great. I need to work on smoothing it out a bit, but it's definitely something I can work with.

I was hoping it was something small like that I was missing, rather than something impossible, but it's good now. Thanks! =)
B
1
G
2
Posts: 7
Reputation: 639

Post » Thu Jan 14, 2010 7:15 am

Keep in mind it's not just .wav, you can play .ogg or .wma on a channel as well if you want more compression. You just can't play .mp3 in a channel.

Check out the XAudio2 entry on the wiki for more info.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 14, 2010 7:28 am

Yeah, everything I'd gotten so far was from the wiki, I just didn't realize the expressions wouldn't fetch for music files like they would channel sounds.

The example you linked isn't working for me for some reason, but the only thing I'm curious about how he did was rounding the values, though I think I have an idea of doing that so it isn't so skippy...
B
1
G
2
Posts: 7
Reputation: 639

Post » Thu Jan 14, 2010 11:54 am

[quote="Lord Blizzard":1uqpc6bz]The example you linked isn't working for me for some reason[/quote:1uqpc6bz]

Um... my 'peak level test.cap?' The one that I thought cleared things up for you before? Uh, okay. Strange. I assumed it had worked before since you said you got it.

Anyway, if you're getting an error when you open it it's probably because you aren't using 0.99.72.


[quote="Lord Blizzard":1uqpc6bz]but the only thing I'm curious about how he did was rounding the values, though I think I have an idea of doing that so it isn't so skippy...[/quote:1uqpc6bz]

The... he? Me? What example? I am so confused by almost everything in your post :P. If it's my example... and it's the one that doesn't work... then how did you know about the rounding? And what... I mean... gah I lost my train of thought.

Okay, start again. The example which helped you before now doesn't work and may or may not work retroactively in the past due to - quantum fluctuations in the time stream? let's just go with that - yet in some alternate universe that you have mystical knowledge of an alternate you understands that a) I had a rounding action in my example and b) it looks kind of skippy, but that other you, by proxy of you who is you-you, doesn't understand the rounding works but perhaps has a way of making it not so skippy.

Okay, I think I got it.

What was the question, again?

Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests