MUSH Audio Engine - Spatial Audio/Voice Acting/New Channels/etc.

@Nerine Yes, of course! You can share the fix here for everyone to see. It might take while before I release an official fix since the end of my university semester is approaching.
Yes! That would be great!
Here's the plugin.
Here's the plugin.
Thank you very much!
@MushroomCake28 Could you please fix the bug that when player returns to Main Menu, the BGM is still playing?
@MushroomCake28 Could you please fix the bug that when player returns to Main Menu, the BGM is still playing?
If you're referring to the Title screen, that bug should be fixed in the latest version if I recall correctly. If not I'll fix it in the next version.
I am so happy you have put the time in to add a spatial audio system to RPG Maker!!! I am new to RPG Maker, but this will be the first plugin I try to use A LOT of. Thank you for thinking of the music!
I am so happy you have put the time in to add a spatial audio system to RPG Maker!!! I am new to RPG Maker, but this will be the first plugin I try to use A LOT of. Thank you for thinking of the music!
Thanks! Glad I could help! I would recommend to sometimes check this thread since I do have some bugs to iron out. I'll post updates from times to times.
@MushroomCake28 If you're referring to the Title screen, that bug should be fixed in the latest version if I recall correctly. If not I'll fix it in the next version.
The bug still occurs.
Description:
BGM assigned to any channel still plays when player returns to the Title.
Steps to reproduce
1. Open the RPG Maker MZ
2. Make event with Plugin Command: MUSH_Audio_Engine, Play BGM
3. Assign any bgm file, channel, Auto Remover = true, Interrupt = Pause
4. Test the game
5. Trigger the event
6. Return to the Title menu
7. Notice that BGM is still playing (Reproduction 5/5)
Expected Result
When player returns to the Title, the BGM fade out.
The bug still occurs.
Description:
BGM assigned to any channel still plays when player returns to the Title.
Steps to reproduce
1. Open the RPG Maker MZ
2. Make event with Plugin Command: MUSH_Audio_Engine, Play BGM
3. Assign any bgm file, channel, Auto Remover = true, Interrupt = Pause
4. Test the game
5. Trigger the event
6. Return to the Title menu
7. Notice that BGM is still playing (Reproduction 5/5)
Expected Result
When player returns to the Title, the BGM fade out.

To stop all Mush BGM/BGS when going to title screen, try adding the following code snippet to the end of the plugin. I added this for the MV conversion, I have not double checked the MZ source code to verify the commandToTitle() function works the same, but I assume this will work for MZ too:

JavaScript:
//==============================================================================================================
// * 5.05 : Scene GameEnd
//==============================================================================================================

Mush.alias.Scene_GameEnd_CommandToTitle = Scene_GameEnd.prototype.commandToTitle;
Scene_GameEnd.prototype.commandToTitle = function() {
    Mush.alias.Scene_GameEnd_CommandToTitle.call(this);
    AudioManager.stopAllMushBgm(0);
    AudioManager.stopAllMushBgs(0);
};

Is there a way to modify a volume of already running track?

