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. MoonBeam91

    MoonBeam91

    Joined:
    Jan 28, 2021
    Posts:
    35
    Question for triggering Sounds for animations events without Animator !! :D

    So I am using Animancer, which enables me to use animations without using Animator, I access animation events through the animation clips and run the sounds through code. I am unsure how Master Audio can help with that
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Excellent!
     
  3. ExobotsDeveloper

    ExobotsDeveloper

    Joined:
    Feb 16, 2022
    Posts:
    9
    Hi guys ! nice tools, i have a question, when change variation create mode to resources nad move all sound in the resources folder, my tree map not change, and it should change, given that there are many sounds that are only called in certain situations and I am interested in keeping the memory load stable in terms of sound, I do not want the clips that possibly will not be called to be loaded, any help me please?
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    What is a tree map? I'm not sure what you're asking for the rest of your question. Resource files are only loaded just before they're played. Also, you can have a Sound Group with some Variations as Audio Clip and some as Resource File if they're played less often.
     
  5. Dist0

    Dist0

    Joined:
    Oct 28, 2017
    Posts:
    15
    Is possible to use MasterAudio for making offline records ?
    Also is possible to make multi-track recording with it (not master output, but each mixer groups separatly ?)
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No and no. It doesn't record anything.
     
  7. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Hey there, I'm trying to use
    GlideSoundGroupByPitch()
    on a looping SoundGroup initially triggered by an AmbientSound component on a gameobject in my scene, but it doesn't have any effect. Not getting any console errors or messages either.

    Perhaps I'm misunderstanding the purpose or usage of the function? I'm trying to smoothly raise the pitch of a SoundGroup to a higher pitch over a specified duration. Is this the right way to go about that? Does my problem relate to my using an AmbientSound component instead of something else?

    Thanks!
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You're right, it got broken.

    Around line 4527 in MasterAudio.cs, delete this code:
    Code (csharp):
    1.  
    2.   if (completionCallback == null) {
    3.                 if (completionCallback != null) {
    4.                     completionCallback();
    5.                 }
    6.  
    7.                 return; // only need to set up the object for MA Update if completion action.
    8.             }
    9.  
     
    Jshh likes this.
  9. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Oh, that was an easy one. Works great now. Thanks!
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem!
     
  11. Doomchecker

    Doomchecker

    Joined:
    Apr 5, 2021
    Posts:
    109
    Hi there,
    I am trying to set up an ambient sound but it does not play the sound.
    It worked on the old version but after installing 2022 version it is not working anymore.

    Some additional Info:

    - When I go through other sounds on the Ambient Sound component, some sounds are working when I click on preview, some sounds are not.

    - The sound(s) is linked correctly in the Ambient Sound component. So I can click on "Click to Edit ambient sound group" and then play the sound in the master audio group.
     
    Last edited: Aug 2, 2022
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There is quite a lot of code in the previewing of Ambient Sound Inspector. You would need to go add debug statements and find if/where it exits early. Unless you can send me an example Scene where I can click around and find it myself.

    As far as Ambient Sound not playing, that can happen if too far away from the Audio Listener. Each Sound Group can have different Max Distance for the Audio Sources. Did you turn on "Log Sounds" in Advanced Settings and look at the Console for help?
     
    Doomchecker likes this.
  13. Dist0

    Dist0

    Joined:
    Oct 28, 2017
    Posts:
    15
    Oh ok :(
    That's what I hoped with a name like that
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There may be a plugin on the Asset Store for that, I'm not sure. Good luck!
     
  15. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    Hello! I am having an issue with playing little rapid sounds on tap. When the user taps to spawn an item I am using
    PlaySoundAndForget to fire them and I have the voices set to maximum, but it says they are being played successfully even though I can't hear them.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If you can't hear them, you are using 3D Sound (do you want to use 3D?) and your Max Distance of the Audio Sources is too small to be heard as its distance from the Audio Listener is too high. You can apply a higher distance Audio Source Template to 1 or more groups in the Master Audio Mixer section until they are audible. Or just turn that sound (or all sounds) to 2D using its Bus or the other global control on the mixer.
     
  17. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    I just checked and that isn't it. The audio clips are being launched from the same place in a 2D plane and the listener doesn't move.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Force them to 2D for a reality check first (choose the option on the Bus). You should hear them. Then we can go from there.
     
  19. Lad-Ty

    Lad-Ty

    Joined:
    May 7, 2013
    Posts:
    61
    Hi, I have a ScriptableObject where we assign a lot of sounds in the inspector. And it gets very, very laggy, seems even to crash Unity sometimes, when I use [SoundGroup] annotations there for the friendly dropdown menus instead of simple strings to assign sounds. Typical "lists" of sounds assigned there look like this -> serializable classes with a soundgroup selector inside:

    Code (CSharp):
    1.  
    2.     /* hit sounds - different sound based on weapon type and hit material */
    3.     [System.Serializable]
    4.     public class HitSound {
    5.         public WeaponSoundType weaponSoundType = WeaponSoundType.Unknown;
    6.         public HitMaterialSoundType hitMaterialSoundType = HitMaterialSoundType.Unknown;
    7.         [SoundGroup]
    8.         public string sound = null;
    9.     }
    10.     [SerializeField] private List<HitSound> attackHitSounds_ = new List<HitSound>();

    Is there something I can do to address this and make the inspector usable even with the dropdowns? At this point, I fully removed the [SoundGroup] annotations because now, it's simply better to copy paste strings on that object, but would obviously prefer it present if possible :p
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I actually don't know how to use Scriptable Objects. However those property drawers are written as well as I know how. I'm not sure why they'd cause problems in the case you're describing :(
     
  21. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    I tried forcing it to 2D and it still seems to skip some.

    Here's a video that shows what I am talking about:
    https://www.youtube.com/shorts/5acQ-XudYpc

    For some reason even when forced to 2D I spawn 10 but only hear 7 sounds.
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, and what are the max voices for that Sound Group (sum of "Voices/Weight" field for all Variations) and Bus set to? You may need to increase.
     
  23. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    Thank you so much for your help on this, here is a screenshot of my current settings.
     

    Attached Files:

  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, so I can see you have no voice limit on the Bus. Show me the Sound Group Inspector for the bubble sound you are having issues with. How many Variations, and what's the Voices/Weight field on each set to? If you add those up, that's the total number of voices you have configured to be able to play simultaneously. You'll need to click on the gear icon for the Sound Group to get to where those are shown.
     
  25. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    Is this what you are looking for?
     

    Attached Files:

  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes. So you can see that your Voices/Weight field is set to 1. That means that you can only play 1 of that sound at the same time. The 3 out of 10 that you're not hearing are failing because 1 voice is already being played at that time.

    If you turned on "Log Sounds" for the Sound Group the Console window would tell you why and what to do, for future reference. Anyway, increase the Voices/Weight to 2 or more until it does what you want.

    That's one of many reasons you won't hear a sound. There's a flowchart of the play sound logic on the bottom of this page. It's quite extensive and the Console will tell you which step failed.

    https://www.dtdevtools.com/docs/masteraudio/Troubleshooting.htm
     
    hkalterkait likes this.
  27. AaronXRDev

    AaronXRDev

    Joined:
    Dec 13, 2014
    Posts:
    30
    Thank you so much! I increased it and it is working now!
     
    jerotas likes this.
  28. Dainofel

    Dainofel

    Joined:
    Oct 12, 2019
    Posts:
    35
    Hello There,

    I have a question: I need to create a casting loop sound. So the sound starts when the player starts casting, and lasts as long as the player holds the button. When the player lets go, the sound stops.

    I know how to play sounds from code, but I don't know how to have a sound lasts for as long as a button is pressed, and stop it when the button is released.

    How can I achieve this? I appreciate any insight!
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If there a mono behavior event that corresponds with "button release"? If not, you'll need your own code that detects that. Once you have it, you can call MasterAudio.StopSoundGroupOfTranform or other applicable method.
     
  30. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Hello, I am having a strange issue and was wondering if someone here could point me in the right direction? I have several Playlist Controllers in my scene for different groups of clips I want played at different times.

    Everything works fine, I start the level, the Playlist Controllers work fine and its great, no problems. But if I change something in my code, reload my script assemblies, and enter playmode, for some reason all but 1 of the Playlist Controllers gets destroyed, not just the script but the entire gameobject it was attached to.

    Here is what it looks like normally when entering playmode:
    Before.PNG
    And after reloading script assemblies then entering playmode:
    After.PNG
    Which then prints this error because my script is trying to access the destroyed Playlist Controllers:
    AfterError.PNG

    Any idea what could be causing the Playlist Controllers to be destroyed? I just started using Master Audio so hopefully there is just a checkbox or something that I'm missing that's causing this.

    Thanks!
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's pretty weird. Have you tried unparenting them so they have no parent game object? Also, did you turn on "Save Runtime changes" or no? If you did, try turning it off to see if it's a side affect of that setting.
     
  32. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Just tried un-parenting them but it didn't seem to make a difference. And Save Runtime changes is off. It's so strange because once I hit play again, everything is fine, it's only after reloading scripts and hitting play where they get destroyed.
     
  33. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Also it seems that the last one, "Night", is always the one that does not get destroyed even if I change its name or reorder it in the list, but its settings are identical to the other ones?
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    What do you mean by reloading scripts? Are you using the experimental domain reload faster to enter play mode thing? I forget what it's called. If you are, try turning that off also.
     
  35. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Ah! That did it, so having the "Enter Play Mode Options" box checked in Project Settings/Editor was causing it. Thanks for your help!
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Interesting. I would like that to work, I'll try and check it out tomorrow and see if I can reproduce the error. Can you give me steps to reproduce the problem? Include what settings you had for Enter Play Mode Options.
     
  37. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Sure!
    1. Check "Enter Play Mode Options" in Project Settings/Editor, I left the other 2 boxes unchecked.
    2. Create multiple Playlist Controllers, I have 4.
    3. Edit any script in your project with an IDE, I use Visual Studio, then save the file.
    4. Unity will pop up "Compiling C# Scripts" and "Reload Script Assemblies".
    5. When finished, enter playmode.
    For me, 3 of the 4 Playlist Controllers are destroyed on start. Hope that helps!
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    And what version of Unity are you using? Thanks!
     
  39. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    I'm using 2021.1.22f1
     
    jerotas likes this.
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I found the issue and fixed it on my machine anyway. Add these 3 lines at line 231 in PlaylistController.cs just before the existing lines shown below that.
    Code (csharp):
    1.  
    2.             // fix the error where cached property will delete other Playlist Controllers when entering Play Mode if "Enter Play Mode Options" is checked and you compile before pressing play.
    3.             _go = null;
    4.             _name = null;
    5.  
    6.             // ReSharper disable once ForCanBeConvertedToForeach
    7.             // ReSharper disable once LoopCanBeConvertedToQuery          
    8.             for (var i = 0; i < controllers.Length; i++) {
    9.                 if (controllers[i].ControllerName == ControllerName) {
    10.                     sameNameCount++;
    11.                 }
    12.             }
    13.  
     
  41. Evallis

    Evallis

    Joined:
    Nov 6, 2012
    Posts:
    20
    Awesome! Thanks again!
     
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem
     
  43. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Hey- bit of a workflow question (sorry it's a bit long, but hopefully straightforward):

    Is there a way to make it so that starting one SoundGroup stops or fades out other SoundGroups? Like the Linked Groups system but kinda inverted?

    Perhaps best if I give an example of what I'm trying to do...

    I have a simple AI agent with 3 states: patrol, suspicious, and alerted. In each of these states, I want the agent to say a random phrase from a sound group every few seconds. The Looped Chain variation mode on a SoundGroup works great for this.

    I also want to insert some transition phrases- for example, when the agent moves from suspicious to patrol, I want to play a phrase from a different SoundGroup, to announce the change of state, then continue in the new state Looped Chain afterwards.

    I've achieved this behaviour using a SoundGroup of variations for each state (patrol, suspicious, alerted), and a SoundGroup for each type of transition (eg. suspicious -> patrol; alerted ->suspicious). When the agent state changes, I check whether I should play a transition sound (and play it first) or just start the Looped Chain.

    I've got this working, but it feels like I'm missing some organising principle. Whenever I play a new SoundGroup, I need to individually stop all the others.

    For example, I'm ending up with a lot of stuff like this:
    Code (CSharp):
    1. switch(alertState)
    2.     {      
    3.         case Agent_AI.AlertState.Patrol:
    4.             PatrolLoop(true);
    5.             SuspiciousLoop(false);
    6.             AlertedLoop(false);
    7.             break;
    8.         case Agent_AI.AlertState.Suspicious:
    9.             PatrolLoop(false);
    10.             SuspiciousLoop(true);
    11.             AlertedLoop(false);
    12.             break;
    13.         case Agent_AI.AlertState.Alerted:
    14.             PatrolLoop(false);
    15.             SuspiciousLoop(false);
    16.             AlertedLoop(true);
    17.             break;
    18.     }
    Where the different loop methods allow me to start or stop particular SoundGroups. And similar setups for the state transition sounds (using the result.ActingVariation.SoundFinished += MethodName system).

    I thought buses might be the answer, but they seem more suited to dealing with multiple agent situations: maxing out the number of agent sound loops a player might hear at one time, etc. Is there some other way I should be dealing with this? What would you do?

    Please let me know if this isn't clear enough or if it would help to extend the code example.
     
    Last edited: Sep 21, 2022
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes, you could route all 3 Sound Groups to the same Bus with voice limit of 1. Voices Exceeded Behavior would be set to Stop Oldest Sound. For your transition sound, if it's outside those 3 Sound Groups, send those Sound Groups to the same Bus as well. And you could set up Linked Groups to play when the transition sound finishes.

    Does that work?
     
  45. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Hey, thanks for getting back to me!

    Yeah I see how that would work- it makes sense- but if I did this, how would you recommend I dealt with multiple duplicate agents in the same scene? Imagine one patrolling, somewhat distant, and another nearby, suspicious about the player. I've been using a bus to limit the maximum number of agent voices- any more than 3 and the most distant is ignored.

    Should I instantiate a new bus for each agent spawned into the scene? Is there some way I could group these buses to limit the max number of them playing at once?
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Then you wouldn't use the bus options at all. You would need to code it. You could do MasterAudio.StopAllSoundsOfTransform() before playing each sound.
     
    Jshh likes this.
  47. Jshh

    Jshh

    Joined:
    Sep 14, 2019
    Posts:
    38
    Ah great, I didn't know about that function, sorry. OK this should help me simplify. Thank you!
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Of course!
     
  49. TeramonGame

    TeramonGame

    Joined:
    Oct 8, 2017
    Posts:
    21
    Code (CSharp):
    1. MasterAudio: Can't find non-busy variation 'SoundName' of GroupName
    I have a custom event that triggers a specific sound from my group.

    However, I need the sound to play multiple times (before each play-through finishes).

    I see there's some sort of queue system that prevents the audio from triggering again whilst playing, but are there any workarounds?

    Cheers!
     
  50. TeramonGame

    TeramonGame

    Joined:
    Oct 8, 2017
    Posts:
    21
    Nevermind. I've realised all I had to do was update the "Voices / Weight" field.