Ren'Py Sound Volume in Image Loop

SteelyDan14

Formerly Known as GeekBone
Modder
Donor
Jan 13, 2018
1,385
6,067
I am leveraging this code to create a function so I can call it in an image slideshow.
Code:
init python:
  class atl_play_sound(object):
    def __init__(self,sound):
      super(atl_play_sound,self).__init__()
      self.sound=sound
    def __call__(self,*args,**kwargs):
      if not renpy.predicting():
        renpy.play(self.sound)

image slideshow1:

    "gui/mm_slideshow/mainmenu_bg1b.jpg" with Dissolve(2.0)
    pause 5.0
    "gui/mm_slideshow/mainmenu_bg1b.jpg" with vpunch
    pause 0.5
    function atl_play_sound("media/audio/effects/glassbread.mp3")
    "gui/mm_slideshow/mainmenu_bg1ba.jpg"
    pause 3.0
The sound effect is too loud in this section but it is fine in other parts of the game, so I just want to adjust the volume. I have tried a variety of ways and none of them seem to work. Suggestions would be appreciated.
 

gojira667

Member
Sep 9, 2019
325
320
The sound effect is too loud in this section but it is fine in other parts of the game, so I just want to adjust the volume. I have tried a variety of ways and none of them seem to work. Suggestions would be appreciated.
According to it defaults to , default audio. Depending on what you are doing you may want to use instead or pass in the correct channel via renpy.play().
 
  • Like
Reactions: SteelyDan14

SteelyDan14

Formerly Known as GeekBone
Modder
Donor
Jan 13, 2018
1,385
6,067
According to it defaults to , default audio. Depending on what you are doing you may want to use instead or pass in the correct channel via renpy.play().
This worked! Thanks!

Here is my solution:
Code:
init python:
  class atl_play_sound(object):
    def __init__(self,sound):
      super(atl_play_sound,self).__init__()
      self.sound=sound
    def __call__(self,*args,**kwargs):
      if not renpy.predicting():
        renpy.sound.play(self.sound, relative_volume = 0.3)
 
  • Like
Reactions: gojira667