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

Re: [pygame] Sound question



Mike Wagman wrote:
How can I make sure two different sounds are playing on two different
sound channels.

If someone could give me code showing loading two sounds and playing
them both one on each channel that would be greatly appreciated.
Mike, the SDL_Mixer library defaults to 8 channels for mixing sound. Pygame gives you a function to raise or lower this if you need, but it is usually plenty.

If you play any two sounds (or even the same sound twice) they will automatically play on separate channels. But there are two ways to play a soundfile. You can just call Sound.play() which will pick the 'best' channel and play it. Or you can get a specific Channel object and play a sound on it (which stops anything previously playing on that channel).

When you start playing sound through the actual Sound object, it returns a reference to the Channel it was assigned to.