Easy audio Looping

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English




Ever downloaded a great sound track that you wanted to use in the game, but then you found out it just plays from start to finish, and starts playing again from the beginning?

However, if you listen to some of the BGM's that come with RPG Maker, such as the battle themes, you'll notice that they have the intro part, but then it will just keep playing forever.

This is accomplished through a concept called "looping". Basically, let's say you had a 60 second song, and you wanted the part between 15 and 45 seconds to keep playing. You would specify that at the 15 second mark, you would like to start looping, and at the 45 second mark, you would end looping.

Now, your audio file starts playing from the beginning of the song. Once it reaches the 15 second mark, it will notice that it's entered a loop. It will continue to play until the 45 second mark, where it notices that it's at the end of the loop. Now it goes back to the beginning of the loop, and starts playing the song at 15 seconds again.

Normally, this information is set in the music files themselves. However, with this plugin, you can use a simple spreadsheet to maintain audio loops for all of your music files!

This also means you can create different kinds of loops for the same music file if you wanted to, without distributing multiple copies of the same file.
 
More information and downloads are available at HimeWorks
 
Last edited by a moderator:

RyanBram

Veteran
Veteran
Joined
May 13, 2012
Messages
238
Reaction score
277
First Language
Indonesian
Primarily Uses
RMMV
What?!

This is the plugin that I am thinking about and you just made it?

Very, very awesome. Thank you for making it, Tsukihime.

:D
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
What?!


This is the plugin that I am thinking about and you just made it?


Very, very awesome. Thank you for making it, Tsukihime.


:D
Thanks. I was actually looking at your tutorial yesterday trying to figure out what unit of measure was being used for the loop start and loop duration to get an idea how looping works.


I'm thinking of linking people to that tutorial to show how people usually set up loop points, so they can get a better idea the motivation behind this.


After making this plugin I've created a couple audio profiles for some of the BGM's I've collected and am pretty satisfied with the looping.
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
And what's the difference between using a script to do this and using Audacity to modify looping directly?

At least you could do that in VXA...

EDIT : I meant, how is it easier?
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
And what's the difference between using a script to do this and using Audacity to modify looping directly?


At least you could do that in VXA...


EDIT : I meant, how is it easier?
1. You don't have to download extra software, or figure out how to get it work. This is a big deal for me.


2. You can have multiple looping profiles without having to distribute multiple copies of the same audio file.


3. You can set custom starting points for your songs. Don't want to start at the beginning? Just specify where you want to start. Again, without having to distribute a different audio file.


4. You could potentially share looping data with others easily. Just have them copy it into their own file and they're good to go. You could build entire public libraries of various profiles for different purposes and people can just grab them as needed.


If you are more comfortable using audacity or other audio editors for editing your music, then this probably wouldn't make too much of a difference. However, for those that are like me who just can't figure out how to use audacity and are satisfied with just looking at when the loops begin and end and writing some times down, it works just as well.
 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
Yeah, perhaps I'll stick with Audacity...

But, great job for making this!

I know lots of people will find it useful :)

