Search Unity

Master Audio - AAA Sound Solution. #1 audio plugin on Asset Store!

Discussion in 'Assets and Asset Store' started by dark_tonic, Jan 28, 2013.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    First of all, let me know why you are doing that. We use the special folders properly unlike most publishers so that compilation time is reduced.

    You are free to move the code in Plugins but you can't move the other 2 folders.
     
  2. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,055
    I use many assets from the asset store in my project. When I import all assets to the root of the project I have a mess project. I have 1287 assets from the asset store. it is the first time I see an asset that uses "Editor Default Resources" folder. Is this mandatory for MasterAudio? It is the only special folder that must be placed at the root of the project? So far I could move all assets without any problem except MasterAudio.
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Just because we are the only one doing things that way does not mean we are wrong :)

    Editor default resources is the correct folder to use for editor only graphics to ensure they do not take up any room in your build. It is a special folder for Unity and we are using it correctly. If you have other plugins that have inspector graphics, that may not be true of those and I would urge you to contact them and ask they do that as well.

    You may read about it here: https://docs.unity3d.com/Manual/SpecialFolders.html
     
    Last edited: Jan 11, 2021
    hopeful likes this.
  4. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,055
    Doing technically correct does not mean you are doing correctly considering customer care. I have software development experience of over 35 years. so far I haven't limited my customers. It is your choice. Because I am a senior developer I could change your code to work in different folders. That means It is possible.

    Do you remember the first release of Facebook SDK. They did the correct thing, they were not wrong. Do you remember the result? You may search for it. :)
     
  5. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    What would be the recommended way of using footsteps synced to animation events? I’d like footsteps to always be in sync with my players and enemies animations, but I’d like to take advantage of MA’s organisation of sounds, easy layer/tag detection for different types of ground, etc. What would be the best way to handle using animation events?
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    I am considering customer care because I am ensuring I don't take up extra room in your build. I'm doing it the original way intended for those folders. There may be another way, but if it's works properly there's no impetus for me to change it. You are actually the first person I've explained this to that is still pushing back. We have 18,000 users. I've had maybe 5 people ask about this ever.

    I've been in software professionally for 21 years. My choice was to research and do things correct instead of putting everything in Assets like everyone else, and educate people - including other asset developers - so that more do the right thing. Unfortunately it hasn't caught on, but I'm sticking to my guns. That's the way I roll.

    Your Gizmos may also be broken, we use that special folder as well.

    Yes I remember Facebook SDK. They changed everything later. That upset me as I had already a lot of code written for the first Facebook SDK.

    -Brian
     
    Last edited: Jan 11, 2021
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    You can play a sound from an animation event (or anything else Event Sounds script does), but you'll lose all the functionality of Footstep Sounds and would have to code that yourself, i.e. tag and layer detection.

    You can read about Code-Triggered Event 1&2 here for more info.
     
  8. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,055
    No problem Brian. I suspended trying Master Audio for now. It is not life saver for my current projects. I hope Unity will force all assets as a package one day and everything will be tidy.
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    It appears as a package file when downloaded from the Unity Asset Store already (same Import package dialog). So I'm not sure what you mean by "force all assets as a package".

    -B
     
  10. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Ah, so I could write my own footstep script that detects the layer or tag of the floor on a footstep animation event, but should I use ActivateCodeTriggeredEvent1 to trigger the script which would then somehow trigger the sound, or should I use my own animation event to trigger the ActivateCodeTriggeredEvent1 (and pass the sound group into event sounds to determine which type of footstep sound is played?)
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    I would say write your own script and add a switch case for the layer/tag and in each "case" you call MasterAudio.PlaySound3DAtTransform, it's a 1-liner if all you want to do is play a sound. No point to get Event Sounds involved unless you want to do other things that it does without writing code.
     
  12. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,055
    I mean packages that appear in the packages (Like TextMeshPro), not under assets. In that way, the only game developer uses assets area and special folders. It is unity bad that designed shared unique special folders like Gizmo and Editor Default Resources folders. Assume different asset publishers use those folders and they use files with the same name. The last import will override the previous one. Asset store packages import all files to the Assets folder. There should be isolated are for external assets, I should be free in my development area. There should not be conflicts. Because I Iove freedom in my development area I do not use any asset that has restrictions. Also, I don't use assets that have no namespace in the scripts. I hope it is clear now. Facebook SDK problem was; they used all asset area like it is their project. After you import your SDK there was over 10 folder in your root. After developers complaint, they designed their asset to use a few folders. Assets area is for game developers :)
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Understood, and that's why you use folders in the special folders, i.e. EditorDefaultResources/DarkTonic/MasterAudio, so that files with same name don't matter. I think namespaces should be required! You are right about that.

    Yes, Assets is for your scripts, not plugins. Too bad most publishers still put code there to slow down compilation time. The documented place for "code that doesn't change" is Assets/Plugins, which we use.

    If Unity makes us use Package Manager, so be it. Glad to be doing what is recommended at all times.
     
    Last edited: Jan 11, 2021
    hopeful likes this.
  14. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    If I wanted to play sound groups so that multiple footstep sounds could be used, not only variations of sounds but also different groups for different ground tags (wood, sand, water, etc) would this be using
    MasterAudio.PlaySound3DAtTransform
    or
    MasterAudio.PlaySound
    ? So far, I'm working on something like this:
    Code (CSharp):
    1.     public Transform Player;
    2.     private Mover Mover;
    3.     private Collider GroundCollider;
    4.  
    5.     void Start()
    6.     {
    7.         Mover = Player.GetComponent<Mover>();
    8.     }
    9.  
    10.     public void Footstep()
    11.     {
    12.         GroundCollider = Mover.GetGroundCollider();
    13.      
    14.         if (GroundCollider.tag ==  "Floor")
    15.         {
    16.             MasterAudio.PlaySound(string "footsteps", float 1f, float? pitch, float delaySoundTime, string variationName);
    17.         }
    18.     }
    (And yes, a switch case would be nicer, but I'm just prototyping with if's right now ;) )
     
  15. NEPS

    NEPS

    Joined:
    Jul 8, 2015
    Posts:
    12
    Hi, new user of the network audio plugin...I am using the Opsive PUN package causes serious errors when I drop photon folder into Plugins. Any workaround for that?
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    I think you'd want to play it at the location of the Transform?

    So try MasterAudio.PlaySound3DAtTransform method, where you will need to pass the Transform. If your game is 2D sound then yes you got it right.

    Also, instead of hard-coding the Sound Group name, make a variable of string with SoundGroup attribute so that you can play that Sound Group in the code and get to select it in the Inspector from a dropdown.

    i.e.
    Code (csharp):
    1.  
    2. [SoundGroup]
    3. public string flootFootstepSound;
    4.  
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    I did that just 2 weeks ago and it worked perfectly. Please follow the instructions in the Readme. What do you mean Opsive PUN package? PUN is written by Photon, not Opsive. Opsive writes 3rd Person Controller.
     
  18. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Wow, thanks! So, this is working nicely:
    Code (CSharp):
    1.  
    2. public class FootstepSounds : MonoBehaviour
    3. {
    4.     public Transform Player;
    5.     private Mover Mover;
    6.     private Collider GroundCollider;
    7.    
    8.     [SoundGroup]
    9.     public string floorFootstepSound;
    10.    
    11.     void Start()
    12.     {
    13.         Mover = Player.GetComponent<Mover>();
    14.     }
    15.    
    16.     public void Footstep()
    17.     {
    18.         GroundCollider = Mover.GetGroundCollider();
    19.        
    20.         if (GroundCollider.tag ==  "Floor")
    21.         {
    22.             MasterAudio.PlaySound3DAtTransform(floorFootstepSound, this.transform);
    23.  
    24.         }
    25.     }
    26.  
    27. }
    28.  
    And the best way of adding other sounds such as sand, water, etc would be to add more [SoundGroup] vars to reference other groups, and repeat the same if statement (or convert to switch case preferably) for each different sound?
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Exactly :)
    And yes I'd change that if statement to a switch / case statement.
    Code (csharp):
    1.  
    2. switch (GroundCollider.tag) {
    3.      case "Floor":
    4.          // do stuff.
    5.      case "Water":
    6.         // do stuff
    7. }
    8.  
     
    Zebbi likes this.
  20. NEPS

    NEPS

    Joined:
    Jul 8, 2015
    Posts:
    12
    PUN Multiplayer Add-On | Opsive

    I am not a coder but it seems they map their PUN files differently
     
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Never heard of it. You're going to need to contact Opsive and ask what all folders need to be moved into Plugins to get that to compile. I'm not claiming compatibility with that product, just the core Photon ones.

    Furthermore, ask him why he isn't putting all the code files into Assets/Plugins in the first place where they belong (per Unity).

    Thanks,
    -Brian
     
  22. NEPS

    NEPS

    Joined:
    Jul 8, 2015
    Posts:
    12
    This looks like only problems... possible for a refund?
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    It could be fairly simple, please contact Opsive for a solution. Since I have no familiarity with that product I can't assist. If he can't assist, you can ask for a refund. However, Opsive is one of the best in customer service so I believe he'll get you fixed in no time flat.

    Refunds are approved through emails to support@darktonic.com. You must include your Asset Store invoice PDF file so we can verify.

    Thanks,
    -Brian
     
  24. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Ah, so I could write my own footstep script that detects the layer or tag of the floor, use a Footstep and ActivateCodeTriggeredEvent1
    Perfect, thank you, really appreciate the quick and helpful support! One last question! For reusing this script for many enemies (as well as the player) over many scenes, would the group reference using an inspector variable be the best approach, or should the script find its own groups by name? (Maybe even the groups should somehow be project based rather than scene based, if this is possible?)
     
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Yes you could ActivateCodeTriggeredEvent1, but that's only if you want to do more than just play a sound. Otherwise just play the sound with the Master Audio API 1-liners.

    You could use your script for many enemies and instead of publicly exposing the variable, have it look up Sound Group names per Scene from a static GameManager script of something.
     
  26. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Whoops, the forum reposted my old message at the top, sorry about that! That method sounds interesting using my own game manager script, the sound group name lookup would be a simple string search on Start or similar, I assume?

    Thanks again for answering all these beginner questions of mine!
     
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Ha ok, yeah you could fire it off from Start or Awake or OnSpawned if you use a pooling plugin.
     
  28. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,271
    I have a question. I want to set up my sound group such that when I tell it to play, it will not play by some random %.

    Now, I can see there is probability to play % for each variation, but there doesn't seem to be a way to do this per group.

    If this is possible how do I go on about setting it up? I could ofcouse do this on my own script but it would be super nice to be able to do this through Master Audio, so I don't have to worry about that and organize such setting in one place.
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    It sounds like you want a "silence" variation, which simply has no audio clip. You can assign it an appropriate weight to get the overall percentage you want.
     
  30. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,271
    Oh i see. So i add variation by adding dummy audio clip and then remove reference to the audio clip inside audio source? If variation doesnt have the clip assigned to it, will it silently igonre it then?
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Yeah. You obviously can't drag a nothing clip. So just click the blue clone button to copy another variation, then delete the audio clip.
     
  32. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Sorry again to be a pain, just want to finish this idea off! Okay, so the group names are stored in the name of the child object of the Master Audio object (or is there some other way the name of the group is stored?)
    upload_2021-1-12_16-19-50.png

    In this case, footsteps is the name of the group and the children of that are the variations? Presumably I'd just rename 'footsteps' to 'floor' or 'sand' if I wanted to rename the group? I could perhaps OnStart/OnAwake find 'footsteps' by tagging the group child objects and searching by name or more appropriately write a script that keeps track of every sound group I'm using in the game (since I don't *think* master audio has a master reference of all sound groups used in the scene? If so, I could just grab the groups from that)

    And finally, would I be replacing...
    Code (CSharp):
    1. [SoundGroup]
    2.     public string floorFootstepSound;
    Or perhaps leaving it at Type In and setting it by name somehow through the script?
    upload_2021-1-12_16-25-30.png

    Hope that makes sense!
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    You can always use the "Type In" yes.
    *Currently*, all Sound Groups are children of the Master Audio object, b

    But the next update will allow you to create "Bus Folders" so that's not going to be reliable. Regardless, the children of Sound Group are always Variations.

    Master Audio does have a list of all Sound Groups, it has to, to play the sound. This is what the property drawer uses, it's not the internal list which is private.
    Code (csharp):
    1.  
    2. var allGroupNames = MasterAudio.Instance.GroupNames;
    3.  
     
  34. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Not sure how good this is, but technically as long as my footstep sound groups are named the same on every scene (floor, sand, water, etc), this should technically work?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using CMF;
    5. using DarkTonic.MasterAudio;
    6.  
    7.  
    8. public class FootstepSounds : MonoBehaviour
    9. {
    10.     private Mover Mover;
    11.     private Collider GroundCollider;
    12.  
    13.     private string floor = "footsteps";
    14.  
    15.     void Start()
    16.     {
    17.         Mover = transform.root.GetComponent<Mover>();
    18.     }
    19.  
    20.     public void Footstep(AnimationEvent evt)
    21.     {
    22.         GroundCollider = Mover.GetGroundCollider();
    23.    
    24.      
    25. if (evt.animatorClipInfo.weight > 0.5){
    26.      
    27.             switch (GroundCollider.tag)
    28.             {
    29.             case "Floor":
    30.                 MasterAudio.PlaySound3DAtTransform(floor, this.transform);
    31.             break;
    32.             }
    33.         }
    34.     }
    35.  
    36. }
    37.  
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Correct. You could use a different Master Audio or Dynamic Sound Group Creator in each Scene and that would be fine. I forgot to mention, if you don't need to do anything with the return value, use the "AndForget" method.
    i.e. PlaySound3DAtTransformAndForget.
     
    Zebbi likes this.
  36. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    Thank you, you've been super helpful with this I really appreciate it, works perfectly now!
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Any time :)
     
    Zebbi likes this.
  38. LandePlage

    LandePlage

    Joined:
    May 21, 2016
    Posts:
    21
    Hey. I'm using Master Audio v4 in a Unity 2019.4.16f1 project. Every time I make certain changes, like deleting a variation, it seems to get stuck in a constant loop. I have to click at a very specific time to get out of it.

    Is this a known issue? Will I lose all my Sound Groups if I update Master Audio?
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    It's something I have fixed a few times. Unity keeps changing how prefabs work. Are you are the very latest Master Audio because I fixed that again very recently?

    Is your Master Audio a prefab?
    How exactly did you delete the Variation?
    Were you in project view, prefab view or Hierarchy?

    You will not lose anything if you update.
     
  40. LandePlage

    LandePlage

    Joined:
    May 21, 2016
    Posts:
    21
    Yep, it's a prefab with between 100 and 200 sound groups, and I was editing the prefab itself (prefab view). It's not the latest. It says "v4.0" at the top in the inspector. We're gonna try updating, although we figured out that editing a prefab instance in the hierarchy and then hitting "Apply changes" circumvented the issue.
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    You need to update to make sure I didn't fix the issue. I most likely did.

    You may no longer able to edit the prefab though after the update. You can edit Scene object and apply changes though.
     
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    FYI, I had spent a couple weeks trying to get "Bus Folders" working since a few people requested it. I got pretty far but ultimately there are far too many bugs due to the way Unity has implemented nested prefabs and what you have to do in code to make sure it works every way whether it's a prefab or not, so I've removed it from the backlog and we will not be adding this feature.

    -Brian
     
  43. LandePlage

    LandePlage

    Joined:
    May 21, 2016
    Posts:
    21
    We managed to update without issues, and the issue is still there when editing the prefab directly - but editing a prefab instance and then hitting "override" works well. Another option is to temporarily disable "Auto save".

    Quick question; Do sound groups have to be direct children of the Master Audio parent object or can they be nested inside empty child objects? I want to use empty child objects to sort sounds, since I have to scroll around a lot at the moment when editing sound groups.

    Edit: Just tested, and this does not work. Throws an error.
     
    Last edited: Jan 29, 2021
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Yes, Sound Groups have to be children of the Master Audio game object. I don't understand why you'd be scrolling around. The solution is in fact to not use Hierarchy to find Sound Groups, but the powerful filters in the Master Audio Mixer. Bus Filter, Sort by Bus, Text Group Filter, etc.

    What is "auto save"? Show me. Anyway, show me how to reproduce what you're seeing. What version of Unity again?
     
  45. cyangamer

    cyangamer

    Joined:
    Feb 17, 2010
    Posts:
    215
    Hi,

    Apologies if this is simple, but is there a way I can use a different Master Audio object in each scene? Currently when a new scene is loaded after a current scene with Master Audio, the new scene's Master Audio object is deleted. And since the old scene is unloaded, that leaves me with no Master Audio objects when the level loads.

    I know I can use the persist across scenes option, but then I'd need to change my setup to either use Dynamic Sound Groups, or load all my sound groups into that one Master Audio object.

    Is there a way around this?
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Not sure I understand what you're saying about loading a new Scene. There can only be 1 Master Audio game object at any time, since it's a singleton. The new one is destroyed if the old one is persisting, but shouldn't be otherwise. If you're loading multiple Scenes, I have no experience with that workflow, so I'm not sure. Please elaborate.

    Most likely best to use DSGC's. Do not load all Sound Groups into one giant MA unless it's manageable.

    -B
     
  47. cyangamer

    cyangamer

    Joined:
    Feb 17, 2010
    Posts:
    215
    Yes I use Additive scenes for better scene management. I have a menu scene, then a loading scene, a game scene, and a game level scene. There is an MA object in the menu scene and in the game scene. When a level is selected from the menu, the loading scene is loaded, then the game scene is loaded, and then the game level is loaded additively on top. Finally, the menu is unloaded, and then the loading scene is unloaded.

    It sounds like for scenes loaded additively, DSGC is what's needed.
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    Correct you can only have one master audio game object even if it is in a previously loaded additive scene so you really don't have any choice.
     
  49. NEPS

    NEPS

    Joined:
    Jul 8, 2015
    Posts:
    12
    Hi, just into implementing phase of the multiplayer package and I have a few questions:
    Just to be sure there are really only 2 ways (scripts) that are used for multiplayer:
    Mechanim State Sound on Animation in Animator Controller and Event Sounds Script, is this right?

    I ask this since I am using Playmaker alot and see and installed the other actions which seem extensive. But they don't apply in my situation since I am using Multiplayer, is that right? If this is the case would it be too much to ask to make a playmaker action for the Event Sounds Script multiplayer? I don't see one for this and Opisve uses their own event system (which I have an action for) so this would be ideal. Thank You
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,350
    You are correct. The 2 Mechanim scripts plus Event Sounds are the only Multiplayer-enabled scripts.

    The way to use Playmaker for multiplayer audio is simple. You only use the "Master Audio Fire Custom Event" Playmaker Custom Action, and then place Event Sounds scripts in the Scene that listen for that Custom Event and are multiplayer-enabled so can do anything. No, they don't interact with Playmaker at all, but they respond to it.

    There is no way to make the Event Sounds into a Playmaker thing. It does many dozens of actions, and is MonoBehaviour event driven. Nothing to do with Custom Actions.
     
    NEPS likes this.
unityunity