Changing the default music/sound (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
User avatar
ShippoK
Veteran
Posts: 348
Joined: Wed Mar 28, 2012 8:59 pm
Projects: Eyes of Gold (In-Progress)
Organization: (Red Moon)
Location: Glorious Nippon (A.K.A the USA)
Contact:

Changing the default music/sound (Volume).

#1 Post by ShippoK » Sat May 12, 2012 4:56 pm

*Edit*
I just wanted to know if there was a code on changing the default music/sound (Volume) when you first start up the game. Like you do for the text speed and such.

I was looking at this page to find such a thing, but I couldn't
http://www.renpy.org/wiki/renpy/doc/ref ... _Variables

I feel as it's something simple to and I just cant get my head wrapped around it either.
Last edited by ShippoK on Sat May 12, 2012 5:08 pm, edited 1 time in total.

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Changing the default music/sound.

#2 Post by SundownKid » Sat May 12, 2012 4:59 pm

It's in the "Options" script, look for the menu music setting.

Code: Select all

config.main_menu_music = "music/menu.ogg"

User avatar
ShippoK
Veteran
Posts: 348
Joined: Wed Mar 28, 2012 8:59 pm
Projects: Eyes of Gold (In-Progress)
Organization: (Red Moon)
Location: Glorious Nippon (A.K.A the USA)
Contact:

Re: Changing the default music/sound.

#3 Post by ShippoK » Sat May 12, 2012 5:05 pm

SundownKid wrote:It's in the "Options" script, look for the menu music setting.

Code: Select all

config.main_menu_music = "music/menu.ogg"
I guess I should of rephrase this better.

I want to change the 'volume' of the music/sound when starting up the game. By default its at full (I think '10'). I want to lower it.

Like for text speed, I change '0' to '30' for the right speed.

Patrick
Newbie
Posts: 5
Joined: Wed Jun 20, 2012 5:25 pm
Projects: Project DIMINISH
Organization: Gameosaurus.com
Location: USA
Contact:

Re: Changing the default music/sound (Volume).

#4 Post by Patrick » Wed Jun 20, 2012 6:18 pm

Looks like this question has gone unanswered.

I was about to make a thread like this, but I'll just +1 the OP here.

Rather than pre-edit all music in the game to have lowered volume, is there a way that the default state of the music volume be something other than 100%?

Or, better yet, is there any sort of "auto-duck" in python that would allow the music volume to be reduced when a voice track is played?

(working on music / VA balance here ...)

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: Changing the default music/sound (Volume).

#5 Post by Showsni » Thu Jun 21, 2012 3:15 am

Can't you just call renpy.music.set_volume at the start?
http://www.renpy.org/wiki/renpy/doc/ref ... _Functions
Or would you use _preferences.set_volume?
http://www.renpy.org/wiki/renpy/doc/ref ... references

Hm. I guess I haven't really tried to use music much.

After some digging, found this thread: http://lemmasoft.renai.us/forums/viewto ... f=8&t=2195

OKay, do this: in your splashscreen code, add the following:

Code: Select all

label splashscreen:
    python:
        if not persistent.set_volumes:
            persistent.set_volumes = True
        
            _preferences.volumes['music'] *= .75
That will start the music volume out at 75% instead of 100%. (If you don't have a splashscreen, just add this code).

If you want to dip the music volume before a voice plays, you want to use renpy.music.set_volume before and after the voice to play the music softer and then louder again. You could probably code in a function in python that would do this automatically... I guess it would be something like

Code: Select all

init:            
    python:
        def speaking(voiceclip): 
            renpy.music.set_volume(0.2, 0, channel="music")
            voice(voiceclip)
That'll dip the music volume and play the voice voiceclip when you use
$ speaking(voiceclip)

But I'm not sure how to build in a way to set the music back to
renpy.music.set_volume(1.0, 0, channel="music")
automatically when the voice clip finished... I thought you could use something like
while not renpy.music.get_playing(channel="voice") == None
but that just seems to crash the game... Hm.

Patrick
Newbie
Posts: 5
Joined: Wed Jun 20, 2012 5:25 pm
Projects: Project DIMINISH
Organization: Gameosaurus.com
Location: USA
Contact:

Re: Changing the default music/sound (Volume).

#6 Post by Patrick » Thu Jun 21, 2012 4:47 pm

Showsni,

This is all extremely helpful.

I ran all this code and it all works, except the one you had a crash with. I also got the same crash on that last bit when trying to set a rule to reset the audio to max volume after the end of a voice clip.

If I can't define a rule, at least for some of my smaller / demo projects, I can just put the music volume changes around each voice clip and that will do. It'll make the script page bulky, but I can live with that.

Thank you!!!

User avatar
ShippoK
Veteran
Posts: 348
Joined: Wed Mar 28, 2012 8:59 pm
Projects: Eyes of Gold (In-Progress)
Organization: (Red Moon)
Location: Glorious Nippon (A.K.A the USA)
Contact:

Re: Changing the default music/sound (Volume).

#7 Post by ShippoK » Thu Jun 28, 2012 12:27 pm

Oh, I didn't expect an answer after so long!

Thanks Snowshi, this is exactly what I wanted.

Post Reply

Who is online

Users browsing this forum: AlexiSonicKST, Google [Bot]