Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Crossfade Music

The subject says it all...

Basically, I'm lookin to see if there is a "crossfading music" script out there anywhere.

For those who dont know what crossfading is, it's where one song transitions smoothly into another song without a line break.


So if anyone knows of a script, or is kind enough to create one (gasp), then reply to me as you can.
 

poccil

Sponsor

I am afraid that's not possible.  Due to the limitations of RGSS, only one music (either BGM or ME) can play at a time.  Even while another BGM is fading out, it will be interrupted when another BGM or ME starts playing.
 
Aww really...?  I was easily able to do a 20 sec fade with a BGM and the starting of another BGS in an event. This basically peforms a crossfade between 2 songs.


@>Text: Mix Music?
@>Show Choices Yes, No
  : When [Yes]
   @>Show Choices: Twist and Scream, No Limit
     : When [Twist and Scream]
       @>Fade Out BGM: 20 sec.
       @>Fade Out BGS: 20 sec.
       @>Play BGM: '213-twist-scream', 100, 100
       @>
     : When [No Limit]
       @>Fade Out BGM: 20 sec.
       @>Fade Out BGS: 20 sec.
       @>Play BGM: 2 Unlimited - No Limit', 100, 100
       @>
     : Branch End
   @>
: When [No]
   @>
: Branch End
@>



Well, if it really isn't possilible in script form... Then I guess I'm stuck with events....bleh...


BTW: I imported the music files seperately, since any of them can be played in both BGM or BGS.
 
sweet little event you got there i would use it but im not really into crossfades they use them on pokemon games but thats all i can really think of them to be usefull for nice event and if its possable in events who knows people do crazy stuff it may actually be possable in script if you can even find a script for it im looking for a script ive tried finding for weeks and i know it has to exist because i saw it once so keep searching :) :D 8)
 
Thats quite the sentence you got there, I was able to read it in one whole breath, whew [jk].  ;D

Yea, the way I see it this shoulld most definately be possible if its possible in a script. I'm mostly interested in getting this because I wouldn't mind incorperating this into an ABS game I have up my sleave. It'd be nice to transition field music into battle music [think of kingdown hearts].

Anyways, thanks again... I really gotta get into scripting so I can stop requesting, since I got no one to help me with my ABS Battle System....echk
 

poccil

Sponsor

I should have explained more clearly.  In theory, it is possible to follow a fade with another music-playing effect, but the fade will be interrupted as soon as another music file plays.  Here is the test I used:
Code:
Audio.bgm_play("Audio/BGM/001-Battle01.mid")
80.times do # Waits for 2 seconds
  Graphics.update
end
Audio.bgm_fade(5000) # Fades for 5 seconds
40.times do # Waits for 1 second
  Graphics.update
end
Audio.bgm_play("Audio/BGM/002-Battle02.mid")
80.times do
  Graphics.update # Waits for 2 seconds
end

For one second after the music's fade begins, its fade can clearly be heard to stop as the second music begins.  I'm not sure whether that is your intent, though.
 
Well thats the thing, I notice in your script that you are playing music from the same source [BGM and BGM], which yes ,in your theory will make the fade useless and the crossfading effect indecisive.

This is why I sacraficed the BGS section in order to be able to do the crossfade effect. The difference with BGS is that it can be played during BGM, hince it usually being used for background sound effects like bird chirping, and ocean breezes, etc.

Basically, this is why I used both BGM and BGS in my lil' event example.

In any case, I'll be sure to tamper with your script example though, thanks again.
 
how about instead of cross fading you start to fade one and instead of fading the other one in your just start it wouldnt that make the same thing as crossfade only in a diference in the sound variations
 
One thing that you could do is have one sound fade out and then, when the first song has completely faded out, fade in the second song. I think this would work best if you had ambient music and a BGS in the background to make the transition less noticeable.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top