documentation indexreference manualfunction index

renpy.music.set_volume

Function: renpy.music.set_volume (volume, channel=7):

This sets the volume of the given channel. The volume is a number between 0.0 and #0, and is interpreted as a fraction of the mixer volume for the channel.

This value takes effect immediately, and is persistent through rollback, menu transitions, and game saves / loads.

Example

    # Start some music playing in the background
    $ renpy.music.play("mozart.ogg")

    "Let's lower the music volume by half"

    # Lower the music volume by half
    $ renpy.music.set_volume(0.5, channel=7)

    "Let's set back the music volume to its original volume number"

    # Set back the music volume to its original volume number
    $ renpy.music.set_volume(1.0, channel=7)