documentation index

## Adding Music & Sound Effects

### Music

To play background music (which loops until you stop it), you use renpy.music.play:

    $ renpy.music.play("ominous.ogg")

To use fade-in or fade-out (in seconds):

    $ renpy.music.play("ominous.ogg", fadein=2, fadeout=2)

To stop the background music, you use renpy.music.stop:

    $ renpy.music.stop()

### Sound Effects

To play a sound effect, use renpy.sound.play:

    $ renpy.sound.play("bang.ogg")

There's a Ren'Py function to stop music, but there's usually no reason to use it.

### Voices (Voice Acting)

If you want to add voice acting to your visual novel, you'll need to put each screen of dialog into a separate file, and name them in a way that you can figure out which line of dialog they go with. Then, before each line of dialog, put a voice statement:

    voice "bob203.ogg"

    bob "I love ice cream."

    voice "nancy218.ogg"

    nancy "I love ice cream too."

    voice "bob204.ogg"

    bob "I also like cookies."

Previous: Branching & Recombining the Story | Ren'Py Web Tutorial | Next: (none)

documentation index