This page is out of date

You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.

Some places to look are:

Please do not create new links to this page.


Audio

Ren'Py supports playing music and sound effects in the background, using the following audio file formats:

Ren'Py supports an arbitrary number of audio channels. Three are defined by default:

The 'Music Volume', 'Sound Volume', and 'Voice Volume' settings of the in-game preferences menu are used to set individual volumes for these channels.

Sounds can also be set to play when buttons, menu choices, or imagemaps enter their hovered or activated states. See Sound Properties.

Audio Statements

The usual way to play music and sound in Ren'Py is using the three music/sound statements:

play channelname audiofile(s) [fadein] [fadeout]

is used to play sound and music. If a file is currently playing, it is interrupted and replaced with the new file.

channelname is expected to be the name of a channel. (Usually, this is either "sound", "music", or "voice".)

audiofile(s) can be one file or list of files.

fadein and fadeout clauses are all optional. Fadeout gives the fadeout time for currently playing music, in seconds, while fadein gives the time it takes to fade in the new music.

play music "mozart.ogg"
play sound "woof.mp3"
play myChannel "punch.wav" # 'myChannel' needs to be defined with renpy.music.register_channel().

"We can also play a list of sounds, or music."
play music [ "a.ogg", "b.ogg" ] fadeout 1.0 fadein 1.0
stop sound
stop music fadeout 1.0
queue sound "woof.ogg"
queue music [ "a.ogg", "b.ogg" ]

The advantage of using these statements is that your program will be checked for missing sound and music files when lint is run. The functions below exist to allow access to allow music and sound to be controlled from python, and to expose advanced (rarely-used) features.

Two configuration variables, config.main_menu_music and config.game_menu_music allow for the given music files to be played as the main and game menu music, respectively.

Defining Channels

It's possible to define your own channel by calling renpy.music.register_channel in init code.

Music Functions

The music functions provide a programmatic interface to music playback.

Sound Functions

Most renpy.music functions have aliases in renpy.sound. These functions are similar, except they default to the sound channel rather than the music channel, and default to not looping.

Category:Changed in 6.9.1