Stop sound in main menu(Solved)
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.
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.
Stop sound in main menu(Solved)
Hi! I'm new to ren'py and a total noob.
I added some sounds in my script but when I return to the main menu, the sound doesn't stop. Do I have to add "stop sound" somewhere?
I added some sounds in my script but when I return to the main menu, the sound doesn't stop. Do I have to add "stop sound" somewhere?
Last edited by Pandar on Mon Dec 16, 2019 4:44 pm, edited 1 time in total.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Stop sound in main menu
Can you show the code so it can be specific?
Re: Stop sound in main menu
I'm using "The question" novel to practice. I simply added "play sound "sounds/rain.mp3"" and then "stop sound", but when I return the main menu the sound is still there.
Code: Select all
# Declare characters used by this game.
define s = Character(_("Sylvie"), color="#c8ffc8")
define m = Character(_("Me"), color="#c8c8ff")
# This is a variable that is True if you've compared a VN to a book, and False
# otherwise.
default book = False
# The game starts here.
label start:
# Start by playing some music.
play music "illurock.opus"
scene bg lecturehall
with fade
"It's only when I hear the sounds of shuffling feet and supplies being put away that I realize that the lecture's over."
"Professor Eileen's lectures are usually interesting, but today I just couldn't concentrate on it."
play sound "sounds/rain.mp3"
"I've had a lot of other thoughts on my mind...thoughts that culminate in a question."
stop sound
"It's a question that I've been meaning to ask a certain someone."
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Stop sound in main menu
How about this? Replace the main menu textbutton into this one.
Sorry for the late reply.
Code: Select all
textbutton _("Main Menu") action [Stop("sfx"), Start()]
Re: Stop sound in main menu
In the navigation screen? I copied it like that and it doesn't work.isobellesophia wrote: ↑Wed Dec 11, 2019 12:11 pm How about this? Replace the main menu textbutton into this one.
Sorry for the late reply.Code: Select all
textbutton _("Main Menu") action [Stop("sfx"), Start()]
Code: Select all
screen navigation():
vbox:
style_prefix "navigation"
xpos gui.navigation_xpos
yalign 0.5
spacing gui.navigation_spacing
if main_menu:
textbutton _("Start") action Start()
else:
textbutton _("History") action ShowMenu("history")
textbutton _("Save") action ShowMenu("save")
textbutton _("Load") action ShowMenu("load")
textbutton _("Preferences") action ShowMenu("preferences")
if _in_replay:
textbutton _("End Replay") action EndReplay(confirm=True)
elif not main_menu:
textbutton _("Main Menu") action [Stop("sfx"), Start()]
textbutton _("About") action ShowMenu("about")
if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):
## Help isn't necessary or relevant to mobile devices.
textbutton _("Help") action ShowMenu("help")
if renpy.variant("pc"):
## The quit button is banned on iOS and unnecessary on Android and Web.
textbutton _("Quit") action Quit(confirm=not main_menu)
Sorry for bad english
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Stop sound in main menu
Actually, that is just an example of the name of your sound. Replace that with your rain sound instead.
Re: Stop sound in main menu
Ok sorry ahah I got this error :isobellesophia wrote: ↑Wed Dec 11, 2019 12:36 pm Actually, that is just an example of the name of your sound. Replace that with your rain sound instead.
While running game code:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "renpy/common/00action_audio.rpy", line 127, in __call__
renpy.music.stop(channel=self.channel, **self.kwargs)
Exception: Audio channel u'sounds/rain.mp3' is unknown.
I can hear the rain sound in-game, so the file is in the right folder.
EDIT: solved, I created a new sfx channel.
Thanks for the replies.
- zankizuna
- Veteran
- Posts: 416
- Joined: Fri May 04, 2012 2:20 am
- Completed: Monochrome Valentine
- Projects: Softwar
- Deviantart: raseru09
- itch: ZanKizuna
- Location: Manilaaaaaaaa
- Contact:
Re: Stop sound in main menu
add this to your screen
or
Code: Select all
screen navigation():
on 'show' action Stop('sfx')
or
Code: Select all
screen navigation():
on 'show' action Stop('sound')
Who is online
Users browsing this forum: No registered users