Good question. There's no dedicated way, and I'm not sure calling the play Mush BGM to play the same track with the same channel will work (it might work, but it'll probably throw an error).

Someone was asking about this functionality for the MV conversion, and it does seem like a good functionality to have. I haven't really looked into this yet but apparently calling the play command again with new parameters doesn't do it. No pressure, but is this something you're looking to add in a future update? I'd rather implement/convert your solution than figure it out myself, of course!
To stop all Mush BGM/BGS when going to title screen, try adding the following code snippet to the end of the plugin. I added this for the MV conversion, I have not double checked the MZ source code to verify the commandToTitle() function works the same, but I assume this will work for MZ too:

JavaScript:
//==============================================================================================================
// * 5.05 : Scene GameEnd
//==============================================================================================================

Mush.alias.Scene_GameEnd_CommandToTitle = Scene_GameEnd.prototype.commandToTitle;
Scene_GameEnd.prototype.commandToTitle = function() {
    Mush.alias.Scene_GameEnd_CommandToTitle.call(this);
    AudioManager.stopAllMushBgm(0);
    AudioManager.stopAllMushBgs(0);
};





Someone was asking about this functionality for the MV conversion, and it does seem like a good functionality to have. I haven't really looked into this yet but apparently calling the play command again with new parameters doesn't do it. No pressure, but is this something you're looking to add in a future update? I'd rather implement/convert your solution than figure it out myself, of course!
Sure, it wouldn't be that hard. My university semester ends next week so I'll probably release an update shortly after.
Released version 1.06
  • Made the Game End command stop all MUSH BGM and BGS.
  • Made the Return to Title event command stop all MUSH BGM and BGS.
  • Updated how the ME works (when it stops MUSH BGM and BGS).
  • Fixed the bug that triggered an alert after a battle on a map with spatial audio (by updating how the ME works).
  • Fixed a bug that made it so the game didn't update the spatial objects on load sometimes.
  • Added a developer mode parameter. When turned OFF, alerts will no longer appear in-game.
  • Added a Plugin Command that allows to change the volume of a MUSH BGM and BGS.
@Featherbrain I used your portion of the code for Scene_GameEnd. I mean, that's exactly how I would have done it. Thanks!
@Nerine @ToshaAngel The battle alert bug shouldn't occur anymore. Plus, I added the dev mode parameter, so when you turn it off it will just not notify the player of any error (some errors don't actually cause crashes and the game can continue running just fine).
@m03271996 There's now a plugin command that allows you to modify the volume of a MUSH BGM/BGS easily.
@Username0987 The bug where BGMs and BGSs continue playing after returning to the Title Screen is now fixed.
@Arpy_G If you haven't grabbed this new version I would suggest updating! The battle bug is now fixed! (it wasn't game breaking but it was annoying).
I don't know if it's a bug but when you use "transfer player" event to move player across the map (Not to a different map) everything gets reset and you have to set up audio again.
I don't know if it's a bug but when you use "transfer player" event to move player across the map (Not to a different map) everything gets reset and you have to set up audio again.
Ahh yes, I did make using the Transfer player command reset all the BGMs/BGSs. I didn't think of the possibility to transfer to the same map lmao.
A neat idea for the future:
Make so when event ID is set to 0, it uses event than runs the command as a source of the sound.
@MushroomCake28 Hey, I get this error when using bgs spatial audio with moving events on iOS browsers (tested both dynamic and not, though if event isn't moving it doesn't show up)
1624111124265.png
@MushroomCake28 Hey, I get this error when using bgs spatial audio with moving events on iOS browsers (tested both dynamic and not, though if event isn't moving it doesn't show up)
View attachment 192685
That's strange. Unfortunately I have no idea what that means. It seems like there was an error while trying to load the file, like it took too long or something. Does the game still run normally? Cause if it breaks the game, I have no idea how to fix it, and I don't really have an iOS system to test. Perhaps an iOS dev might have more insight then me for this problem.
That's strange. Unfortunately I have no idea what that means. It seems like there was an error while trying to load the file, like it took too long or something. Does the game still run normally? Cause if it breaks the game, I have no idea how to fix it, and I don't really have an iOS system to test. Perhaps an iOS dev might have more insight then me for this problem.
If I had to guess I'd say it's because some calculation functions that you're using are not available on iOS.
If I had to guess I'd say it's because some calculation functions that you're using are not available on iOS.
I doubt it. All my calculations use standard math functions available on all platforms. To play the audio, I use the same API as RPg Maker does. Maybe there's memory restriction on mac, that might cause it. I really have no idea xD
It's really a great plugin, easy to use, and powerful, but I have a small question. I don't know if it's the good place to ask, because it's not a bug related thing.

I have a map, with a river. I want the player to hear a spatial sound of a river flowing when it's near to it. But, the river is wide, and goes across the map, one event isn't enough to cover the whole river.

I can then use multiple event, following the river's ledge, with it's one channel each, maybe. I don't know, maybe the sounds will overlap if I do that.

I was wondering, if it was possible with this plugin, to setup a spatial sound, based on a region tag ?

If my question is not on the right topic, I'm sorry. I'm new here.
It's really a great plugin, easy to use, and powerful, but I have a small question. I don't know if it's the good place to ask, because it's not a bug related thing.

I have a map, with a river. I want the player to hear a spatial sound of a river flowing when it's near to it. But, the river is wide, and goes across the map, one event isn't enough to cover the whole river.

I can then use multiple event, following the river's ledge, with it's one channel each, maybe. I don't know, maybe the sounds will overlap if I do that.

I was wondering, if it was possible with this plugin, to setup a spatial sound, based on a region tag ?

If my question is not on the right topic, I'm sorry. I'm new here.
I don't have a feature to set the audio based on the region id unfortunately. I thought of that, but I wanted to keep the plugin as low on the processor as possible, so I didn't want it to check for areas on a lot of different tiles. What I personally do for rivers that cover a good portion of the map, I just set an origin point event for the audio in the middle of the river at an interval of 3-4 tiles. If you don't like the slight volume variation, you can increase the strength parameter. A higher strength parameter will make it so the volume doesn't decrease much when you're close to the source, but the further away the faster it will decrease.

Here's an example:
1625517114902.png

Original thread: https://forums.rpgmakerweb.com/threads/mush-audio-engine-spatial-audio-voice-acting-new-channels-etc.128741/