Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

[RELEASED] 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. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    169
    Hey, I just updated to 4.2.1 and I'm still getting an error:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TransformFollower.RecalcClosestColliderPosition () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Utility/TransformFollower.cs:215)
    3. DarkTonic.MasterAudio.MasterAudio.RecalcClosestColliderPositions () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1087)
    4. DarkTonic.MasterAudio.MasterAudio.ManualUpdate () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1017)
    5. DarkTonic.MasterAudio.MasterAudio.LateUpdate () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1003)
    It looks like this is the line that is causing the problem:
    Code (CSharp):
    1. var listenerPos = MasterAudio.ListenerTrans.position;
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    If that is true, then you don't have an AudioListener component in your entire Scene (or it's on a disabled Game Object), which means you wouldn't be able to hear any audio anyway.

    You will need to fix that before the error will go away.
     
  3. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    169
    This only happens when we reload the game, unloading the scene with our audio listener and reloading it - it doesn't break things permanently so it's not a breaking error
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    You will need to disable any Game Objects with AmbientSound on them until the AudioListener is in a non-disabled game object if you wish to make the error go away then.
     
  5. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    169
    Alright, that's definitely feasible, I can create a hook for that in our streaming system - thanks for the clarification!
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Ok. One might argue that I should add a friendly message here, but either way it's still going to be a red error in the Console, because AmbientSound script will not work properly regardless of the message....
     
  7. igorgritsay93

    igorgritsay93

    Joined:
    Dec 21, 2018
    Posts:
    5
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    The warning when you click on the master audio game object tells you what you need to know. You need to make a prefab out of that game object, then the warning will go away. In other words drag it into your project view where you want the prefab to live.

    A lot of people are getting confused by this so I am removing these warnings in the next version.
     
  9. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    173
    How do I set the specified group to 2D? I only see "Force All To 3D" now.

    I use 2018.3.0f2 and Master Audio 4.2.1. I remember that in the past versions I was able to find the option to adjust 2D in each Group object.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    You have a couple options here. What I usually do is send all the 2D sounds to a particular bus because buses have a checkbox for Force to 2D.

    You also can find the drop-down for "spatial blend rule" in the master audio mixer section near the top. If you set that to " allow different per group" then each group will allow you to set it to 3D or 2D if you go into the sound groups settings. Otherwise it's more of a global approach in which case the buses can help you out.
     
  11. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    173
    Ok, thanks for reply.
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Any time.
     
  13. Jmbryan10

    Jmbryan10

    Joined:
    Apr 24, 2015
    Posts:
    6
    Hello,

    Perhaps I'm overlooking something simple, but is it possible to set up a sound group that will play multiple clips simultaneously like composite effect? What do you recommend doing in that situation?

    What I've done is set up a sound group with the 2 clips as variations and use a SoundEvent with 2 actions to trigger both variations. This works fine at runtime, but I can't preview/tune the sounds together from the MasterAudio script.
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Sure, it's easy. What I usually do is add some Linked Groups in one of the Sound Group's Inspector. You can choose one or more Linked Groups that play whenever that Group plays. You can do "Start" or "Stop" Linked Groups. Start ones play when the Group starts, Stop Groups play when the Group stops playing (to link several audio clips together).

    You obviously want the Start Linked Groups. So if you have Sound Groups X, Y, and Z, you can go into X and set Start Linked Groups of Y and Z. Then just tell X to play and all 3 will. But you can play Y or Z without triggering anything else, unless you add Linked Groups to those as well. But no, you can't test it except at runtime.
     
  15. Jmbryan10

    Jmbryan10

    Joined:
    Apr 24, 2015
    Posts:
    6
    Thanks for the idea on the linked groups. How difficult would it be to enable the Linked Group functionality at edit time?
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Maybe not very. I'll have to see if it's feasible at all. Some settings are not accounted for (and can't be) for preview purposes. This might be one of them. I'll take a look.
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    V 4.2.2 changelog:
    • Fixed bug: With gapless song transitions on, if you queued a song after a song already looped, it would start immediately. Now it wait until the end of the current loop.
    • Fixed bug: With gapless song transitions on, if you play a song after one is already scheduled, it plays the same song twice in a row.
    • Disabled prefab checking in Unity 2018.3+.
     
  18. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    203
    I'm having some basic issues with getting Buses to fade in/out. I've just upgraded to your latest version (4.2.2). Noticed for the first time in the MasterAudioManager a Utility saying "Upgrade MA Prefab to V3.5.5". Seems odd since I'm far past that version.

    *edit the bus fade thing was my bad, but still curious about the button!

    Does this mean I have some old code laying around in my prefab? Click button or not? :)
     
    Last edited: Jan 29, 2019
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    That button is for very early users who already have Master Audio game objects created prior to Master Audio 3.5.5, which according to my release notes thread in the forum was Aug 20, 2014. That release added new scripts to all Sound Group Variations so I made a button to do the upgrades all at once.

    Very unlikely that you need that button, and in fact, I can probably remove it entirely from the next update since that's 4.5 years ago.

    Buses fade out fine for me on all versions of Unity. If you have a example Scene you can export as a unity package and send it over, I will have a look (official bug reporting rules thread says this). Because otherwise I'll probably spend a lot of time trying and failing to set it up exactly how you have and not be able to reproduce it. Slows down the fix, if any is needed.
     
    Exbleative likes this.
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    It's not even possible actually, I checked today. The "previewer" Audio Source is a single one, because there's really no way to do things in edit mode like: stop the audio clip when it's over (primarily). So we stop the playing clip before previewing a new one.

    However since its a single Audio Source on the Listener Game Object that goes away when you hit run, it wouldn't support doing different pitches of multiple Variations at the same time. Technically I could PlayOneShot and play all the sounds, but there's just one Audio Source, so it has a single pitch.

    Because of this shortcoming, I don't want to enable this to work at edit time with the weirdness and confusion it would cause.

    You know you can edit in Play mode and keep the changes right?
     
  21. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    268
    What's the right approach to handle this:

    I have a singleton game manager who is always in my game. I load and unload some levels and each has its own Master Audio prefab with specific sound FX for that Level.

    But I want to re use some sound FX over and over, regardless of the scene, like in menus and gameplay some sounds repeat... should I have a Master Audio Prefab with repeated groups?

    Also I want to have music playing constantly between scenes, so for that I would need to Add a Master Audio Prefab to my Singleton scene, but that will conflict with the ones in each scene.

    how should that be addressed?
     
  22. igorgritsay93

    igorgritsay93

    Joined:
    Dec 21, 2018
    Posts:
    5
    Hi! I've got two scenes in demo level: two rooms. From main audio scene, where I store MasterAudio, I've created two playlist controllers, one for each room. Later on I'll add script events that will trigger one or another when entering/leaving the room. But here's one problem: I've put playlist controller 1 to room 1 scene in hierarchy, and everything works fine. Music works perfectly in 2D.
    But when I've put playlist controller to room 2 scene, it started working in 3D, as if there's an object that is playing the music. Once I put this playlist controller back under MasterAudio in audio scene, it works in 2D again. Music is set to "force to 2D".
    What can be causing that?

    Thanks in advance!
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I don't understand what you're saying about room 2 scene. Please elaborate.
     
  24. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    213
    Hi can I just ask whether you know of anyone shipping games with Master Audio on consoles?

    Specifically I'd like to know if it's been used on xbox one, ps4, and / or switch :)
     
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I don't know. We are working on an Xbox one game ourselves, but no longer work on games for our studio, just the plugins. I'm not sure if we've actually built to the Xbox yet or not. I can ask if you're interested.
     
  26. igorgritsay93

    igorgritsay93

    Joined:
    Dec 21, 2018
    Posts:
    5
    Sorry, I'll try to be more specific.

    https://monosnap.com/file/WHasOxZLPl28y0yUqUir2Xtbn8rz1K - there is an individual playlist in each scene.

    "BGM playlist demo flat" plays like it should - music is in 2D, has consistent volume and does not change pan depending on character position.

    "BGM playlist demo corridor" on the other side plays in 3D. Music gets louder when I come closer to playlist object in scene and changes pan when I stand to the left or right from it.

    If I move this playlist under "FlatSceneTest" in hierarchy, everything is OK. Music becomes 2D and is not affected by character position. Same thing happens if I move this playlist under Master Audio prefab in MainAudio scene.

    I hope this makes sense. Thanks.
     
  27. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    213
    If you wouldn't mind that'd be great.

    As long as the plugin is full source and built on top of the Unity audio stuff then it shouldn't be an issue.

    I've ported several asset store plugins to console, by far the main issue with consoles is just that the JIT is disabled so all generic types have to be instantiated at AOT compile time - I believe this is the same on iOS?

    I'm just interested as I'm currently doing a ps4/switch/xbone/PC game and MasterAudio would save me loads of time ;)

    Alex
     
  28. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    213
    Nevermind. I bought it...

    It compiles just fine on both PS4 and xbone as part of a project, and the project then deploys and runs ok too.

    I've not actually used any of the Master Audio classes in the game yet so I'll get back to you when I know for sure :)

    Alex
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Ok, so are you loading that other scene while still having the first scene alive? Does each scene have their own Master Audio game object or do they share one?

    The SetSpatialBlend method gets called during the Awake event of the PlaylistController. It should be able to read the Spatial Blend settings on the Master Audio game object.

    You may have to either debug (add some debug statements into code to figure out what's going on) or send me a project for me to be able to reproduce the bug and figure out if its even fixable or not.
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I'm sure it will work fine. We support all platforms and no one has called us out on that being false yet. With thousands of users. Thanks for the support!
     
  31. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    78
    Do you have any recommendation to create my own Subtitle System?, it would be cool if I could trigger some events dependent of the audio time.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I'm really not sure if this has anything to do with audio or not. Could you give me more context of what you're trying to do?
     
  33. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    78
    I have a long audio, a speech of 30 seconds. I can't show the full subtitles of this audio on the Text UI, because it's to long. I have 2 lines to display text, just like any movie subtitle. So the idea is display the text at some points of the audio, (just like events does in an animation).
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Ok. Well you're probably going to want to use the animation window. There's nothing this plugin provides you for scenarios like this.
     
  35. Iain-Lobb

    Iain-Lobb

    Joined:
    Jan 11, 2013
    Posts:
    30
    I could not get my project which uses Master Audio to compile on Cloud Build due to this error:
    "[Unity] Assets/Plugins/Editor/RelationsInspector/BackendUtils/BackendUtil.cs(6,26): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `RelationsInspector'. Are you missing an assembly reference?"

    For the future reference of anyone else getting this issue, it was because SourceTree ignores dll files by default - you can change this is SourceTree's settings.
     
    Last edited: Feb 26, 2019
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Sorry but I know nothing about Unity Cloud, so I don't think I'll be able to assist.
     
  37. Iain-Lobb

    Iain-Lobb

    Joined:
    Jan 11, 2013
    Posts:
    30
    Do you know if there is a way for me to remove the dependency on RelationsInpector from MasterAudio?
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    You can't do it, easily. I can spent about 10 minutes and tell you how to do it, but every time you upgrade Master Audio to a newer version, you'll have to do the steps again because your changes will be reverted.

    I would have you go and post on the Unity Cloud forum (assuming there is one here) and ask why the heck something would be able to build in the editor (and export to every platform fine) and not on Cloud. That seems to be a bug on their end.
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I also wanted to mention that if you've moved the RelationsInspector folder from its install location, that might cause problems. So if you have, try putting it back.
     
  40. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    268
    How do you increase the Pool Size? or how to play multiple instances of the same audio close to each other?

    So far if I try to play the same sound again before the previous one stops playing it doesn't do anything and displays a log

    " MasterAudio All children of Sound were busy. Will not play this sound for this instance. "
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Right, the default is one voice. If you look at the individual variations on your sound groups you will see the voices field which you can increase to how many voices you need.

    The documentation on this page covers it and a lot more: http://www.dtdevtools.com/docs/masteraudio/SoundGroupVariations.htm

    It is also shown on one or two of the tutorial videos we did.

    Would it be helpful if the message logged to the console said that you can increase the voices field if you need more voices?
     
    daville likes this.
  42. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    268
    Oh yes thanks, perhaps the log could say something about it yes that would help

    Also the name of the parameter "Voices (Weight)" confused me I tought it meant something like priority, but thanks, I think this works
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    Sure, I'll do that. I believe I put a green question mark icon next to that field in particular, which links to the page of online documentation that explains it. Click those icons if you aren't sure what something is for.
     
  44. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    107
    I have a project where I get this error often. Any idea how to fix it?

    Code (csharp):
    1. UnassignedReferenceException: The variable soundGroupTemplate of MasterAudio has not been assigned.
    2. You probably need to assign the soundGroupTemplate variable of the MasterAudio script in the inspector.
    3. DarkTonic.MasterAudio.MasterAudio.CreateSoundGroup (DarkTonic.MasterAudio.DynamicSoundGroup aGroup, System.String creatorObjectName, System.Boolean errorOnExisting) (at Assets/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:3706)
    4. DarkTonic.MasterAudio.DynamicSoundGroupCreator.CreateItems () (at Assets/DarkTonic/MasterAudio/Scripts/Utility/DynamicSoundGroupCreator.cs:225)
    5. DarkTonic.MasterAudio.DynamicSoundGroupCreator.CreateItemsIfReady () (at Assets/DarkTonic/MasterAudio/Scripts/Utility/DynamicSoundGroupCreator.cs:105)
    6. DarkTonic.MasterAudio.DynamicSoundGroupCreator.OnEnable () (at Assets/DarkTonic/MasterAudio/Scripts/Utility/DynamicSoundGroupCreator.cs:74)
    "soundGroupTemplate variable of the MasterAudio script in the inspector."
    Where is this?
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    I don't know how this would happen, but this is how you fix it.
    1) Click on Master Audio game object.
    2) On the upper-right corner of the Inspector window, click the arrow next to the lock icon and select "debug".
    3) In Project window, find the following prefab: Plugins/DarkTonic/MasterAudio/Sources/Prefabs/Internal/SoundGroup
    and drag it into the field in the debug inspector called "Sound Group Template".
    4) Change the Inspector back to "normal" from "debug".

    If you have other similar errors, I would suggest deleting your Master Audio game object and creating a new one from the Master Audio Manager window.
     
  46. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    331
    Hi there

    I just upgraded to the latest MA version and I am now getting this warning:
    MasterAudio Can't find non-busy variation

    I think I am on 4.2.2

    T: 21.3403 - MasterAudio Can't find non-busy variation {Drag Cloud} of Clouds
    UnityEngine.Debug:Log(Object)
    DarkTonic.MasterAudio.MasterAudio:LogMessage(String) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:7082)
    DarkTonic.MasterAudio.MasterAudio:playSoundAtVolume(String, Single, Vector3, Nullable`1, Nullable`1, Transform, String, Boolean, Single, Boolean, Boolean, Boolean, Boolean, Boolean) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1954)
    DarkTonic.MasterAudio.MasterAudio:playSound(String, Single, Nullable`1, Single, String, Nullable`1, Boolean, Boolean) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1428)
    SoundManager:playSoundForCloudDrag() (at Assets/KIDpedia Menu/Scripts/SoundManager.cs:29)
    Cloud:OnDrag(PointerEventData) (at Assets/KIDpedia Menu/Scripts/Cloud.cs:62)
    UnityEngine.EventSystems.EventSystem:Update()

    Any tips would be appreciated
    Thanks again


    Code (CSharp):
    1. using DarkTonic.MasterAudio;
    2.  
    3. public class SoundManager {
    4.  
    5.     // SETTINGS WINDOW
    6.     public static void PlaySoundForSettingsWindow () {
    7.         MasterAudio.PlaySound("SettingsWindow", 1f, 1f, 0f, "Settings Sound");
    8.     }
    9.  
    10.     // SUN
    11.     public static void PlaySoundForSunTap () {
    12.         MasterAudio.PlaySound("Sun", 1f, 1f, 0f, "Tap Sun");
    13.     }
    14.  
    15.     public static void PlaySoundForSunDrag () {
    16.         MasterAudio.PlaySound("Sun", 1f, 1f, 0f, "Spin Sun");
    17.     }
    18.  
    19.     public static void StopSoundForSunDrag () {
    20.         MasterAudio.FadeOutAllOfSound("Sun", .3f);
    21.     }
    22.  
    23.     // CLOUDS
    24.     public static void PlaySoundForCloudTap () {
    25.         MasterAudio.PlaySound("Clouds", 1f, 1f, 0f, "Tap Cloud");
    26.     }
    27.  
    28.     public static void PlaySoundForCloudDrag () {
    29.         MasterAudio.PlaySound("Clouds", 1f, 1f, 0f, "Drag Cloud");
    30.     }
    31.  
    32.     public static void StopSoundForCloudDrag () {
    33.         MasterAudio.FadeOutAllOfSound("Clouds", .3f);
    34.     }
    35.  
    36.     // SCENE ICONS
    37.     public static void PlaySoundForSceneIconsTap () {
    38.         MasterAudio.PlaySound("Scene Icons", 1f, 1f, 0f, "Tap Feature Graphics");
    39.     }
    40.  
    41.     public static void PlaySoundForSceneIconsDrag () {
    42.         MasterAudio.PlaySound("Scene Icons", 1f, 1f, 0f, "Moving Abacus Balls");
    43.     }
    44.  
    45.     public static void PlaySoundForSceneIconsEndDrag () {
    46.         MasterAudio.PlaySound("Scene Icons", 1f, 1f, 0f, "entering scene");
    47.     }
    48. }
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    It's not an error. It's a warning. Just the upgrade itself would not have changed anything. You need to assign more voices for the sound groups in question because you're already using all of them.
     
  48. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    331
    Thanks for your ultra fast response
    What if I don't need any more?
    My use case is that I have a few elements like the sun that has two interactions each with a specific sound associated to it.
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,028
    If you don't need anymore then you can ignore the warnings. You can also turn them off by unticking the log sounds checkbox under advanced settings. These are for Diagnostic purposes only
     
  50. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    331
    I guess I can also do more variations in a single group, which is probably the best solution.