Music volume

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Zenytee
Newbie
Posts: 21
Joined: Thu Mar 24, 2016 2:31 pm
Contact:

Music volume

#1 Post by Zenytee »

Hello, how can I change the music volume, both in game and in main menu?
I want to preset a volume because I deleted the settings menu so players won't be able to enter there.
Thank you, much appreciated.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Music volume

#2 Post by Donmai »

You can find that information in the Audio chapter of the documentation. Look here: https://www.renpy.org/doc/html/audio.ht ... set_volume
For example:

Code: Select all

    $ renpy.music.set_volume(0.5, 0.6, channel="ambient")
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Zenytee
Newbie
Posts: 21
Joined: Thu Mar 24, 2016 2:31 pm
Contact:

Re: Music volume

#3 Post by Zenytee »

Thank you for the reply. I looked at the forum and did what u said. instead of "ambient" I put the channel "music", but it doesn't change the volume at all. I tried different numbers and it's the same volume any number I try.

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Music volume

#4 Post by vollschauer »

To set a default volume use (options.rpy):

Code: Select all

    ## The default audio volumes
    config.default_music_volume = 0.5
    config.default_sfx_volume = 0.7
    config.default_voice_volume = 1.0
As far as I can remember I had once also trouble to use:

Code: Select all

$ renpy.music.set_volume(0.5, 0.6, channel="ambient")
Try this ....

Code: Select all

    python:
        _preferences.set_volume('music', 0.5)

Zenytee
Newbie
Posts: 21
Joined: Thu Mar 24, 2016 2:31 pm
Contact:

Re: Music volume

#5 Post by Zenytee »

Still not working :/
I tried to set it from 0.1 to 1.0 but no difference. I don't know what else I could try

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Music volume

#6 Post by Divona »

Here is the code I use. Test it out and it work for me:

Code: Select all

    python:
        _preferences.set_volume('music', 0.5)
        renpy.restart_interaction()
It the last line of code that refresh the change after the first line.

Strangely, the:

Code: Select all

$ renpy.music.set_volume(0.5, 0, channel='music')
should also work at adjust the music volume, though. But it does not affected the bar in the setting menu.

Make sure to put those code inside the label, for example:

Code: Select all

label main_menu:

    python:
        _preferences.set_volume('music', 0.5)
        renpy.restart_interaction()
Last edited by Divona on Mon Sep 05, 2016 1:02 pm, edited 1 time in total.
Completed:
Image

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Music volume

#7 Post by vollschauer »

If it's still not working, then show your code ....maybe you doing it wrong ^^

Zenytee
Newbie
Posts: 21
Joined: Thu Mar 24, 2016 2:31 pm
Contact:

Re: Music volume

#8 Post by Zenytee »

@Divona
It works. Thank you for the help!

Shapesorter
Newbie
Posts: 1
Joined: Fri Apr 29, 2022 4:28 pm
Soundcloud: Addiktnoid
Contact:

Re: Music volume

#9 Post by Shapesorter »

Divona wrote: Mon Sep 05, 2016 12:47 pm Here is the code I use. Test it out and it work for me:

Code: Select all

    python:
        _preferences.set_volume('music', 0.5)
        renpy.restart_interaction()
It the last line of code that refresh the change after the first line.

Strangely, the:

Code: Select all

$ renpy.music.set_volume(0.5, 0, channel='music')
should also work at adjust the music volume, though. But it does not affected the bar in the setting menu.

Make sure to put those code inside the label, for example:

Code: Select all

label main_menu:

    python:
        _preferences.set_volume('music', 0.5)
        renpy.restart_interaction()
I pasted this at the end of options.rpy and it works, but it makes the game loop forever while skipping the initial options screen.
could you post a picture of where i should post this code to make it work propperly
also, whats the code to lowering the sounds?
Thanx

Post Reply

Who is online

Users browsing this forum: No registered users