MBS - Sound Emittance

 Masked 

Assistant
Veteran
Joined
Oct 28, 2015
Messages
83
Reaction score
249
First Language
Portuguese
Primarily Uses
RMMZ





MBS - Sound Emittance (1.1.3)
by Masked


 

Introduction
This plugin allows you to set sound emittances for events, and for the first time in RPG Maker (as far as I know) with 3D sound positioning (thanks WebAudio /o/).
That's nice for creating sound effects on rivers, fire, people talking, etc.
 

Features
- 3D sound positioning, that is, you can notice from which direction the sound is coming from;
- Allows you to set a sound radius so it will be limited to a specific range;
- Automatically assumes the file extension based on built-in methods (specifically AudioManager.audioFileExt);
- Works with any kind of sound effect (BGM, BGS, ME, SE...) regardless of it having an automatic loop or not;
- Volume and pitch adjustment.
 

How to use
Just save the plugin Raw code in a .js file on your game's js/plugins folder. Further information on plugin help.
 
 
Script
GitHub: https://github.com/MaskedRpg/JS/blob/master/mv/MBS_SoundEmittance.js
MV Plugins: http://mvplugins.com/plugin/Masked/MBS%20-%20Sound%20Emittance
 
 
Credits and Thanks
- Masked, for creating
 
Last edited by a moderator:
Joined
Mar 9, 2013
Messages
343
Reaction score
85
First Language
Spanish
Primarily Uses
N/A
Can we use regions instead of events? Let's say that I want to use this on the worldmap, when I go closer to the sea, I start hearing the sound of the waves, and the sound becomes stronger while I'm approaching to the sea. Placing a lot of events around the sea in a map of 256x256 shouldn't be necessary if we can use regions instead.

To avoid overwrite functions from other plugins that uses regions, the region id should be specified in the Map Notes with comment tags, for example.... <soundregion 1 seawave>?

That could be an extra feature for this plugin :)

EDIT: Oh, also specify a sound to a Tile ID, so we can specify directly the sound of a specified tile, for example sea tile. I guess that my request can be a bit difficult to make, because I guess that a single tile would act as one sound source, so having several tiles would play the sound several times at once, but maybe this can be solved doing something, like.... detect if the tiles are not separated, and when the tile is not separated, instead of act as a single sound source, acts as a whole area being a sound source automatically, or something like that.
 
Last edited by a moderator:

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
506
Reaction score
421
First Language
English
Primarily Uses
RMMV
Definitely do what Killuki said, that would truly make this system complete!

...for the first time in RPG Maker (as far as I know) with 3D sound positioning (thanks WebAudio /o/).
There was a script in RMXP that did this, but it wasn't 3D, it was just left and right stereo. Now, does your script do complete 3D sound, or can you only hear things coming from the right and left specifically?

For instance, in that other script, if something is diagonally in front of you to the right, you would just hear it in the right speaker. On yours, would you hear it dynamically if it were exactly where it was positioned?

Also, is the direction of sound based on where the character is facing, or just in regards as to where the sprite is on the map? I hope it's the second one, because the first would be almost sickening if you spun around with multiple noises surrounding you.

Great job on the script though! Just asking a few questions :)
 

Drake Aran

Veteran
Veteran
Joined
Sep 14, 2014
Messages
10
Reaction score
1
First Language
Italian
Good job with your script! I don't really think that leaving events to marry regions, so to speak, would be a good idea. I'm afraid it could become too laggy too easily.

Just wanted to say that apparently it doesn't play .m4a files but only .ogg, which is a shame since .m4a files are the only ones multiplatform in MV, if I'm not mistaken.

Another thing I'd like to point out is that there was a cool script for ACE very similar to yours but with a few additional parameters that could be adjusted (i.e. volume and pitch), and it would be awesome if you could find the time to add those options to your script as well. Here's the script I am talking about, by Lemony: http://forums.rpgmakerweb.com/index.php?/topic/1714-sound-emitting-events/

In any case, thank you very much for making and sharing this. I've been waiting for this!!!
 
Last edited by a moderator:

Drake Aran

Veteran
Veteran
Joined
Sep 14, 2014
Messages
10
Reaction score
1
First Language
Italian
After adding the plugin and starting a new game I get this error

http://imgur.com/AOzoYMj

Is this something on my side?
You probably used a file not supported. RPG Maker MV only works with .ogg and .m4a audio files, even though the script apparently doesn't read .ogg.

