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,572
    Right, there's also the same icon on every single Variation in every single Sound Group. I think I'll make that able to be disabled in the Master Audio prefab in the next version.

    In the meantime, you can delete this code from SoundGroupVariation.cs,

    void OnDrawGizmos()
    {
    Gizmos.DrawIcon(this.transform.position, MasterAudio.GIZMO_FILE_NAME, true);
    }
     
  2. akitsu

    akitsu

    Joined:
    Nov 26, 2013
    Posts:
    38
    Hello!

    How I can get Master Audio to play one sound effect at same time? In my case my character is grounded so he should play running sound, but problem at the moment is that sound is played too many times. I tried with this code:

    MasterAudio.PlaySound("RunningSounds", 1f, 1f, 0.2f, "", false);

    Is there method which returns if Master Audio is playing currently audio clip from the group?
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There should be no need for a method like that. You can specify the maximum number of any Variation that can be played simultaneously. The default is 1. Change the "weight" property in the Variation to set that maximum. Also, you may want to set the retrigger percentage or loop the sound.
     
    Last edited: Apr 15, 2014
  4. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    Some weeks ago I bought Master Audio because it seemed really awesome. Yesterday I started using it and reading/viewing the tutorials.

    After checking them all I have now one of the most basic questions. I have 2 scenes and I want to play a differnt song in each scene. How can I do this in Master Studio. Should I create a playlist with the two songs and play them programatically?

    Sorry for the dumb question but I am a bit lost.

    C
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You could create a one-song playlist for each Scene, or put all the songs for all scenes into a single playlist.

    It seems that the Start event in EventSounds doesn't work properly with some Playlist operations in non-persist mode, or you could use that. I'll see if I can get that to work in a future version. If you are using persist mode though, you could add an EventSounds script to a game object in your scene (assuming you set up Master Audio in a previous bootstrapper scene), use the Start event and play the song there without writing any code.

    Alternatively, you could put a line of code in to play the song you want, as you suggested.

    Or, if you don't need to use the "persist across scenes" option, then you would put a Master Audio prefab in each scene with its own playlist that auto-starts on awake.
     
    Last edited: Apr 16, 2014
  6. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    So, I have a playlist with four songs, they all play nice, loop correctly and stuff.

    BUT my pause mechanics is simply Time.timeScale = 0, and my GUI elements ignores timeScale. Simple like that.

    BUT when the game is paused and a song finishes, MasterAudio refuses to play the next song. And this only happens when the timeScale is set to 0.

    If, instead of a pause, I make an "almost-pause" (timeScale = 0.00000001f), the next song is played just fine. This strange behaviour only occurs if the timeScale is equals to 0.

    So, is this an expected behaviour? How may I correct this?

    Thanks
     
    Last edited: Apr 16, 2014
  7. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I have a playlist with one song. On windows if the game window looses focus music stops (that's fine) but when I come back to the game the song is neither resumed nor reseted. I mean, no more music is heard.

    I have been playing a bit with the EventSounds Script. I have set a start event to play next song in play list and in the Enable event the resume the playlist. My idea was that the start event would start the playlist and when game window focus is lost and is regained the Enable again would resume it. Well, I've got nothing :). If you could explain a bit this behaviour I would really appreciate it.

    P.D. PlayList controller shows always stopped state in the Master Audio editor.

    Is this a bug?.

    Thanks in advance.
     
    Last edited: Apr 16, 2014
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    940
    Hi,

    I'm trying to play a looping sound clip (laser) and then later on pause it and unpause it through code.

    Can you please shed some light on this? I've tried pretty much all methods I could find but I'm finding it all very confusing to be honest.

    For example... Why is there a "PauseSoundGroupOfTransform" and then there's only a "UnpauseSoundGroup" and not a "UnpauseSoundGroupOfTransform"?
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Have you tried with the very latest version? I fixed numerous time scale bugs.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There's no built in hard-coded Master Audio functionality to do anything with the music when the app loses focus. Of course on mobile platforms the OS will do that. As soon as you return to the app the music should resume. Our game does not exhibit the behavior you're experiencing. Can you either send us a small project reproducing the bug or give us steps to reproduce? Use filemail.com to send large files.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Possibly I can add an "UnpauseSoundGroupOfTransform". I'll look into it. I don't remember if there was a technical reason we didn't add it. Let's see your code for pausing the laser, and I should be able to give you code to unpause it.
     
    Last edited: Apr 16, 2014
  12. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    940
    I'm basically doing this at the start:

    and then something like this later on:

    Which doesn't work, as expected...
     
  13. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    183
    Have you seen this thread?
    http://forum.unity3d.com/threads/97690-The-Ins-and-Outs-of-Audio-Memory-in-Unity

    Basically you can destroy them manually or use Resources.UnloadUnusedAssets().
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You probably have more than one laser sound playing simultaneously right? If so, I'll need to add UnpauseSoundGroupOfTransform. Also, is laser a resource file?
     
    Last edited: Apr 16, 2014
  16. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    So, yes, I've just updated to the latest version (v3.4.9) and the problem is still happening.

    When timeScale is equals to 0 and a song finishes, the next song of the playlist is not starting.
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It sounds like you have "auto-advance" turned on, so the next song plays normally, just not at zero time scale, right?
    If so, I'll take a look tonight and see if it's an easy fix.
     
  18. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    Yeah, it is turned on. And yes, if the timeScale is 0.0000001f, it plays smoothly, if it is 0, it doesn't.

    Thanks for the fast replies man.
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, thanks for the clarification. I may have a fix tonight.
     
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    940
    Yes, I do have more than one laser playing simultaneously. It's not a resource file... It's added to my MasterAudio prefab.

    Sorry for my question, but is this situation such an unusual use case? How would you approach such thing?
     
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Nothing's unusual. Apparently not a lot of people are using some of the more edge case features so they may in some cases be lopsided or half-finished. In fact this particular feature I believe was submitted by one of our users.

    I'll add that method in the next day or two and post an update.
     
  22. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    940
    Great! Looking forward for it.
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I can't reproduce this problem cloud...I put TimeScale at zero and the next song plays fine, even crossfades. Are you cross-fading? Could you send me a small project that reproduces the problem? It's possible that the Asset Store code is somehow not updated, that happens now and then.
     
  24. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    So, I've created a little project with one script - TimescaleChanger, with the default value of 0. The script is attached to a GameObject.

    MasterAudio's playlist controller has been set with 2 songs - The Intro and The Loop.

    The default behaviour of the MasterAudio is to crossfade between songs - it indeed worked here with crossfade too. But when I change the crossfade time to 0, it stops working again, just like my original project. With crossfade = 0.0000000001f, it works, with crossfade = 0, don't. With timeScale = 0.00000000001f, it works, with timeScale = 0, don't

    Within my scene, try the following scenarios:

    //This Works
    Master Crossfade time = 0.000001f
    TimescaleChanger.value = 0

    //This Don't
    Master Crossfade time = 0
    TimescaleChanger.value = 0

    //This Works
    Master Crossfade time = 0
    TimescaleChanger.value = 0.00001f

    //This Works
    Master Crossfade time = 1
    TimescaleChanger.value = 1

    Both music files are very small in seconds. The scene is inside Assets/Scenes

    Oh yeah, the things I've changed after importing MasterAudio's from the Asset Store:
    - Changed Master Crossfade Time to 0.
    - Deleted the Examples folder
    - Deleted the Documentation files (a .txt and a .pdf)
    - Added two songs to the Default Playlist and renamed it to "Playlist"
    - Made the second song of the playlist "loop"
    - Changed the Initial Playlist of the PlaylistController to "Playlist"

    And there you go. Thanks again.
     

    Attached Files:

    Last edited: Apr 17, 2014
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Your project shows as a rar file, but when I try to download it, it's a PHP page, which doesn't give me the project.

    Anyway, I tried using zero crossfade as well as zero time scale. It still works on my computer. Can you send me your rar file with filemail.com to brian@darktonic.com?
     
  26. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    There, I've just sent you. Man, this is really really strange. I've already thought it was my computer, but when I compile the project on android, iOS, web, PC, the result is the same. Anyway, hope my scene does not work there, if it does works, I'm screwed.

    Thanks.
     
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Can you paste the filemail link here? My forwarding must not be working :(
     
  28. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Reproduced the bug. Change to this in PlaylistController.cs, line 207 208 to fix it:

    Code (csharp):
    1.          
    2.   if (currentClipTime <= clipFadeStartTime)
    3.             { // time to cross fade or fade out
    4.  
    The fix will be in the next update.
     
  31. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    haha man, thanks! It is working like a charm now! You're the best.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Awesome! Thank you for taking the time to help me reproduce the problem.
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio v3.5 will be live in about 20 minutes. Changelog:

    • Added checkbox to disable Variation gizmos in Scene view, located in Master Audio Inspector under Fast GUI Refresh setting.
    • Added "Show Advanced" section in Master Audio Inspector, which contains everything above the Mixer except for the 3 Master sliders. Defaults to "Show".
    • V3.4.9 had an error. The Mouse Click event in EventSounds is not for NGUI, it's for Unity GUI. Renaming it to "Mouse Down".
    • Renamed Collision event in EventSounds to "Collision Enter".
    • Renamed Collision 2D event in EventSounds to "Collision Enter 2D".
    • Added Collision Exit, Collision Exit 2D, Mouse Exit, Mouse Up Mouse Drag events to EventSounds.
    • Added UnpauseAllSoundsOfTransform and UnpauseSoundGroupOfTransform methods to MasterAudio.
    • For Mouse Up event in Event Sounds, added controls to stop or fade the Mouse Drag event if you also used it. That way you make the Mouse Drag sound seamless into the Mouse Up sound, even when looping the former.
    • Added NGUI events to EventSounds: NGUI Mouse Click, NGUI Mouse Down, NGUI Mouse Up, NGUI Mouse Enter, NGUI Mouse Exit. There's a checkbox to hide all NGUI events as well.
    • Added to EventSounds: StopAllSoundsOfTransform, StopSoundGroupOfTransform, PauseAllSoundsOfTransform, PauseSoundGroupOfTransform, UnpauseAllSoundsOfTransform, UnpauseSoundGroupOfTransform, FadeOutSoundGroupOfTransform.
    • Fixed Start event in EventSounds for Playlist Control commands: PlayClip, PlayRandomSong, PlayNextSong, Pause, Stop. They didn't work with non-persistant Master Audio prefab.
    • Fixed bug: Sync Group code to align layered Playlist Controllers got overwritten by song transition code - didn't syncrhonize layers properly.
    • Fixed bug: At zero time scale and zero crossfade, Playlist Controller wouldn't advance to the next song.
     
  34. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Hmm, guess I'm going to have to wait to use this when Unity goes 64 bit.
    Unity crashes in seconds when I scan my project for audio files.
    Over 8 GB of audio files in the project.
    Running the utility in a totally empty scene.
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's definitely a lot of audio, wow!

    64-bit you figure will let you utilize more of your RAM?

    I will take a look at the limits of the Clip Manager and see if I can make a nicer error if that happens.
     
  36. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yeah, of course, I'm not actually using it all, but most of it at one time or one level or another.
    I bring in a lot of uncompressed audio so it's only compressed once at runtime.
    I'm thinking Unity will be able to use what ever RAM a system has.
    Going to have to see if 32 GB is enough.
    :)

    What's the possibility of having a scan per level option?
    Just a notion.

    Edit: I watched your two YouTube videos on the utility (on my computer), but when I try to play them on my Amazon Fire TV, it exits back out of the app. None of your other videos do this and I've not seen this before, any idea what might be different about those two videos?
     
    Last edited: Apr 17, 2014
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We can look into other scan options. Videos exit? Extremely strange. No idea.
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I found a memory leak in the Clip Manager and fixed it. It will be in the next version. I couldn't even import 1Gb of audio when I checked after you reported this. If you would like the fixed Clip Manager, send an email attaching your PDF Asset Store Receipt to support@darktonic.com

    Thanks!
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I spent most of the day getting this to work in the Unity editor. But that's the only place it works. When you deploy to iOS or web player (probably any platform), the folders aren't there so it doesn't work. Only Resource files are there, but not accessible with a URL unfortunately.

    So we're going to need to wait for Unity 5 multi-threading to get truly non-blocking resource loading unfortunately.
     
  40. uniphonic

    uniphonic

    Joined:
    Jun 24, 2012
    Posts:
    130
    Hi Brian,
    It seems that the preview buttons don't take into account the random pitch settings. Can you change it so that the random pitch is audible with the preview?

    Thanks!
    Jacob
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I think there was a reason I left that out. It wasn't going to work properly in edit mode and/or it would have you lose your pitch setting (not good). However the preview button does work properly when you're playing the game (does random pitch), right?

    Actually I believe that in the Group inspector it actually has a note saying that random settings are ignored in edit mode, and that is why.

    If we change it to not use the variation's audio source, then this could possibly be done. But it would mean you can only preview one sound at a time, which I don't like.
     
  42. uniphonic

    uniphonic

    Joined:
    Jun 24, 2012
    Posts:
    130
    Yes, it does seem to work when playing the game (I hadn't previously tried hitting the preview button while in play mode). I guess what you're saying about it overriding what you're doing in edit mode, is probably true. I guess it's good enough for me if it only is audible in play mode.

    Thanks!
    Jacob
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem. We use the preview in play mode a lot. Before I get around to setting up EventSounds or other code to trigger the sounds, so we can hear all the random variations "in the mix". Pretty useful. Especially the preview button on the mixer, which plays a random variation at runtime.
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There's now a new forum for Master Audio (and Core GameKit) support, located here: http://darktonic.freeforums.net/. Please ask questions there instead of on this thread so that the next person who wonders the same thing might be able to find the answer easily.

    The thing is, quite annoyingly, the new forum doesn't email me whenever a new thread is posted (and I tried 3 other free forums - none of them have the option), so I will be checking there every evening. But of course Unity forums to email me immediately. So for best response time, please post your question in the new forum, then put a link here in this thread. Sorry about the runaround, I hope we can find a better way later on. This thread is much too large to serve as a support thread alone.
     
    Last edited: Apr 20, 2014
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio v3.5.1 will be live in about 20 minutes. Changelog:

    • Fixed memory leak error on Clip Manager. Now it's been tested with over 4Gb of audio files, and no crash in Unity. Previously I couldn't even import 1Gb. Memory usage doesn't change on repeated usage.
    • Fixed bug with Playlist Controller sometimes not starting a song at beginning when changing Playlists.
    • Added retrigger limit modes to EventSounds. You can choose X frames or X seconds (or neither - the default) which is the minimum amount of frames or time that must pass before the event will be allowed to execute the actions you specified. Useful on collision and trigger events among others.
     
  46. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Perhaps for the next update, this will fix SoundGroupPropertyDrawer to just let you type in a group name like normal when there's no MasterAudio Manager in the scene, instead of just hiding the field and showing an error:

    Code (csharp):
    1.  
    2. #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
    3. #else
    4. using UnityEditor;
    5. using UnityEngine;
    6. using System.Collections;
    7. using System.Collections.Generic;
    8.  
    9. [CustomPropertyDrawer(typeof(SoundGroupAttribute))]
    10. public class SoundGroupPropertyDrawer : PropertyDrawer {
    11.     public int index;
    12.     public bool typeIn;
    13.  
    14.     public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
    15.         if (!typeIn) {
    16.             return base.GetPropertyHeight(property, label);
    17.         } else {
    18.             return base.GetPropertyHeight(property, label) + 16;
    19.         }
    20.     }
    21.  
    22.     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    23.     {
    24.         var ma = MasterAudio.Instance;
    25.         var groupName = "[Type In]";
    26.  
    27.         if (ma == null)
    28.         {
    29.             //Debug.LogError("No Master Audio prefab in Scene. Cannot use Sound Group Property Drawer.");
    30.             index = -1;
    31.             typeIn = false;
    32.             property.stringValue = EditorGUI.TextField(position, label.text, property.stringValue);
    33.             return;
    34.         }
    35.  
    36.         index = ma.GroupNames.IndexOf(property.stringValue);
    37.  
    38.         if (typeIn || index == -1)
    39.         {
    40.             index = 0;
    41.             typeIn = true;
    42.             position.height -= 16;
    43.         }
    44.  
    45.         index = EditorGUI.Popup(position, label.text, index, MasterAudio.Instance.GroupNames.ToArray());
    46.         groupName = MasterAudio.Instance.GroupNames[index];
    47.  
    48.         switch (groupName)
    49.         {
    50.             case "[Type In]":
    51.                 typeIn = true;
    52.                 position.yMin += 16;
    53.                 position.height += 16;
    54.                 EditorGUI.BeginChangeCheck();
    55.                 property.stringValue = EditorGUI.TextField(position, label.text, property.stringValue);
    56.                 EditorGUI.EndChangeCheck();
    57.                 break;
    58.             default:
    59.                 typeIn = false;
    60.                 property.stringValue = groupName;
    61.                 break;
    62.         }
    63.     }
    64. }
    65. #endif
    66.  
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Did you write the original property drawer for this? If so, I'll trust that it works and include it if you've tested it. Let me know!
     
  48. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Yeah that was me. :)
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Awesome, will do, thanks!
     
  50. hemdanw

    hemdanw

    Joined:
    Nov 5, 2012
    Posts:
    14
    Just purchased MasterAudio.
    Followed the video tutorial - and continuously getting error:
    "MasterAudio not finished initializing sounds. Cannot play..."