documentation index ◦ reference manual ◦ function index

# renpy.music.play

Function: | renpy.music.play | (filenames, channel="music", loop=None, fadeout=None, synchro_start=False, fadein=0, tight=False, if_changed=False):

This stops the music currently playing on the named channel, dequeues any queued music, and begins playing the specified file or files.

filenames may be a single file, or a list of files.

loop - If True, the tracks will loop once they finish playing. If False, they will not. If None, takes the default for the channel.

fadeout - If None, the fadeout time is taken from config.fade_music, otherwise it is a time in seconds to fade out for.

synchro_start - If True, all the channels that have had play called on them with synchro_start set to True will be started at the same time, in a sample accurate manner. This can be used to, for instance, have a piece of music separated into separate percussion, melody, and background chord audio files, and play them simultaneously.

fadein - The number of seconds to fade the music in for, on the first loop only.

tight - If True, then fadeouts will span into the next-queued sound. If False, it will not, and if None, takes the channel default.

if_changed - If True, and the music file is currently playing, then it will not be stopped/faded out and faded back in again, but instead will be kept playing. (This will always queue up an additional loop of the music.)

## Example

        # Start some music playing in the background with a fade in effect 2
        # seconds after the start of the music play
        $ renpy.music.play("mozart.ogg", fadein=2)

See also: Audio

documentation index ◦ reference manual ◦ function index