In-song transition; is it possible?

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
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

In-song transition; is it possible?

#1 Post by Mammon » Wed Feb 08, 2017 8:33 am

Hi, so I was wondering whether something along these lines was possible or even an already existing feature of Ren'py:

I've got two songs: song A and song B. Song B is the same song as A but slightly different, for example with a few instruments added to create a more cheery or fast-paced mood to it. At some point, song A will be playing and will switch to song B. What I want to do is to make this transition without stopping the song and prevent song B starting from the beginning. Instead, if song A were to be around f.ex. 2:34 when it stops and song B has to start, that song B will start at 2:34 rather than at 0:00. However, because each reader will reach this point at a different time of the song because of varying reading speed, it's of course impossible to put a specific time for B to start at in code.

It wouldn't be a huge deal if this weren't possible, but it would be a more effective and smoother transition.
ImageImageImage

Want some CC sprites?

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: In-song transition; is it possible?

#2 Post by Divona » Wed Feb 08, 2017 9:30 am

Basic way to do it is to have two tracks playing at once in each own channel, and then crossfade between them, if each track has the same length. Also, you could try use "renpy.music.get_pos()" to get current position of track A, and start track B at that position.

But that's all theories, of course, I have yet to put any of this into practice.
Completed:
Image

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: In-song transition; is it possible?

#3 Post by Mammon » Wed Feb 08, 2017 10:25 am

Hm, you mean for example putting song B in the sound channel at volume 0 and make it start at the exact same time as song A, and then set the regular song A to volume 0 and song B to regular volume? Hadn't thought of that (and don't know how to manipulate volume :/ ) but that could work indeed. Transitions might be more preferred by people whose computer wouldn't like more processing power being used, but for most cases it should be a viable alternative indeed. Thanks! And maybe the renpy.m....etc will work for what I wanted indeed.
ImageImageImage

Want some CC sprites?

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: In-song transition; is it possible?

#4 Post by gas » Wed Feb 08, 2017 2:36 pm

You cold add any number of audio channels now, so you can avoid to use the "sound" channel.

Let's figure that.
I'm playing Final Fantasy Tactics, and the normal track is playing. Having reached a drama point in the mission, violins and horns are added to the track.

Ok, I will add a channel called "climax", at 0 volume, that play those instruments accordingly.
With renpy.music.set_volume you can set volume 0 at the begin, and rise the volume of that given channel at 1.0 at the given moment.

As for memory, audio in .ogg is probably the LESS memory leaking thing Ren'Py does. I've done voices, music, sfx and ambient sound all together without any loss (while I've experienced a little delay with mp3).
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

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: In-song transition; is it possible?

#5 Post by Mammon » Wed Feb 08, 2017 3:10 pm

gas wrote:Ok, I will add a channel called "climax", at 0 volume, that play those instruments accordingly.
With renpy.music.set_volume you can set volume 0 at the begin, and rise the volume of that given channel at 1.0 at the given moment.
As for memory, audio in .ogg is probably the LESS memory leaking thing Ren'Py does. I've done voices, music, sfx and ambient sound all together without any loss (while I've experienced a little delay with mp3).
Oh, theory confirmed :D . And good to know the precise command for volume, knowing myself I'd take hours to find it if I find it at all.
ImageImageImage

Want some CC sprites?

Post Reply

Who is online

Users browsing this forum: No registered users