(It does not mean I think it's useless, I just do it faster with Audacity)
 

Rito

Veteran
Veteran
Joined
Jun 29, 2015
Messages
107
Reaction score
50
First Language
French
Audacity supports only one loop unlike the plugin.

This was the reason for my request.

 

Thanks you !

 


But there comes a question.

Is it possible to start a new music (in command plugin) at the same point as the old?

 

For example, the first music has some instruments and the 2nd is a little more dynamic.

 

A bit similar as the mario kart wii menu:

Part 1:



2nd part: https://youtu.be/fN2dJP0WLDQ?t=44s

3rd part: https://youtu.be/fN2dJP0WLDQ?t=1m6s

etc.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
I will provide audio crossfade as a separate plugin
 

ZcheK

ZcheK
Veteran
Joined
Feb 22, 2016
Messages
96
Reaction score
22
First Language
English
Primarily Uses
Is it possible to stop the music looping with a plugin command and have it continue? This would be awesome as you could create a crescendo where the player slowly walks towards something and the music develops with them, they used this a lot in FFVII.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
Is it possible to stop the music looping with a plugin command and have it continue? This would be awesome as you could create a crescendo where the player slowly walks towards something and the music develops with them, they used this a lot in FFVII.



I have updated the plugin to v1.2 with support for loading and removing audio profiles while the BGM is playing.


This means that if you load an audio profile and it applies to the current BGM, the current BGM will begin looping (it will not change the initial offset however).


Removing an audio profile will be done the same as before as a plugin command:


remove_audio_profile PROFILE_NAME


The difference is if you remove an audio profile it applies to the current BGM, the current BGM will revert to the default loop info if applicable. So for example, if the profile created a custom 5 second loop, removing the profile will take out that loop and your BGM will continue to play as if the custom loop never existed.


You can apply and remove audio profiles at anytime. Remember that you can have multiple profiles for the same BGM defined in your data file, however only one profile can be active at anytime (I am not sure what happens if you load multiple at the same time)
 
Last edited by a moderator:

omegadaxer

Veteran
Veteran
Joined
Jul 23, 2016
Messages
35
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hi Hime~!


I've followed your instructions, but each time I actually run the plugin command, I get an error that reads: "Cannot read property 'folder' of undefined"


I'm not sure if this is something I'm doing wrong or not, and I've tried starting from scratch and following your instructions multiple times, still to the same error. I'm currently just using your Battle1 template to test it, so literally sticking exactly to the manual here. Any ideas?


Thanks!
 

TheGoldenW

Villager
Member
Joined
Oct 1, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Extremely late to the party here, but I think the link to the template on the page linked is broken. It sends me to a page with nothing but the text Unknown Library. This isn't supposed to happen, right?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,798
Reaction score
5,352
First Language
English
Primarily Uses
RMVXA
Extremely late to the party here, but I think the link to the template on the page linked is broken. It sends me to a page with nothing but the text Unknown Library. This isn't supposed to happen, right?
Just tried it myself and I am seeing the same thing that @TheGoldenW is seeing when clicking the Template link. @Tsukihime
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
Extremely late to the party here, but I think the link to the template on the page linked is broken. It sends me to a page with nothing but the text Unknown Library. This isn't supposed to happen, right?

There doesn't seem to have been an entry for the audio profiles template, so I suspect it was never uploaded at all.

Link has been updated.
 

TheGoldenW

Villager
Member
Joined
Oct 1, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
There doesn't seem to have been an entry for the audio profiles template, so I suspect it was never uploaded at all.

Link has been updated.
Thank you so much for your quick response!
 

TheGoldenW

Villager
Member
Joined
Oct 1, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Tsukihime Can you help me with something? I'm still learning JS so this error message eludes my understanding. I don't want to get too far into the project without figuring this out because it's annoying having to go back in and change completed events. I'm getting this error when I try to do the load audio profile plugin command:
TypeError: Cannot set property 'loopStart' of null
at WebAudio.applyAudioProfile (HIME_EasyAudioLooping.js:286)
at Function.AudioManager.applyAudioProfile (HIME_EasyAudioLooping.js:318)
at Game_System.loadAudioProfile (HIME_EasyAudioLooping.js:234)
at Game_Interpreter.pluginCommand (HIME_EasyAudioLooping.js:338)
at Game_Interpreter.pluginCommand (Irina_AntiAudioDelay.js:124)
at Game_Interpreter.command356 (rpg_objects.js:10508)
at Game_Interpreter.executeCommand (rpg_objects.js:8930)
at Game_Interpreter.executeCommand (Irina_AntiAudioDelay.js:124)
at Game_Interpreter.update (rpg_objects.js:8838)
at Game_Map.updateInterpreter (rpg_objects.js:6115)

I tried showing this to my friend as he knows JS but he is not familiar with the ins and outs of how plugins work in this game so he couldn't figure it out. I'm using RMMV Tune in conjunction to simplify the process as I'm still learning how to do all this. I'm using the Irina Anti-Audio Delay plugin as well because it fixes the audio delay for my game. Do they interfere with this plugin at all? Let me know if you need any more information.
 
Last edited:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
@Tsukihime Can you help me with something? I'm still learning JS so this error message eludes my understanding. I don't want to get too far into the project without figuring this out because it's annoying having to go back in and change completed events. I'm getting this error when I try to do the load audio profile plugin command:
TypeError: Cannot set property 'loopStart' of null
at WebAudio.applyAudioProfile (HIME_EasyAudioLooping.js:286)
at Function.AudioManager.applyAudioProfile (HIME_EasyAudioLooping.js:318)
at Game_System.loadAudioProfile (HIME_EasyAudioLooping.js:234)
at Game_Interpreter.pluginCommand (HIME_EasyAudioLooping.js:338)
at Game_Interpreter.pluginCommand (Irina_AntiAudioDelay.js:124)
at Game_Interpreter.command356 (rpg_objects.js:10508)
at Game_Interpreter.executeCommand (rpg_objects.js:8930)
at Game_Interpreter.executeCommand (Irina_AntiAudioDelay.js:124)
at Game_Interpreter.update (rpg_objects.js:8838)
at Game_Map.updateInterpreter (rpg_objects.js:6115)

I tried showing this to my friend as he knows JS but he is not familiar with the ins and outs of how plugins work in this game so he couldn't figure it out. I'm using RMMV Tune in conjunction to simplify the process as I'm still learning how to do all this. I'm using the Irina Anti-Audio Delay plugin as well because it fixes the audio delay for my game. Do they interfere with this plugin at all? Let me know if you need any more information.

Code:
this._sourceNode.loopStart = this._audioProfile.loopStart;

This line is where it's failing and is called when the audio is being created. It's possible that the other plugin changes the way audio is created.
You can try disabling other audio-related plugins and see if it's a compatibility issue.
 

TheGoldenW

Villager
Member
Joined
Oct 1, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Code:
this._sourceNode.loopStart = this._audioProfile.loopStart;

This line is where it's failing and is called when the audio is being created. It's possible that the other plugin changes the way audio is created.
You can try disabling other audio-related plugins and see if it's a compatibility issue.
I tried disabling every audio related plugin and it's still giving me the error. I tried a couple different things like reconverting the .csv file and reordering the event that's giving me the issue. It either gives me an error or just doesn't work. Have you had other people with issues like this?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,851
First Language
English
I tried disabling every audio related plugin and it's still giving me the error. I tried a couple different things like reconverting the .csv file and reordering the event that's giving me the issue. It either gives me an error or just doesn't work. Have you had other people with issues like this?

Try it in a new project and see if it works. I had used the plugin recently in MV 1.6.2.
I don't think I've seen this error report before.
 

Agronaut022

Warper
Member
Joined
Oct 22, 2020
Messages
2
Reaction score
1
First Language
German
Primarily Uses
RMMZ
Try it in a new project and see if it works. I had used the plugin recently in MV 1.6.2.
I don't think I've seen this error report before.

I tried it out a dew days earlier on MZ had the exact same issue so maybe thats why?
 

Latest Threads

Latest Posts

Latest Profile Posts

Ami
Trying to add my 1st Profile Banner. Now,this is what i want :D
Working on a game related to cats, it's gonna be a passion project and my first game on this new platform. I'm excited!
Is this Profile Banner thing new? Or did I just discovered it now?

Forum statistics

Threads
107,604
Messages
1,030,869
Members
139,710
Latest member
fardan
Top