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

Re: [pygame] Better Python music playback?



Zack Schilling wrote:
I suppose you're both right. Using just the mixer, I only lose two abilities: Starting the music from specific points and precise timing information.

I can emulate the timing feedback using pygame.time.get_ticks and an offset when the song starts, but I'll need to work around not being able to start playing the song at an arbitrary number of milliseconds. I'm making a rhythm/combat/platformer, so the music and gameplay are closely tied. The biggest problem with losing the ability to start the music any place is that there is going to be desynchronization if the player happens to repeatedly pause the game.

Each time the player pauses, a few milliseconds will slip by between pausing/resuming the music and recalculating the tick offset, regardless of what order I perform the two in. Eventually the music will desynchronize from the game. Can anyone think of a way to keep the music in sync through multiple pauses without either: 1.) allowing the music to play while paused or 2.) restarting the music on unpause. The music has to stop and resume exactly where it left off or else just the act of pausing affects gameplay. If the number of milliseconds that I think the song has been playing don't match the actual number, then the gameplay falls apart.

Thanks,

-Zack


On May 25, 2009, at 12:36 AM, René Dudfield wrote:

hi

As Brian says, maybe loading multiple oggs as Sound objects would work
for you, if you don't need streaming.


if not, maybe this will be good for you (allthough it doesn't
currently support oggs):
http://code.google.com/p/pygalaxy/wiki/SWMixer

It uses pyaudio (a python wrapper for portaudio) and some code to
emulate the pygame.mixer interface (although not exactly).

Also not sure if Nathan is working on it anymore.

Maybe it'd be useful for you.

cu,





On Mon, May 25, 2009 at 9:39 AM, Zack Schilling
<zack.schilling@xxxxxxxxx> wrote:
I'm looking for something a little more complex than the pygame-wrapped SDL
music mixer to use with my pygame project. I need something that's
cross-platform (Mac OS X, Windows, Linux), easy-to-use, and supports the
following features:

2+ tracks simultaneously
Streaming ogg playback
Seamless looping
Gapless playback
Fade in/out
Precise timing info (like the way the SDL reports playback time in
milliseconds )

Any suggestions for what I could use? How does Frets on Fire work? Whatever
they use seems ideal in terms of features.

Thanks,

-Zack



Personally, I would avoid this whole problem by axing the pause function entirely. If the levels are only a couple minutes long, I don't think a pause function will be missed. If the game is all about fast-action combat and platforming, very few people will want to throw off their rhythm by pausing the game.
--
|Evan Kroske
Welcome2Obscurity.Blogspot.com <http://welcome2obscurity.blogspot.com>
Glory is fleeting, but obscurity is forever. — some French guy |