[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Music



The mixer has to hold the sound data in some kind of buffer.  I tried
figuring out the internal representation last night, but couldn't find
it in the Pygame source.  If it's a buffer, it can be analyzed.  You
might be able to do something with frequency, but chances are, you're
going to end up working with amplitude instead.  That's fine, since
you'll find spikes in amplitude generally correspond with the
beat/rhythm.

Now, the 50 million dollar question is "How do I access the mixer
object's internal sound buffer?".

On 7/14/05, Sami Hangaslammi <sami.hangaslammi@xxxxxxxxx> wrote:
> On 7/14/05, D. Hartley <denise.hartley@xxxxxxxxx> wrote:
> > What I'd *like* is to be able to listen for certain individual
> > elements in the song, and make them game events.  In theory I could do
> > this when the song ended, make something happen and replay the song,
> > but I couldn't do it, for example, every time a high C was played, or
> > a drum beat, etc.
> >
> > Can pygame do anything like this? (or anything else, for that matter?)
> > the closest thing I've seen so far is finding the position in the
> > song, so that if you knew you had a high C (for example) every x
> > number of miliseconds, you could make an event happen at every x
> > number of miliseconds. They wouldnt exactly be tied (and you'd pretty
> > much have to create some boring music), but I can't find much else.
> >
> > Anybody who's played something like Lumines, O2Jam, Band Brothers, or
> > I'm assuming DDR (i've never played but believe it's tied to events in
> > the music) will know the kind of tie I'm talking about.
> 
> I don't think Lumines and other music based games analyze the actual
> music files either. My guess is that most of those games have two
> files for each song, the actual mp3 etc. music file and another
> metadata file that lists the positions of different "events". The
> metadata could be similar to the midi/tracker formats, which would
> make it easy to react to  the music in the program, but you would
> still get the benefits of the better sounding mp3 format.
> 
> --
> Sami Hangaslammi
> 


-- 
Andrew Ulysses Baker
"failrate"