Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Marty15

Music?

This topic is 6007 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a dancing game and i was wondering what the best way of finding the Beat/Rythem of the music i''m using, so that i can change the background and stuff. Thanks

Share this post


Link to post
Share on other sites
Advertisement
No simple way, you need to analyse the sound buffer using some basic DSP (digital signal processing).

It depends on how advanced you want the app to be. If the music has a strong beat (prominent drum say) you could just test based on amplitude analysis.

This isn''t a simple task though and DSP isn''t the easiest of topics!

Share this post


Link to post
Share on other sites
You could look up "fast fourier transforms"

there is source code here (http://www.relisoft.com/Science/Physics/sound.html) that can get you started.

Share this post


Link to post
Share on other sites
I dont want to sound stupid but i have not got a clue what your talkiing about, and i definatly dont know what that site is about

sorry. but thanks all the same

Share this post


Link to post
Share on other sites
as far as i know. DSP is... using effects and so forth.
i believe what Marty wanted, was some sort of program which could establish the beat of the music he was using, so that it would control another part of his program. or something like that... the amplitude test is a good one, as the music grows louder, ur app could recognise that, maybe frequency response or something else like that...

since dance music tends to start with a bass line and drums, whilst they mid and high ranges come in later, so..... its ur call.




Purple Hamster
Helped and be helped!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I dont know what type of music format you are using, but if you use midi i think it would be pretty simple. or if you make the music yourelf or have access to the notes used in it. you could store the timing of each note and work with that.

Share this post


Link to post
Share on other sites
Fast fourier transforms are used to decompose a signal so that you can look at it's frequency content. They map signal data from the time domain to the frequency domain.

Huh???

Imagine you and a friend get together. You hum a tone at a constant frequency and he/she hums a tone at a different frequency. The result looks like two superimposed sine waves. (You can experiment with this sort of thing in Sound Recorder).
There's not a whole lot you can easily discern from that wave.

Now, imagine you take a handful of samples (say 1024 at a time) from your little jam session and send it through a fourier transform. What you will end up with is a set of samples that describe the frequency content of that handful of samples. In the scenario, you'd see one peak at your frequency and one at your friend's.

Now, imagine sending a handful of samples in which your friend does not hum. The frequency plot for that batch would have only one peak where your "signal" was. So, you could use this system to see when your friend was humming and when he/she wasn't.

So???

Your drum beat probably occupies an easily separable frequency range. Therefore, you could send your music through the FFT in 1024 sample intervals and watch when you get frequencies in that range. When you do, there be a drum beat.

It sounds very hard, I know, but it's the right way to solve your problem. It'll be worth the investment to look into this. I've found that the code at Relisoft (http://www.relisoft.com/Freeware/source.zip) can be reused relatively easily. You could probably use their code (check their stance on this) without truly understanding exactly what's going on. If you do want to learn more, there are plenty of places on the web that talk about this.
http://www.jjj.de/fxt/

[edited by - CrazedGenius on May 31, 2002 1:40:41 AM]

Share this post


Link to post
Share on other sites
Thanks all (especialy CrazedGenius) for all your help i am well on my way to making this game now.

Thanks again.

Share this post


Link to post
Share on other sites
If you''re working with audio data, and I presume as much, since MIDI tempo is VERY easy to resolve, head to www.alanmyers.com and grab "sample to metronome" from the downloads section. You can load the .wav file you''re working with, tell it how many beats are in the .wav file, and it will give you the tempo.

Ed Lima - ELM&M
ed@edlima.com
http://www.edlima.com

Share this post


Link to post
Share on other sites
Is there any way to split the frequencys or something in DirectSound so that i can do that FFT stuff?

Thanks

P.S. I am using a .wav file.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!