Aligning Sound Effect with 18-Frame Character Animation

Hi!

I'm using the plugin "GALV_CharacterFrames" to extend my player-character animation to 18 frames. I would like to play a sound effect on the 9th frame every time the animation cycles. Is there a way to do this?

Thanks for your help!

Blaise St Mary
I would like to play a sound effect on the 9th frame every time the animation cycles. Is there a way to do this?
Create your very own new plugin addon 🙂
Easily in just 3 simple steps.
  1. Alias the updatePattern function of the Game_Player object.
  2. Then check the pattern for the correct index (starts at 0)
  3. If it matches then play the sound🙂
Example:
Spoiler: Game_Player.prototype.updatePattern Aliased Function
Code:
var _gp_uPattern_ctb_cf = Game_Player.prototype.updatePattern;
Game_Player.prototype.updatePattern = function() {
    _gp_uPattern_ctb_cf.call(this);
    if (this._pattern === 8){
        AudioManager.playSe({name: 'Attack3', volume: 100, pitch: 150, pan: 0});
    }
};

Save as .js in plugins folder and enable in the plugin manager (below Galv's of course) 🙂
Happy Game Making!
That should work as needed for ya 😉
Easily in just 3 simple steps.
  1. Alias the updatePattern function of the Game_Player object.
  2. Then check the pattern for the correct index (starts at 0)
  3. If it matches then play the sound🙂
Example:
Spoiler: Game_Player.prototype.updatePattern Aliased Function
Code:
var _gp_uPattern_ctb_cf = Game_Player.prototype.updatePattern;
Game_Player.prototype.updatePattern = function() {
    _gp_uPattern_ctb_cf.call(this);
    if (this._pattern === 8){
        AudioManager.playSe({name: 'Attack3', volume: 100, pitch: 150, pan: 0});
    }
};

Thank you!

I've been developing a game without any knowledge of coding, unfortunately. So I don't completely understand your response. But I appreciate the info!
Thank you!

I've been developing a game without any knowledge of coding, unfortunately. So I don't completely understand your response. But I appreciate the info!
No prob. Okay well in that case, I went ahead and made it for you 🙂
CTB_GALVCharacterFrames_Addon.js: Click Here to Download
Spoiler: Plugin Manager Example Settings
1580568383356.png
No prob. Okay well in that case, I went ahead and made it for you 🙂
CTB_GALVCharacterFrames_Addon.js: Click Here to Download
Spoiler: Plugin Manager Example Settings
Wow! Awesome! Will try it out soon and report back. Thank you so much!
Wow! Awesome! Will try it out soon and report back. Thank you so much!
No prob. Sounds like a plan. Let me know how it goes for ya 🙂
No prob. Okay well in that case, I went ahead and made it for you 🙂
CTB_GALVCharacterFrames_Addon.js: Click Here to Download
Spoiler: Plugin Manager Example Settings
Working perfectly! Can't thank you enough! :LZSexcite:

Now my character has a heartbeat pulse.
Working perfectly! Can't thank you enough! :LZSexcite:

Now my character has a heartbeat pulse.
Woooo! That's awesome!!! 🙂
No prob. Happy Game Making!

There is many more features I could add, let me know if you need anything else.
Tech. Notes:
everything in that version is an 'eval' statement except the filename.
this means you can do this like this like use $gameVariables.value(1) to determine patternIndex, volume, pitch, pan. Could be modified to eval the filename too, I just decided not too...

Extra side note:
If using your game online, using an unmodified version of Galv's Character Frames will break your game due to the filename system."%" is not valid in URL filenames due to the percent-encoding
Woooo! That's awesome!!! 🙂
No prob. Happy Game Making!

There is many more features I could add, let me know if you need anything else.
Tech. Notes:
everything in that version is an 'eval' statement except the filename.
this means you can do this like this like use $gameVariables.value(1) to determine patternIndex, volume, pitch, pan. Could be modified to eval the filename too, I just decided not too...

Extra side note:
If using your game online, using an unmodified version of Galv's Character Frames will break your game due to the filename system."%" is not valid in URL filenames due to the percent-encoding


Thanks! I don't plan to use the game online, but that's good to know. :LZSsmile:

So I did notice that sometimes when the character moves extremely fast the heartbeats sound muddled. So it would great if there was a plug-in command to turn it off and on as needed.

(Maybe that's what you meant by this: "...use $gameVariables.value(1) to determine patternIndex, volume, pitch, pan." But I don't quite get how this works.)

Thanks, again!
Thanks! I don't plan to use the game online, but that's good to know. :LZSsmile:

So I did notice that sometimes when the character moves extremely fast the heartbeats sound muddled. So it would great if there was a plug-in command to turn it off and on as needed.

(Maybe that's what you meant by this: "...use $gameVariables.value(1) to determine patternIndex, volume, pitch, pan." But I don't quite get how this works.)

Thanks, again!
No prob 🙂

Hmm.. yeah kind of could use that method to fix that but could you clarify "muddled"?

... guessing you are meaning the sounds are probably overlapping ... which is what I was afraid of.
...because it doesn't stop the original sound or speed up the sound to match the speed of the frames (could be though that could technically be done with the pitch setting)

I chose not to stop sound effects before playing the patternIndex sound because that would have stopped all sounds even ones not related to the player...

...using something like this in combination with mine could remedy the issue...
No prob 🙂

Hmm.. yeah kind of could use that method to fix that but could you clarify "muddled"?

... guessing you are meaning the sounds are probably overlapping ... which is what I was afraid of.
...because it doesn't stop the original sound or speed up the sound to match the speed of the frames (could be though that could technically be done with the pitch setting)

I chose not to stop sound effects before playing the patternIndex sound because that would have stopped all sounds even ones not related to the player...

...using something like this in combination with mine could remedy the issue...
Yes, by muddled I mean overlapping.

The Chaucer plug-in looks promising. Will try soon and let you know if it does it.

Thanks!
No prob 🙂

Hmm.. yeah kind of could use that method to fix that but could you clarify "muddled"?

... guessing you are meaning the sounds are probably overlapping ... which is what I was afraid of.
...because it doesn't stop the original sound or speed up the sound to match the speed of the frames (could be though that could technically be done with the pitch setting)

I chose not to stop sound effects before playing the patternIndex sound because that would have stopped all sounds even ones not related to the player...

...using something like this in combination with mine could remedy the issue...


So I tried the Chaucer plug-in without success. It wasn't clear to me if the script-event should read:

AudioManager.stopSeAt('heartbeat2')

or

AudioManager.stopSeAt 'heartbeat2'

or

AudioManager.stopSeAt heartbeat2

or

AudioManager.stopSeAt(heartbeat2)

...so I tried them all. None of them seemed to work. Using an event-touch event so the character sound effect is playing when the character passes over the event.

I think at best the Chaucer plug-in will stop the sound effect for a second. Then as the amination cycles through, I would guess the sound effect will sound again once it reaches the designated frame. In other words, my guess is it would probably only stop the sound effect for a few frames.

An on-and-off switch for your plug-in would probably a lot more effective. :LZSangel: If you have time to look into it.... :LZSjoy:

Thanks so much!

If there's a donation function on this site, I would be happy to make a donation.
No prob 🙂

Hmm.. yeah kind of could use that method to fix that but could you clarify "muddled"?

... guessing you are meaning the sounds are probably overlapping ... which is what I was afraid of.
...because it doesn't stop the original sound or speed up the sound to match the speed of the frames (could be though that could technically be done with the pitch setting)

I chose not to stop sound effects before playing the patternIndex sound because that would have stopped all sounds even ones not related to the player...

...using something like this in combination with mine could remedy the issue...


Update: I did get the Chaucer plug-in to work. But I was right: As soon as the character starts moving again the sound effect plays. So I would have to strategically place events on the map to keep the sound effect off. Which is awkward but doable.


Thanks!
Blaise St Mary
No prob 🙂

Hmm.. yeah kind of could use that method to fix that but could you clarify "muddled"?

... guessing you are meaning the sounds are probably overlapping ... which is what I was afraid of.
...because it doesn't stop the original sound or speed up the sound to match the speed of the frames (could be though that could technically be done with the pitch setting)

I chose not to stop sound effects before playing the patternIndex sound because that would have stopped all sounds even ones not related to the player...

...using something like this in combination with mine could remedy the issue...


Another update: I discovered that even if I set up a string of adjacent event-touch events to turn the sound effect off via the Chaucer plug-in, some audio glitches remain. My guess is that's because the sound effect is starting to play and it's immediately shut off by the script. But it's not shut off fast enough to completely eliminate all the audio.

In other words: In order for the sound effect to be shut off, the sound effect first has to begin to play. Hence, audio glitches.

Thanks!
So I tried the Chaucer plug-in without success.

An on-and-off switch for your plug-in would probably a lot more effective. :LZSangel: If you have time to look into it.... :LZSjoy:

Thanks so much!

If there's a donation function on this site, I would be happy to make a donation.
I gotchoo no worries I will update soon
... stuck at work right now but as soon as I get home I'll update with some extra & helpful features for ya. I'll put it on my itch.io site most likely with an optional donation link. 😉👍

Edit:
@The Prismed Reaper
Updated with a whole bunch of new stuff 😉
A whole new plugin honestly 🙂 Should work with just about any frame patterns (MV's default, Galvs, etc.)
Tech speak:
Oh also the filename is now an eval statement so it needs to be in quotes if using a direct string and not a object/function/variable/etc. 😉
Spoiler: Example Setting
actXiw.png

84WGQL.png
I gotchoo no worries I will update soon
... stuck at work right now but as soon as I get home I'll update with some extra & helpful features for ya. I'll put it on my itch.io site most likely with an optional donation link. 😉👍

Edit:
@The Prismed Reaper
Updated with a whole bunch of new stuff 😉
A whole new plugin honestly 🙂 Should work with just about any frame patterns (MV's default, Galvs, etc.)
Tech speak:
Oh also the filename is now an eval statement so it needs to be in quotes if using a direct string and not a object/function/variable/etc. 😉
Spoiler: Example Setting
actXiw.png

84WGQL.png
Awesome, thank you thank you thank you!
I gotchoo no worries I will update soon
... stuck at work right now but as soon as I get home I'll update with some extra & helpful features for ya. I'll put it on my itch.io site most likely with an optional donation link. 😉👍

Edit:
@The Prismed Reaper
Updated with a whole bunch of new stuff 😉
A whole new plugin honestly 🙂 Should work with just about any frame patterns (MV's default, Galvs, etc.)
Tech speak:
Oh also the filename is now an eval statement so it needs to be in quotes if using a direct string and not a object/function/variable/etc. 😉
Spoiler: Example Setting
actXiw.png

84WGQL.png


Hi, so I donated and downloaded it and I think I understand how to set it up, but I wasn't clear on how to turn it off and on with an event.

Edit: So now I see that the default is not to allow for overlapping sounds...Testing... 🙂

Edit #2: I couldn't get it to work.
PatternIndex.PNG
I attached a screen-shot of my set-up. Maybe I'm doing something wrong.


Thanks!
Hi, so I donated and downloaded it and I think I understand how to set it up, but I wasn't clear on how to turn it off and on with an event.

Edit: So now I see that the default is not to allow for overlapping sounds...Testing... 🙂

Edit #2: I couldn't get it to work. View attachment 133091I attached a screen-shot of my set-up. Maybe I'm doing something wrong.


Thanks!
Hmm...
small update...
...this work?
[RMMV] Character PatternIndex Settings Plugin by ct_bolt
Demo now "playable" on the page too. (up button speeds up the heart, down button slows it down)
Spoiler: Settings used for demo
1580881233025.png

[/spoilers]
...works ok for me but maybe I'm still unsure how it's suppose to play out in your game and all...

...heartbeat sound files I used are attached.
Hmm...
small update...
...this work?
[RMMV] Character PatternIndex Settings Plugin by ct_bolt
Demo now "playable" on the page too. (up button speeds up the heart, down button slows it down)
Spoiler: Settings used for demo
View attachment 133365
[/spoilers]
...works ok for me but maybe I'm still unsure how it's suppose to play out in your game and all...

...heartbeat sound files I used are attached.
The update definitely works. I'll play around with it a bit and update this weekend. Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/aligning-sound-effect-with-18-frame-character-animation.117820/