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.

fmodex audio script looping

hey im using the script in this thread
viewtopic.php?f=11&t=55486&start=30

but my only problem is that he isnt very clear on how to set loop points and how to set the script up (especially if your not good with rgss).

The code to set loop points is :
FMod.bgm_set_loop_points(first, second)
and the code to call the sound is:
def self.bgm_play(name, volume, pitch, position = 0, looping = true)

(i think)

but what im asking is where do you put the code for the loop points and the music properties?
is there an area in the script?
or do you have to have a call script in every single map which has music that has loop points?
and if so what about battles?
 
you can set loop points with this script like a certain amount of seconds in.

so say you have a battle mp3 you want to use and it has an intro then a loop that plays to the end, you can set the loop start and end so it sounds like 1 long mp3 rather than a battle mp3 that stops and starts again.

and what i was looking for is if you are able to customise the bgms individually and if so do you have to use call scrip event or if there is a section in the script which you use to configure because at the moment i cant figure it out.
 
The original poster of the script topic i linked to is sometimes still online here, even though its an old topic. I sent him a pm asking about it a couple days ago and currently waiting a reply. so hopefully he has either not seen the pm in his inbox/forgot to reply. Rather than just not replying, but yeah just incase he doesnt reply i decided to create this to see if it was obvious to anyone else. I mean even in the demo it doesnt have a call script explaining the loops, so if anyone has any information at all id be very grateful if they would be able to post it here. :smile:
 

Atoa

Member

@Near
It's depends, what he wants is to music that loops from an determined part: so the music will have an intro that plays only once.
It's something like this music:
White-Battle04.mid
try hearing this music in the rpg maker sound test or even on an test play.

I would like to know that.
Also how can I set musics to not restart after battle (i know a method of doing that, but it's don't work .ogg)

Yeah, i can figure out that alone, but lately i having a really low time '-'
 
well yeah that is exactly what i was looking for for the battle music play the intro once and dont play it again.

and sorry but what did you want me to do with the mid file? i couldnt really understand your english sorry : /

there is a script in the demo in the topic i linked to called "other classes" or something to that effect which stops the music restart.
 

Atoa

Member

@zornsthorne
test this midi with the rpg maker sound test.
Img17-5.png


You will see (i mean hear XD) that you can set loops in midis without the script.

But i also would like to know how do this with the script so i could do it with .mp3/.wma
 
haha sorry yeah i know how to test the song and i know midis loop but yeah its to use the script to set loop points for mp3s and higher quality formats.

(btw ive been using the program for years so knew what you were saying, i just couldn't understand your english)
:biggrin:

also i think i know what you do now (correct if wrong) you use software to set in loop points and then save the mp3 and now rmxp will read the loop points from mp3's aswell as from midis. if this is correct does anyone know any software that allows you to program loop points into an mp3?
 
Hi.

zornsthorne":1odujpj7 said:
or do you have to have a call script in every single map which has music that has loop points?
and if so what about battles?

Yeah you have to call script whenever you play the song which will loop. I'm aware it's not very convenient, but it'll take some work to allow the script to read mp3 tags and I don't have the time.

For battles you could find the point in the battle script where the battle music is played and add the loop point there. If it's a boss or a battle with special music that's not the default, you might be able to call the loop setting script in the first turn of battle or something.

RMXP only supports MIDI loop points.
RMVX supports MIDI and OGG looping by reading special tags in the OGG (LOOPSTART/LOOPLENGTH).

The Fmod EX script supports loop points for all format, but it's a manual process at the moment. I was planning to do something similar to what RMVX does but never got to it.
 
I actually found out that with your script (maybe you didnt know) that it makes rpg maker xp read embedded loop points in a .wav file type.

(well it does for me)
but really if you are going to edit the script to make it able to read embedded loop points it would probably be better for it to utilise this feature for .ogg files. Because its easier to embed loop points in a .ogg file rather than .mp3 (or maybe i just have found the right software) plus i found out with mp3 there is a slight fraction of a second at the end and the start of the files that make them bad for loops because they make the loop sound off or out of time.

but if you were able/going to utilise the feature to read embedded loop points for .ogg it would make my life allot simpler and im very sure allot of the advanced game designers on this website would be very appreciative aswell.

ps. if not would you be able to reply with what exactly should go into the call script command because everything ive tried yet seems to come up with an error.
 
ive tried that even in the demo you provided and it comes up with an error.

okay now it doesnt : /

well ill get back if it does come up with an error again.

:EDIT:

I found a bug.

i have a parallel process for setting the loop points of the field theme.

call script then erase event.

if you go into battle and come back out there aren't any loop points any more for the field theme.
I tried having it as a parallel process without the erase event so that it would constantly refresh the loop points but
then the bgm sounds stuttery to the point that its incomprehensible.

Is there an easy way around this?
or am i going to have to say put on every feild
call script
turn switch on

then in every battle say turn switch off.


also for the other classes script
is there anyway to turn it on and off ingame?
like disable and enable the script because i really like the memorizing the field music place but im also using a script that i had to input through out the default scripts and when it is turned off the other classes script works fine but when its turned on after the battle no
music at all plays.
 

Atoa

Member

@cowlow
Why, instad of making the user aways having to make an script call to set the loop, you don't create an module that the user can fill with the bgm info (name, format, and loop info), then when the user change the music, the script automatically check this module.

I'm going to do this for my project, you could add this feature to the default system.
 

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