[solved] Having the main menu music not loop?

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
SpicyMayo1429
Regular
Posts: 36
Joined: Tue Mar 20, 2018 11:23 am
Contact:

[solved] Having the main menu music not loop?

#1 Post by SpicyMayo1429 »

I there a way to make the main menu music not loop? I wanna do something similar to the video game Wonder Boy: the Dragon's Trap opening where it's just a short piece (less than 30 seconds) that plays upon entering the main menu.
Last edited by SpicyMayo1429 on Fri Jun 26, 2020 11:20 pm, edited 1 time in total.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Having the main menu music not loop?

#2 Post by rayminator »

what is your code so we can help you better

you can can add loop = False depend one your code

this depend on how you putting your code and how you are using it

this is one way or you put stop music or stop sound as well where you want it to end

Partial Playback

Ren'Py supports partial of audio files. This is done by putting a playback specification, enclosed in angle brackets, at the start of the file. The partial playback specification should consist of alternating property name and value pairs, with every thing separated by spaces.

The values are always interpreted as seconds from the start of the file. The three properties are:

from
Specifies the position in the file at which the first play-through begins playing. (This defaults to 0.0 seconds.)
to
Specifies the position in the file at which the file ends playing. (This defaults to the full duration of the file.)
loop
Specifies the position in the file at which the second and later play-throughs begin playing. (This defaults to the start time given by from if specified, or to the start of the file.)

For example:

Code: Select all

play music "<from 5 to 15.5>waves.opus"
will play 10.5 seconds of waves.opus, starting at the 5 second mark. The statement:

Code: Select all

play music "<loop 6.333>song.opus"
will play song.opus all the way through once, then loop back to th

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Having the main menu music not loop?

#3 Post by MaydohMaydoh »

rayminator wrote: Fri Jun 26, 2020 8:20 pm what is your code so we can help you better
As it's related to the main menu, probably using the config.main_menu_music variable.
So doing what Ray mentioned and using the before_main_menu label, (I can't remember what the no loop comment is, but it should be somewhere in the docs)

Code: Select all

label before_main_menu:
    play music 'song.mp3' loop False
    return
Sorry if I make no sense!

User avatar
SpicyMayo1429
Regular
Posts: 36
Joined: Tue Mar 20, 2018 11:23 am
Contact:

Re: Having the main menu music not loop?

#4 Post by SpicyMayo1429 »

Thanks! It works.

Post Reply

Who is online

Users browsing this forum: Google [Bot]