MBS - Sound Emittance

● ARCHIVED · READ-ONLY
Started by  Masked  20 posts View original ↗




  1. m6BRKBq.png
    MBS - Sound Emittance (1.2.1)
    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


    Credits and Thanks
    - Masked, for creating
  2. 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.
  3. Definitely do what Killuki said, that would truly make this system complete!

    Masked said:
    ...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 :)
  4. 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!!!
  5. After adding the plugin and starting a new game I get this error

    http://imgur.com/AOzoYMj

    Is this something on my side?

    Screenshot (25).png
  6. ragnorak6608 said:
    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/
  7. @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)
  8. Masked said:
    @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 ;)
  9. @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)
  10. Awesome! You are putting some great work into this script, it will be a must have for our game :)
  11. 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.
  12. 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.
  13. No effect plugin after use, can provide an example? thank you
  14. Logan C. said:
    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 >.<

    Logan C. said:
    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/

    lmd0013 said:
    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.
  15. Everything works fine now, thank you.
  16. Yes. Looks good now! Thank you very much!
  17. Hi, I'm having the same problem as Imd0013. I used these event notes:  [IMG]https://scontent-gru2-1.xx.fbcdn.net/hphotos-xpt1/v/t1.0-9/10012435_1049335765128000_3665305962232666515_n.jpg?oh=e5a7f0f47486d49ba11c5c28ef89f32e&oe=56FD150D[/IMG]

    And nothing happens when I approach the event. All the others plugins are deactivated. 
  18. 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
  19. Meguido said:
    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';
  20. Logan C. said:
    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 ?