EDIT: Nevermind. Yesterday it was working properly, but today I got the same error as yours. In my case, there is conflit with MOG's Picture Gallery script, even though I don't know why. I'm not even using sound comments in the map where I call Mog's Picture Gallery script. Also, in other maps everything apparently works fine. Best of luck fixin it mate ;)

These are the script calls I make to Mog's script:

$gameSystem.enable_picture(1)$gameSystem.enable_picture(3)$gameSystem.enable_picture(4)$gameSystem.enable_picture(5)$gameSystem.enable_picture(10)And I get the same Type Error as Ragnorak6608.

This is the console debug:

TypeError: Cannot read property 'list' of undefined at Game_Event.list (rpg_objects.js:8436) at Game_Event.setupSEmittance (/G:/Videogames/Project2/js/plugins/MBS_SoundEmittance.js:143) at Game_Event.setupPage (/G:/Videogames/Project2/js/plugins/MBS_SoundEmittance.js:136) at Game_Event.refresh (rpg_objects.js:8572) at Game_Event.erase (rpg_objects.js:8565) at Game_Map.eraseEvent (rpg_objects.js:5539) at Game_Interpreter.command214 (rpg_objects.js:9787) at Game_Interpreter.executeCommand (rpg_objects.js:8895) at Game_Interpreter.update (rpg_objects.js:8803) at Game_Map.updateInterpreter (rpg_objects.js:6080)Hope it helps.

Finally, here's a link to Mog's script: https://atelierrgss.wordpress.com/rmv-picture-gallery/
 
Last edited by a moderator:

 Masked 

Assistant
Veteran
Joined
Oct 28, 2015
Messages
83
Reaction score
249
First Language
Portuguese
Primarily Uses
RMMZ
@Killuki Zaoldyeck: I'll try implementing those, I'm afraid it'll take quite a while, though.

 
@Prescott: Indeed it was just left and right stereo, now I fixed it and it's complete 3D x)
And yes, it's based on the characters positions.

 
@Drake Aran: Maybe, using regions could mess up the whole thing if it was used the wrong way, I can only hope people will know how to use it and will not fill the map with hundreds of region marks >.<

And it doesn't really play only .ogg, it automatically detects the best extension alternative for your device by using the default methods, specially this one:

AudioManager.audioFileExt = function() { if (WebAudio.canPlayOgg() && !Utils.isMobileDevice()) { return '.ogg'; } else { return '.m4a'; }};So, if you can play Ogg and are using a mobile device, the game will choose .ogg, if not, it will choose .m4a.
Added the volume and pitch options, thanks for the advice o/


@ragnorak6608: Ooops, my fault, hope I fixed it x)
 

Drake Aran

Veteran
Veteran
Joined
Sep 14, 2014
Messages
10
Reaction score
1
First Language
Italian
@Drake Aran: Maybe, using regions could mess up the whole thing if it was used the wrong way, I can only hope people will know how to use it and will not fill the map with hundreds of region marks >.<

And it doesn't really play only .ogg, it automatically detects the best extension alternative for your device by using the default methods, specially this one:

AudioManager.audioFileExt = function() { if (WebAudio.canPlayOgg() && !Utils.isMobileDevice()) { return '.ogg'; } else { return '.m4a'; }};So, if you can play Ogg and are using a mobile device, the game will choose .ogg, if not, it will choose .m4a.

Added the volume and pitch options, thanks for the advice o/
Congratulations for being so quick to fix bugs and to add features to your script! Kudos to you! But I'm afraid I must insist on the "it doesn't read .m4a" thing, because if I put only a .m4a file inside my audio folder, the script doesn't read it (nothing is being played). It only plays if I put a .ogg file in said folder. The method/function you posted made it all clear, and I believe the problem is that your "if statement" doesn't takes into account the eventuality that only a .m4a file is present. You shouldn't just evaluate if the system CAN play .ogg, but also if an .ogg file exists at all, because if it doesn't, your if statement sends the .ogg file into play even if it doesn't actually exist, and any .m4a file that could be present gets automatically ignored. Hope that helped ;)
 
Last edited by a moderator:

 Masked 

Assistant
Veteran
Joined
Oct 28, 2015
Messages
83
Reaction score
249
First Language
Portuguese
Primarily Uses
RMMZ
@Drake Aran: Oh, I see, changed it and now it checks if the .ogg file exists before using it and uses .m4a otherwise.


Also, I added a parameter to choose when to use HRTF or equalpower panning with the effects, it's also possible to change it in-game with a simple script call:

