Having trouble changing BGM pitch seamlessly

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I have a mini game where I want the speed of the BGM to increase once or twice, then go back to normal/default speed after the mini game ends.

I've tried just Play BGM with a different pitch, which always makes it start over.

I've also tried a number of versions of the following:

Script: @bgm = RPG::BGM.last : @bgm.pitch = 110 : @bgm.replayIn this case I don't THINK it starts over, but it fades out and there's a brief pause before it starts playing at the higher pitch.Does anyone know what I need to do to eliminate the fade/pause?
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
Using ".replay" will start the BGM from the beginning I believe. Try using ".pos" to grab the song position/sample (i think) as a reference.

For example, my own project uses a BGM-changer script within battles (Dying Battle BGM by DiamondPlatinum3) when a party member dies or someone's HP gets low (to a fast tempo'd version of the same song I made in audacity) When it activates, the current normal BGM fades, and then starts the tempo version from the same ".pos" point (it's pretty accurate too)

So I do not know how to currently remove the fade (might be a ruby code dealing with music libraries or w/e) but yeah use .pos instead of .replay if you do not want it to restart. Look at the script how DP3 has it set up if you need a reference.
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Ho I don't remember who was the scripter but Mc tricky requested a script who allow to make some mix of song ( by using a new song) 

maybe you can ask to mc tricky wich script and study a little this one for know what you can do?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If it's faster, isn't the same 'pos' point going to be at a different part of the track though?
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
For a 125% tempo version, when the change happens it jumps a few samples ahead, so it's not too accurate. Never tried (or I don't remember trying) with a normal pitch version to see if it's perfect.

Let me see how a pitch version would be instead (for the sake of testing this, not like I want to use it)

Something I do remember researching long ago was on any way to modify the .pos position for more accuracy, but I couldn't find anything.

Edit: Yeah using Pitch is a lot more accurate cause I believe it's the same exact Sample size, unlike Tempo'd tracks. (I'm no music expert by a long shot) But too bad I need Tempo for what I want.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yeah, pity you can't just change tempo without changing pitch too. However, for my situation, the higher pitch is still good.
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
Pitch and tempo are different changes (but are related mathematically, but that's another story)

Tempo (time-stretch): Changes the sound to play at faster or slower speed than original, without affecting the sound pitch.
Pitch (key): Changes the sound pitch or key, without affecting the sound tempo or speed.

RPGMaker ruby music library does not support Tempo-changing, only volume and pitch (as far as I know)

Or read this:

TempoLet’s start with the easy one. The tempo of the track is the speed of the track. When you listen to music in different genres, you’ll notice that some are slow and some are fast. Music in the same genre tend to all be at a similar tempo.Recall from a previous tutorial that music is broken up into beats, bars and phrases. The tempo of a track is measured in the number of beats per minute, shortened down to BPM. You may have heard of hardware or software BPM counters, these simply measure the beats per minute of your track so you know the tempo it is playing at. Trance tends to be between 130-140 BPM.Why is this important? Well, if you’re going to mix 2 tracks together there will be a point when both tracks are being played to the public at the same time. If they aren’t at the same tempo (therefore the same BPM) then the beats won’t line up nicely with each other and it will sound awful.PitchIn music theory, pitch represents the perceived fundamental frequency of sound. In other words, the BFG would have had a low frequency voice and hence a low-pitched voice. Somebody who has inhaled a helium balloon will have a high frequency voice and hence a high-pitched voice.Basically in simplest terms, both making a song sound "sped up" but Tempo doesn't make your song sound chimpmunk-ish which is why I use it.
 
Last edited by a moderator:

Nathan Frost

... only the world's greatest Secret Agent.
Veteran
Joined
Sep 23, 2014
Messages
243
Reaction score
74
First Language
English
Primarily Uses
What about saving the position of the track first, stopping the track right away without a fadeout, then play the current track at the higher tempo? I don't think you'd have a sudden fade after adding that step. I might be wrong though, it is only 9:50am where I'm at.
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
What about saving the position of the track first, stopping the track right away without a fadeout, then play the current track at the higher tempo? I don't think you'd have a sudden fade after adding that step. I might be wrong though, it is only 9:50am where I'm at.
RPG Maker does not naturally support Tempo change, and that change is a completely new music file with a different Sample size (music length/time) meaning (as I said before) it will not sound like a proper transition al all. The fade is also default in the way RPG Maker stops playing BGMs.

Back to the original subject, we need to find out how to prevent the fade.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'll give it a go this afternoon Nathan, but I kind of expect the same results. In the code I have above, there's nothing that specifies a fadeout, but it still happens. I also just tried BGM.play (as opposed to replay) and the fadeout/gap was there.


I thought RPG Maker's changing pitch also changed the speed? I AM happy with the pitch changing - it's meant to be a "time is running out, you better hurry up" prompt. Just need to get rid of that little gap.


I'll post back with results of that test.
 

amerk

Veteran
Veteran
Joined
Mar 13, 2012
Messages
1,433
Reaction score
495
First Language
English
Primarily Uses
Not to drive this off topic, but this is one of the things I've always felt the maker needs in the next editor:

1. The ability to create looping points in a track.

2. The ability to create events based on a specific point in the track.

3. The ability to change the pitch without restarting the track.

Number 3 for sure. Some good thoughts in this thread that I'll try and put to use myself.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top