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

Re: [pygame] "fade to"?



You can do this yourself by changing the volume over time.

Count the elapsed time, and then use set_volume() to update the levels
every tick.

Cheers.



On 8/11/05, Terry Hancock <hancock@xxxxxxxxxxxxxxxxxxxx> wrote:
> I've been working with PyGame for a bit now.  One thing that
> is pretty annoying is the lack of smooth volume adjustment
> in pygame.mixer.
> 
> There's a "fadeout" method for Sound objects, but nothing
> that allows a smooth transition from one volume to another
> AFAICT.  I can transition the sound sharply from one volume
> to another, but it causes an audible "pop" effect.
> 
> I'd prefer to do something like a 0.1 to 0.5 second smooth
> fade from one level to the other.  This would be
> particularly useful for "shaping" background music to
> accomodate dialog in a game.
> 
> Is there a way to achieve this effect?
> 
> Cheers,
> Terry
> 
> --
> Terry Hancock ( hancock at anansispaceworks.com )
> Anansi Spaceworks  http://www.anansispaceworks.com
> 
>