Code:
MBS.SoundEmittance.Param.useHRTF = (true | false)
 

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
506
Reaction score
421
First Language
English
Primarily Uses
RMMV
Awesome! You are putting some great work into this script, it will be a must have for our game :)
 

Logan C.

Veteran
Veteran
Joined
Oct 25, 2015
Messages
73
Reaction score
20
First Language
English
Is there a way to turn off a sound? And a way turn it on again, in the same event? I tried to change an event's page for that, but when i changing it back - sound doesn't play again.
 
Last edited by a moderator:

Logan C.

Veteran
Veteran
Joined
Oct 25, 2015
Messages
73
Reaction score
20
First Language
English
I found a bug - if your sound radius covers an event which transfers a player - you can still hear the sound even if the map changed.
 

lmd0013

Villager
Member
Joined
Sep 9, 2012
Messages
6
Reaction score
0
First Language
Chinese
Primarily Uses
No effect plugin after use, can provide an example? thank you
 

 Masked 

Assistant
Veteran
Joined
Oct 28, 2015
Messages
83
Reaction score
249
First Language
Portuguese
Primarily Uses
RMMZ
Is there a way to turn off a sound? And a way turn it on again, in the same event? I tried to change an event's page for that, but when i changing it back - sound doesn't play again.
Are you sure you did everything right? I tried here and everything went ok >.<

I found a bug - if your sound radius covers an event which transfers a player - you can still hear the sound even if the map changed.
Indeed it wasn't stopping the sound after the event was disposed. Fixed it o/

No effect plugin after use, can provide an example? thank you
Well, you have to setup the events you want to emit sound by putting comments like this on it:

<s_emittance: bgs/Drips><s_e_radius: 5><s_e_pitch: 70><s_e_volume: 85>You can find more details in the plugin help.
 

Logan C.

Veteran
Veteran
Joined
Oct 25, 2015
Messages
73
Reaction score
20
First Language
English
Everything works fine now, thank you.
 

gabrielnegreira

Villager
Member
Joined
Dec 9, 2015
Messages
16
Reaction score
1
First Language
Portuguese
Hi, I'm having the same problem as Imd0013. I used these event notes:  


And nothing happens when I approach the event. All the others plugins are deactivated. 
 

Meguido

BP&RGSS3 Lover
Veteran
Joined
May 4, 2014
Messages
35
Reaction score
8
First Language
Spanish
Primarily Uses
Same problem here.

Can't hear anything. Tried with the 4 lines in a comment, also in separate comments and also adding only the first two (as pitch and volume are stated as optional).

Also had to turn to False "Use HRTF" because got a weird delay in sound and music in the title screen and when it finally started to play it was like pretty bad quality :S
 

Logan C.

Veteran
Veteran
Joined
Oct 25, 2015
Messages
73
Reaction score
20
First Language
English
Same problem here.

Can't hear anything. Tried with the 4 lines in a comment, also in separate comments and also adding only the first two (as pitch and volume are stated as optional).

Also had to turn to False "Use HRTF" because got a weird delay in sound and music in the title screen and when it finally started to play it was like pretty bad quality :S
I guess it's because you using an "ogg" sound file. The plugin works with "m4a" only.

I can give a tip how to change it on "ogg", but it's better to wait for Masked fix.

Open the plugin and change this line

return filename + '.m4a';with this

Code:
return filename + '.ogg';
 

Meguido

BP&RGSS3 Lover
Veteran
Joined
May 4, 2014
Messages
35
Reaction score
8
First Language
Spanish
Primarily Uses
I guess it's because you using an "ogg" sound file. The plugin works with "m4a" only.

I can give a tip how to change it on "ogg", but it's better to wait for Masked fix.

Open the plugin and change this line

return filename + '.m4a';with this

return filename + '.ogg';
Hey thank you for your help! But i'm using default sounds (just copy/pasted the example code provided with the bgs/Drips)

and in the folders they're on ogg + m4a so it should work ?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

1 million messages is approaching. The end is near! M1M is like Y2K, but forum based. It's a bug that's gonna delete all attachments when we hit 1 mil messages. At least with Y2K we had warning....
If you manage to make a game that people play for hours, then reminding them to take a break gives that “This game cares about me” feeling and also lowers chance of burnout with your game.
Well... things are slow. I'm still waiting to get called back into my position, but I do have some time to design my games.
Suddenly wanna hear this ...
The best way to end your day? Cuddle your kitten! :LZSproud:

Forum statistics

Threads
103,428
Messages
999,224
Members
134,956
Latest member
robinsmith
Top