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

Re: [pygame] questions on pygame.mixer and pygame.mixer.music modules



On 9/13/05, Srinath Avadhanula <srinathava@xxxxxxxxx> wrote:
> Hello,
> 
> I've been making a little "snooze alarm" clock on my linux machine
> using the pygame.mixer and pygame.mixer.music modules to produce the
> sound. I have a few questions:
> 
> 1. Is it possible to "fade-in" a music piece? This would be nice to
> have to gently wake up the user (victim?). I already know that there
> is a set_volume which can be used do the same thing, but I would
> rather avoid writing loops because it blocks other events from
> registering.
> 

There is a fadein, but it blocks.  So I'm not sure if you'd want to use it.

Another option is to change the volume every time in your main loop as
you loop around.  Check how much elapsed time has past, and adjust for
that.


> 2. I have two pieces which need to be played one after another. One
> piece is sampled at 22 KHz and the other at 44.1KHz. When I go from
> playing one piece to another, how do I set the sample rate? Do I need
> to .quit() the mixer and .init() it again?
> 
> Thanks,
> Srinath
> 

You should be able to set the mixer at 44, and it will mix both for
you without changing it.  Try both and see :)