audio.main_theme - where / how to customize?
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.
- dvemail
- Regular
- Posts: 35
- Joined: Sat May 28, 2016 1:50 pm
- Projects: Working on Patronus
- IRC Nick: dvemail
- Deviantart: ObdurateDemand
- Github: dvemail
- Contact:
audio.main_theme - where / how to customize?
I've searched old threads and read the docs, but I'm not clear about how to control the main theme. It seems to play automagically, and I want to control looping, fade-in, etc. - Where and how is that done?
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: audio.main_theme - where / how to customize?
For looping, if it is on the sound channel (if you say "play sound theme" for instance where theme is the variable name for the song), then it will not loop at all. If you play it on the music channel (with say "play music theme") then it will automatically loop.
To override these default settings, just say "play sound theme loop" or "play music theme noloop".
For fadein, do something like: "play music theme fadein 1.0 fadeout 1.0"
If you could provide a more specific example of what you are trying to do I could help you more.
To override these default settings, just say "play sound theme loop" or "play music theme noloop".
For fadein, do something like: "play music theme fadein 1.0 fadeout 1.0"
If you could provide a more specific example of what you are trying to do I could help you more.
- dvemail
- Regular
- Posts: 35
- Joined: Sat May 28, 2016 1:50 pm
- Projects: Working on Patronus
- IRC Nick: dvemail
- Deviantart: ObdurateDemand
- Github: dvemail
- Contact:
Re: audio.main_theme - where / how to customize?
Thanks for your reply. The theme seems to play automatically without any lines of code in the scripts telling it to play, so I don't know where to change it.
All I want to do is a 1.5 sec fade out, loop, 1.5 sec fade in
All I want to do is a 1.5 sec fade out, loop, 1.5 sec fade in
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: audio.main_theme - where / how to customize?
It plays automatically? That is strange. Can we see your script?
Anyway, if you want to do that, do this:
In this line of code, theme refers to the variable name you assigned to your theme song file. If you didn't give it a filename then you can just replace theme with "path" where path is the location of the theme song file.
Also, if you play it on the music channel, then unlike the sound channel it will loop automatically so you do not need to specify a looping instruction.
Anyway, if you want to do that, do this:
Code: Select all
play music theme fadein 1.5 fadeout 1.5
Also, if you play it on the music channel, then unlike the sound channel it will loop automatically so you do not need to specify a looping instruction.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: audio.main_theme - where / how to customize?
Main menu music always plays automatically by design.
Don't use the sound channel for main menu music, use the music channel so players can sample the volume when editing it in preferences.
To fade main menu audio in, use an audio editor such as Audacity. Alternatively, you could add a button to control the music. The documentation for 'music room' should be sufficient.
Don't use the sound channel for main menu music, use the music channel so players can sample the volume when editing it in preferences.
To fade main menu audio in, use an audio editor such as Audacity. Alternatively, you could add a button to control the music. The documentation for 'music room' should be sufficient.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: audio.main_theme - where / how to customize?
You're using the config.main_menu_music (or something like) in the config.rpy, dont'cha?
It's old and limited as me on a feet.
Don't set it, and instead add the lines suggested by SuperbowserX just right after
screen main_menu():
in screens.rpy.
It's old and limited as me on a feet.
Don't set it, and instead add the lines suggested by SuperbowserX just right after
screen main_menu():
in screens.rpy.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
- dvemail
- Regular
- Posts: 35
- Joined: Sat May 28, 2016 1:50 pm
- Projects: Working on Patronus
- IRC Nick: dvemail
- Deviantart: ObdurateDemand
- Github: dvemail
- Contact:
Re: audio.main_theme - where / how to customize?
Tried that - play doesn't seem to be valid in screensgas wrote:You're using the config.main_menu_music (or something like) in the config.rpy, dont'cha?
It's old and limited as me on a feet.
Don't set it, and instead add the lines suggested by SuperbowserX just right after
screen main_menu():
in screens.rpy.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: audio.main_theme - where / how to customize?
Play is a function. You need to invoke it somehow, such as in a script or with a button as an action.
I don't see how it would work in a screen.
I don't see how it would work in a screen.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- dvemail
- Regular
- Posts: 35
- Joined: Sat May 28, 2016 1:50 pm
- Projects: Working on Patronus
- IRC Nick: dvemail
- Deviantart: ObdurateDemand
- Github: dvemail
- Contact:
Re: audio.main_theme - where / how to customize?
So if I understand you correctly, I could define a function somewhere that would be like a theme_music_on() and theme_music_off() and I could invoke them in the screens?
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: audio.main_theme - where / how to customize?
Scratch what I said earlier. This, going by how it is in the current documentation, seems to be up to date.
https://www.renpy.org/doc/html/config.h ... menu_music
Do this at the top of a script file:
This should automatically loop. Try this, and if it works then from there we can figure out how to do fadein.
https://www.renpy.org/doc/html/config.h ... menu_music
Do this at the top of a script file:
Code: Select all
init python -2:
config.main_menu_music = theme
- dvemail
- Regular
- Posts: 35
- Joined: Sat May 28, 2016 1:50 pm
- Projects: Working on Patronus
- IRC Nick: dvemail
- Deviantart: ObdurateDemand
- Github: dvemail
- Contact:
Re: audio.main_theme - where / how to customize?
yes, that works.
- SuperbowserX
- Veteran
- Posts: 270
- Joined: Sat Jan 07, 2017 3:09 pm
- Contact:
Re: audio.main_theme - where / how to customize?
I don't know how you can give it a fadein/fadeout loop in Ren'py.
But, you can edit the audio file in Audacity or some other audio editing program to give it a fade in or fade out effect (so that the fadein/fadeout is inherent in the audio file and not the playing of it by Ren'py).
Also, once you get to label start, you need to put a "stop music fadeout 1.0" line because the main menu theme will continue playing after the main menu until you stop it or play something else.
But, you can edit the audio file in Audacity or some other audio editing program to give it a fade in or fade out effect (so that the fadein/fadeout is inherent in the audio file and not the playing of it by Ren'py).
Also, once you get to label start, you need to put a "stop music fadeout 1.0" line because the main menu theme will continue playing after the main menu until you stop it or play something else.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: audio.main_theme - where / how to customize?
and we've gone full circle, right bac k to
Imperf3kt wrote:Main menu music always plays automatically by design
To fade main menu audio in, use an audio editor such as Audacity.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: audio.main_theme - where / how to customize?
Probably simpler to just edit the music files. Technically, you can probably also use on show / on hide with Play() and Stop() (https://www.renpy.org/doc/html/screen_actions.html#Play / viewtopic.php?f=8&t=33613 ) to get the same effect, but is it really worth the hassle?
Who is online
Users browsing this forum: Semrush [Bot]