Change current BGM Pitch

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,216
Reaction score
1,078
First Language
Spanish
Primarily Uses
RMMV
I'd like to know if there is a way of changing the pitch of a current BGM without reproducing it again, just like how the volume works. Is there a quick script call for it?

It occurred to me something like:

$bgm.pitch = nor

Audio.bgm_play(fName, volume, new_pitch, $bgm.pos)But I dunno the 'Audio' class variables/methods to tell :(

Thanks!
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It seems like it's part of the inner workings of the engine... One of those hidden things.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Audio.bgm_play(filename[, volume[, pitch[, pos]]])

and

Audio.bgm_pos

So I am thinking it would be something like this Audio.bgm_play(filename[, volume[, pitch[, Audio.bgm_pos]]]).

Haven't tested it though check the Help for more information by searching Audio.
 
Last edited by a moderator:

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,216
Reaction score
1,078
First Language
Spanish
Primarily Uses
RMMV
Oh, I didn't know there was documentations for the hidden Ruby classes! I'd try to fiddle around it a bit :D
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
They do have, just there's not much info though specially on some other topics. Like we don't know if bgm_play calls some other high level commands or if it's already calling something on the lower level.


Been working with the audio class for a while now, never thought of doing that... XD
 
Last edited by a moderator:

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,216
Reaction score
1,078
First Language
Spanish
Primarily Uses
RMMV
Audio.bgm_play("Airship", 80, 60, Audio.bgm_pos) isn't working :/ I wonder why? It says 'File Airship couldn't be found' :(
 
Last edited by a moderator:

Capitán

kind of a big deal
Veteran
Joined
Jul 9, 2013
Messages
572
Reaction score
145
First Language
Engilsh
Primarily Uses
RMMV
Where are you running that code?

and they're not too hidden:

Code:
Audio.bgm_play(fName, volume, pitch, pos) Audio.bgs_play(fName, volume, pitch, pos) Audio.me_play(fName, volume, pitch) Audio.se_play(fName, volume, pitch)
 
Last edited by a moderator:

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Audio.bgm_play("Audio/BGM/Airship", 80, 60, Audio.bgm_pos)

Here you are :)
 

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,216
Reaction score
1,078
First Language
Spanish
Primarily Uses
RMMV
Audio.bgm_play("Audio/BGM/Airship", 80, 60, Audio.bgm_pos)

Here you are :)
Haha I just found it out a minute ago xD! Thanks! I can miss the most stupid mistake sometimes xD!

It doesn't transition as smoothly as I wanted though :/ Oh well... this will have to do x)
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@Yuuta - hidden in a sense that they're not on the script editor, and also that we don't know what other methods those methods call.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Yea I'm not quite certain how to increment it for smoother transition as you would need to have access to the current pitch. Maybe do something like this:

i = 100 #the default pitch that the bgm is played ato = 60 #the pitch you wantwhile i > oAudio.bgm_play("Audio/BGM/Airship", 80, i, Audio.bgm_pos)i -= 1 #increase this number for quicker transitions or keep small for slow transitionsendEdit just tried it and wont work in an event maybe a script though (freezes the player).
 
Last edited by a moderator:

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,216
Reaction score
1,078
First Language
Spanish
Primarily Uses
RMMV
@Sarlecc: Thanks for trying anyway :p !
 

VideoWizard

Dragon Kingdoms Series producer
Veteran
Joined
Mar 13, 2012
Messages
510
Reaction score
418
First Language
English
Of note, you can set pitch to anything between 0-255 by this method. Not sure what happens if you try values outside this range. So, if you want slower and deeper than 50, or faster and lighter than 150, this is the only way I know of. 0 just won't play anything, and numbers around 20 are a deep bass.

EDIT: >450 just equals 100, as does 0 and below. So, it won't crash. I think the fastest you can go is 450 and the slowest is 1. That's still much more capability, and for those using Audacity, they can speed the songs up even more for file size savings, and just run pitch near one at all times. 1 sounds like it doesn't work, but listen carefully... it sounds more like rumbles of thunder or a monster at that low.

Numbers 20 and below are GREAT for a Metroid-type or deep dungeon or horror game. Imagine the battle music going up with Haste, and down with Slow. Endless possibilities...
 
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