Changing BGM pitch without replaying?

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
There's a part of my game where night suddenly falls, and I want the pitch of the BGM to fall along with it. But, I have no idea how to do it. I'm pretty sure a script can fix it, but I couldn't make heads or tails of what I found when I looked it up.

Knowing how this works would also help other parts of my game since music is such an integral part.
 

Vox Novus

Knight of Whispers
Veteran
Joined
Mar 18, 2013
Messages
3,293
Reaction score
2,473
First Language
English
Primarily Uses
N/A
just use a change background music command and set it a lower pitch of course how you use this will depend on how exactly night is falling in your game.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
just use a change background music command and set it a lower pitch of course how you use this will depend on how exactly night is falling in your game.
WITHOUT replaying. I want the music to continue on as normal and have the pitch decrease, not start the song over.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,353
Reaction score
2,549
First Language
French
Primarily Uses
RMVXA
I know that it has been tried, I remember a thread somewhere on this forum about it.

But it eventually didn't lead to a solution. The way sounds are handled is inside hidden classes of the engine.

I may be wrong, but I don't think you'll be able to do it with Ace.

Edit: something close was found here.
 
Last edited by a moderator:

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Okay so I tested it using the script at the top



But I got this error message when I tried playing it:



I don't get why... That IS the title of the song.

 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
I've just tried the code and it works for me.  I am wondering about that apparent line break in your script call.  I can get the whole call on to one line.  Is there a reason why yours is split?  As it appears to have split in the middle of the name, that could be what is throwing the whole thing off.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I've just tried the code and it works for me.  I am wondering about that apparent line break in your script call.  I can get the whole call on to one line.  Is there a reason why yours is split?  As it appears to have split in the middle of the name, that could be what is throwing the whole thing off.
What do you mean? When I copy "Audio.bgm_play("Audio/BGM/14 Abandoned Water", 80, 60, Audio.bgm_pos)" into the script box it automatically text wraps.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
I have the updated version of Ace and perhaps it has a wider script box than the earlier version.  

The reason I was asking is that I have seen several posts in different queries which warn that splitting the line can cause problems, and that one cannot rely on the automatic wrapping to get it right.  I know that there is a work around, but don't remember what it is.

I think you will have to wait until someone who does know reads this thread.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,353
Reaction score
2,549
First Language
French
Primarily Uses
RMVXA
I can confirm that on the earlier version (1.01a) it breaks at this position.

Edit:

It works if you manually break the line like this:

Audio.bgm_play(
"Audio/BGM/14 Abandoned Water", 80, 60,
Audio.bgm_pos)
 
Last edited by a moderator:

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
The latest version has bigger window indeed, but still the same issue can happen.

If your title is too long and it's wrapped (even automatically) it still counts as next line and doesn't know how to combine them.

If your title will be short enough to have:

Audio.bgm_play("Audio/BGM/Abandoned",100, 120, Audio.bgm_pos)Then it will work. If a line is ending with a 'comma' then it will continue reading the code as normal.

I tried putting

Audio.bgm_play("Audio/BGM/Super_Long_Title_Of_The_Soundtrack_I_Mean_BGM_That_Will_Not_Fit_Into_The_Window_And_Will_Cause_Crash", 100, 120, Audio.bgm_pos)(It was automatically wrapped, due to no space.)

And it crashed.

Try using shorter BGM titles if they're not fitting.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I can confirm that on the earlier version (1.01a) it breaks at this position.

Edit:

It works if you manually break the line like this:

Audio.bgm_play(

"Audio/BGM/14 Abandoned Water", 80, 60,

Audio.bgm_pos)
Hmm it works but there's a pretty noticable pause before it starts playing, so it's still got the same problem as the song starting over.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
Then if it is not possible to prevent that, perhaps you have to be a bit sneaky and disguise it.  You don't say how the transition from day to night is caused, but if it is evented, then playing around with something like this might work.

Use a suitable SE or ME with the command for night to fall.  For that sound it could be a sort of tinkling that often goes with starlight, or anything you want.  As it is playing, it will cover over the pause in the pitch change in the BGM.  Possibly the order of event commands would be

Play SE

Change pitch

command to change to night.
 

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
Hmm it works but there's a pretty noticable pause before it starts playing, so it's still got the same problem as the song starting over.
I was also thinking about this - and have no idea how to prevent that.

It's like the BGM is starting form 0 volume and goes to the defined volume from script call.

To be honest I got curious myself - let's say I have a battle, where the less boss's HP is - the higher pitch of the BGM - tense and stuff.

As the OP it'd like to change the pitch without any pause, would that be possible?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
@Rikifive

That's actually quite a different question as it is for a battle scene. Let's stick to one question at a time.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
@Rikifive

That's actually quite a different question as it is for a battle scene. Let's stick to one question at a time.
Wouldn't the same script apply to a battle?

The night falls by an event that the player walks over, it just tints the screen.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
Then if you to try what I suggested above put it in the event on that tile.

And Rikifive's is a bit of a different question because it needs to be tied in with keeping track of the boss's HP etc.
 
Last edited by a moderator:

Rikifive

Bringer of Happiness
Veteran
Joined
Jun 21, 2015
Messages
1,441
Reaction score
680
First Language
Polish
Primarily Uses
Other
I just gave an example - I know how to make that stuff (keep track of the boss's HP) - that's obvious. (okay, for me at least)

I asked:

As the OP it'd like to change the pitch without any pause, would that be possible?
That's the only question in my post - There's nothing about 'how to setup that in battle' etc.

Why I was referring to 'battle scene'? Because I thought, that without that example/argument I'd be asked "But why do you need this, can't you just use that workaround?"

Koi is right - I want to know absolutely the same thing, nothing more.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Then if you to try what I suggested above put it in the event on that tile.

And Rikifive's is a bit of a different question because it needs to be tied in with keeping track of the boss's HP etc.
I did put it on the tile, it doesn't matter when or where I put the script, there's always a pause. I have a BGS of spring peepers that starts at that point, but it doesn't do a very good job of covering up the obvious gap.

And it's not really different, just take the script and put it in the battle events, set the condition according to the enemy's HP. The problem is the script itself. And I know nothing about coding :/
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
Well, my honest opinion is that cabfe is probably right and this cannot be done in Ace. 

The only other workaround that I can think of is this:

Event command fade out BGM over a couple of seconds so that it is not an abrupt stop

Same event do a script call to fade in the BGM with the lower pitch.

The exact timing will need some experimenting.

Tthere is no event command to fade in music, so you will have to use the script "Audio Fade In"  by rpgmakersource.  I am having huge problems loading pages on the site, so I can't help you find a link, but if you search the VXAce script forum using audio and fade as your search terms, you should find it fairly easily.  Alternatively, you should find it on the freebies page of their website at rpgmakersource.com

EDIT

here is the link

http://forums.rpgmakerweb.com/index.php?/topic/40032-audio-fade-in-easy-to-use-bgm-bgs-me/?hl=%2Baudio+%2Bfade
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,995
Messages
1,018,208
Members
137,775
Latest member
yj8570
Top