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

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes I missed it, sorry, but I tried and maybe I didn't understand how to use it.

    So here is my case:
    A Bootstrap scene instantiates Master Audio and a Dynamic Sound Group with 2 playlists that load the clip from resources.
    The first one ("MainMenu") has only one song for the main menu (here I set the transition type to "New clip from last position").
    The second one has 3 songs to be used in game.

    So when the main menu scene get loaded, the first playlist starts. Then when in the game it plays the second playlist, and, when I go back to the main menu I call MasterAudio.ChangePlaylistByName("MainMenu");
    But the music starts always from the beginning.

    What I'm doing wrong?
    Thanks
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The feature only works in a single Playlist. If you combine all 4 into one Playlist it will work. Once you change Playlists, it forgets all last positions.
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Question for users with Unity professional. I've implemented Resources.LoadAsync- the new non-thread blocking Resource load available to users on Unity 4.5.3 that have a pro license only. I tested it and it works, but takes longer to finish (vs the non async old option). I counted six frames for a small sample. I'm currently defaulting it to use LoadAsync if you have 4.5.3 and are Pro, but should this be a switchable option to choose between async and sync? If so, would like to switch it per Sound Group, Variation, or just globally?
     
  4. jerotas

    jerotas

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

    • Refactored Event Sounds and Event Calc Sounds script to use zero bytes allocation in 97% of cases (Start & Mouse Drag events need it).
    • Moved fading functions of SoundGroupVariation into SoundGroupVariationUpdater script, eliminating all 3 remaining CoRoutines there.
    • Fixed allocations in Master Audio main loop, down from 20 bytes to 0.
    • Added ability for Sound Groups to trigger other Sound Groups that you specify, in a new "Linked Group Mode" section in the Sound Group's Inspector. Now you can set it up so that whenever the Group "Explosion" is played, Master Audio will also trigger "DeathScream" Group and any number of others you specify. To prevent an endless loop, none of DeathScream's Triggered Groups will be called when it's played as a side effect of another Group. There's an option to play the Linked Groups when the Group is requested or when it's actually Played (not failed to play).
    • Added automatic asynchronous (non-blocking) load of Resource files for SFX and Playlists! Requires Unity 4.5.3 and Pro license. Otherwise it defaults back to non-async.
    • Fixed bug where the next song would be requested multiple times when cross-fading is enabled, resulting in multiple error messages if a Resource filename was entered incorrectly.
     
  5. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I can't combine them in one playlist. So could you expose some methods or a property to read and set the time of a song inside a playlist?
     
  6. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I enter in your case. And I think that a switch per sound group could be enough. Also a question. When do you load the sounds of a sound group from resources? All at the same time or only when they have to be played? If you load them on start, the 6 frames delay should not create problems.
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Why can't you? There's must a reason but I haven't heard it yet. But I'd like to hear it, in case your assumptions about why you can't are incorrect :)

    Anyway, you can read them whenever you want with using the ActiveAudioSource.timeSamples property of any Playlist Controller.

    You could also set it with the same property later.
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    They are loaded only when you tell MA to play them, on a per-soundfile basis, not per Sound Group. So if you need to play Variation 3 of a Group, only that one will be loaded up, played, then unloaded. If we were to load them on start, that would negate the reason to use Resource files (to not take up the so much audio memory at once).

    Ok, I'll put in a switch for each Sound Group.
     
  9. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    The reason is that the play list B loops between 3 songs while you are ingame. The playlist A is only for the menu.
    Also the idea is to have more playlists (B, C, D, ...) each with 3 songs, based on the game level.
    Do you suggest a different approach?

    Oh great!
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    McMorry, it sounds like that's a good reason if you are just letting the Playlist play through songs with auto-advance and none of them loop (because auto-advance won't work with loop). If you are manually telling it when to switch to every song specifically by name, then you could combine it into one Playlist.
     
  11. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes it's correct, but maybe you could load a full group when the first audio is played. For example some groups could be played only during the day, and some others only in the night.
    Anyway I think that is fine to load them just when needed. Especially now with the Async method and the per group switch.
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If we did it that way, we would have to rely on the programmer remembering to unload the group when they're done with it. I don't want to open up that can of worms. Now how it works is that the instant a sound is done playing, it unloads the memory immediately and it's very clean and neat. We don't want anything hanging around when it's not being used exactly at that time.
     
  13. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes that's exactly my settings.
    Do you think that a playlist could keep memory of the last song and time, so that it will automatically restart from there when using the "Last Known Position" transition mode? Or do you think that is wrong this behavior?
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It could store those things sure, and I believe it already does, but song transition mode does not come into play when changing playlists. Otherwise there are other side effects that are unwanted, so that's how I made it work.

    That means that when you play a song from a different playlist, changing the playlist, the new song has to start at the beginning of the clip. Even if you're using "last known position". So you'll need to change the time yourself if you're using multiple playlists.
     
  15. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    Hi, your plugin looks cool. I was wondering if you could enumerate the main advantages of using it in addition to what will ship by default with Unity 5. Also, whether there are any potential pitfalls of keeping it working alongside Unity 5's hierarchy-based audio routing. Thanks much.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm sure these are the questions that everyone is wondering about, but no one has asked yet. I'll do my best to answer them. We've already downloaded Unity 5 beta and made sure there are no problems using Master Audio with it a couple days ago. Current Master Audio features that probably won't be used much by Unity 5 users would be only these two:

    • The bulk clip manager (since you can multi-edit Audio Clips in Unity 5). Although ours is still better for some filtering options and seeing many clips settings as once.
    • Our music ducking feature. Since Unity 5 features a much better and more advanced ducking setup.

    That still leaves a ton of features that MA will give you over native Unity 5 audio. Such as:

    • Setting up weighted variations for sounds (i.e. 3 variations where one is randomly played each time and variation A should be played twice as often as variation B). Variations can also be set to be non-random and play variations top-to-bottom.
    • The ability to use resource files for sound effects or music, which are automatically loaded into memory when you request to play them, then automatically unloaded from memory when done playing. This is necessary to not take up too much audio memory all the time.
    • Resource files also have an easy to use localization feature to support multiple languages.
    • Playlist functionality for music, including cross-fading, auto-advance, shuffle mode, multiple synchronized playlists for layered music, and much more.
    • Unity only allows 32 Audio Sources to play at once. To help focus things and control which are heard, we have included voice limits controls for each Sound Group and Master Audio bus you create. When a voice limit is reached, new audio cannot be played on that bus until one of the clips finishes playing or is stopped. There's also a special mode "Dialog" that stops or fades currently playing sounds in the same Group before playing a new one.
    • An auto-prioritization feature that controls the priority field of all Master Audio audio clips based on distance from the Audio Listener. Since Unity uses the priority field to decide which clips to mute (lower priority) when more than 32 Audio Sources are playing, this can solve a lot of problems in a very busy game.
    • A "no coding" script called Event Sounds that can trigger sounds, playlist, bus and other Master Audio functions from a few dozen common events, including many NGUI, Pool Manager, DF-GUI and MonoBehavior events. Extremely powerful and can do multiple actions from one event, in order.
    • A nice pro mixer view that sits self-contained in the Inspector and has preview, stop, and other buttons for each Sound Group you define, as well as number of actively playing voices (our buses also show this info). Yes Unity 5 has a mixer view but it's mainly for FX and level adjustment.
    • Of course normal Unity problems like having an AudioSource play a clip on one of your enemy game objects, and when that game object despawns, the clip will instantly be cut off. If you used no plugin for this and tried to get around by the audio at a Vector 3 location, you also won't be able to stop or fade that sound once you start it playing. Master Audio avoids this by having all the Audio Clips in a central prefab that never despawns and so doesn't have this problem.
    • Full support for Master Audio actions from Playmaker, Behavior Designer, AI For Mechanim and Dialogue System plugins for "no coding needed" sound power!

    There are a lot of other small and useful features as well. The list goes on and on and requires zero coding on your end, although you can use the API if you prefer to.

    Pitfalls for using Unity 5 with Master Audio? I think there are none. We hope to be adding features soon just for Unity 5 like the ability to assign all variations in a Sound Group to a particular Unity Mixer channel. I hope that answers your questions and let me know if you have any others!

    -Brian
     
    Last edited: Aug 25, 2014
  17. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Maybe I found a bug, or I'm doing something wrong :)
    If I have the master crossfade time more than zero and I call MasterAudio.ChangePlaylistByName with the same name of the playlist currently playing there is a fade out, a strange fade in, and then the music stops.
    It happens when I restart the level reloading the same scene. (may be not the best method, but the faster one to code for now).
    Anyway I'd like to have the playlist to restart from the beginning when I restart the level, so I can't simply avoid to call that method.
    Thanks for any suggestions.
     
  18. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    Sounds great -- purchased!
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thank you sir!
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I think I will actually make that not allowable to call ChangePlaylist with the same playlist. After all, the word "change" means it shouldn't be the same one. What were you actually trying to accomplish by intentionally calling it with the same playlist though? I may add something new if we need it for what you're wanting to do.
     
  21. jerotas

    jerotas

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

    • Fixed empty song bug.
    • Removed "Add empty song" button.
    • Fixed bug where Equalize Song Volumes button would assign zero or infinite volume to songs when one of the songs could not be scanned (compressed and streaming files can't be scanned).
    • Equalize Song Volumes button previously skipped Resource file songs. Now they work the same as Audio Clips.
    • Calling "Change Playlist" requests will now be denied if you try to change to the same Playlist that's already loaded in a Playlist Controller.
    • Added advanced setting "Always Load Resources Async" in Master Audio's Inspector. Defaults to true. Only appears if you have Unity 4.5.3+ pro license. If unchecked, you will see a "Load Resources Async" checkbox in every Sound Group and Playlist that has a Resource file. This lets you choose between Async and traditional thread-blocking Resource loading.
    • Added 3 collapsible categorized sections in Advanced Settings since it was getting a little long.
     
  22. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes that makes sense.
    As I wrote before I have a restart button that starts again the same game level. To accomplish this, I simply load the same scene that, on start, plays a specific playlist. When I come from the main menu the playlist is different and it works fine, but when I reload the same scene the playlist is still the same.
    So why don't you simply introduce a new method StartPlaylist that doesn't complain that is the same one, but that also assures that the playlist will restart from the beginning?
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Will do.
     
  24. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    Quick question: I've created a bunch of sound groups, but now I want to change all of their variation AudioSource settings for min/max distance and doppler. I see there's a GroupVariation prefab that will be used for new groups, but is there a way for me to bulk fix all of my existing variations?
     
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I have that on my list to make a way to bulk apply that to all groups after you change it. Currently there is not. There are 2 workaround ways to do it.

    1) The obvious one: Delete all your Sound Groups and create them again. Each time you create one, it will use the GroupVariation prefab. If you have more than a few, this will not be fun.
    2) On Unity 4+ they added a Copy Component right-click menu option that you can use on the Audio Source component of the GroupVariation prefab to grab your changes values. Then go into each Variation in the Master Audio prefab in your Scene and "Paste Component". That will overwrite the values in the Audio Source component there.

    I will go and ahead a raise the priority of this request, it is currently dead last out of 13. I think I can do it at #5.
     
    Last edited: Aug 28, 2014
  26. akarsh

    akarsh

    Joined:
    Aug 26, 2014
    Posts:
    11
    Hi,
    We are looking to buy MasterAudio plugin,Will this Plugin is able to perform the following functionality..
    I'll try to explain the requirement as clearly as i can.
    >We have pre-existing audio files.
    >We need to input sound from the microphone.>the input from the microphone will be based on how long the user speaks.
    >The existing audio files that are already stored will be cut to match the length of the microphone input.
    >Now, the existing audio file that has been cut will be outputted like the input microphone audio(that is modulating the existing audio file to sound like the microphone input i.e. same waveform.)
    Is this requirement possible with your plugin? Is it possible for you to arrange a demo that would demonstrate this kind of functionality?
    I hope I have been clear, if there's still some confusion or misunderstanding, please ask
     
  27. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    Ah, much appreciated! I did actually try #2, but that also overwrote the audio clip for that variation. What I wound up doing was selecting all of my AudioSources and multi-editing the values I needed.

    At a higher level, it might be interesting to consider some optional way of referencing the AudioSource prefab instead of baking it into the MA hierarchy. Sort of a variant of how AudioToolkit does it (though they have a prefab they instantiate separately). That would also make it easier to use other kinds of AudioSources or AudioSource wrappers, such as those used for binaural audio plugins (for example, 3Dception, which has a free version).

    Thanks for the quick response; the plugin is great.
     
  28. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No, there is no microphone functionality currently, and we don't plan on adding any either. Sorry about that.
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Bulk editing, I didn't know that was possible with Audio Sources. Nice!

    I'll see what I can do as far as referencing a prefab or allowing multiple Audio Source templates that you can manage and choose from. Sounds like a good idea.
     
  30. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hi I'm having an issue on the most recent version where the polyphony voice limit gets stuck and the slider goes away. Also if I try to manually enter a number it just resets to whatever it was.
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Polyphony slider is only settable between 1 and the combined weight of all Variations in that Group. So if you only have one Variation with 1 weight, you can't set it (and the slider has no bar).

    How many variations do you have and what are their weights?

    I'll add a message so the no slider thing doesn't happen.
     
  32. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Wait i'm confused then, what's the call to limit the number of times a clip can be played at once?
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If you don't have Limit Polyphony turned on (it defaults to off), then the limit of each Variation is its weight.

    If you turn on Limit Polyphony, it will limit the combined total of all Variations that can be played in that group simultaneously. It's not a feature I would ever use. I do use the dialog mode though for "limit to one voice playing for this group".
     
  34. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    So how do you limit the number of sounds from a certain sound group to more than one say like 5?
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Limit Polyphony is only for *decreasing* the maximum number of voices, which is normally calculating from weight. You cannot *increase* the maximum except by altering the weight fields of the Variation(s).

    I've just changed the readme to say the above. There's been a few people confused by this. Hopefully it's more clear now.
     
    Last edited: Aug 29, 2014
  36. jerotas

    jerotas

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

    • Deleted unused clip in Example Scenes that was causing a warning when imported.
    • Removed a Playlist restriction. Now it will no longer ignore a request for the currently playing song and say it's invalid. This now works whether it's a Resource file or not. This also means you can put the same song into a Playlist twice or more in a row.
    • You can now crossfade into the same song as well.
    • Vastly improved Resource file tracking for Playlists. The lack of this before was causing intermittent bugs.
    • Added Restart Playlist command to Playlist Controllers, Master Audio static method & Event Sounds.
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  38. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, thanks for the update but I'm running in many little problems not present before with version 3.5.5.1 (I jumped 3.5.5.2).

    First of all I use MasterAudio.ChangePlaylistByName("StartMenu"); to start the first playlist. I don't know if I should do differently (something like StartPlaylist, but I can't find it). Anyway now there is a warning: "Current Playlist is NULL. Subsequent calls will fail.". Probably on line 528 you could use directly the private member and not the public property to access the current playlist.

    Then in my second scene I replaced MasterAudio.ChangePlaylistByName("NorthAmerica"); with MasterAudio.RestartPlaylist("NorthAmerica"); because as I told you I will need to restart the same scene later.
    But when I do this I get this error" Could not find Playlist Controller 'NorthAmerica'. and the StartMenu playlist continues to play. How should I code this? ChangePlaylistByName the first time, and then check if is playing the same to call RestartPlaylist?

    The last problem is that when the new scene is loaded the music has a little high pitch tick. I double checked and on version 3.5.5.1 is not happening.

    Thanks
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, I've fixed the first problem with the fake warning, thanks for that.

    On the second one (RestartPlaylist), actually you don't need to pass the playlist name because it's not changing playlists. Instead you need to pass the Playlist Controller name. But if there's only one Playlist Controller, you can use the overload with zero parameters:

    MasterAudio.RestartPlaylist();

    I haven't seen any tick sounds. You might need to turn on "log all sounds" and see if anything weird is in the logs.
     
  40. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    OH I didn't realize that. But in that case I still have the same problem. The first time I load the scene B I have to use ChangePlaylist and on reload of the scene B I have to call restart. It's not the best. From my point of view should be as easy as to write always and only StartPlaylist("name"). Why to complain if that playlist is already playing? Instead now I have to do some check to see if is the same playlist to use the proper method.
    Ok I'll try it asap and I'll report back here.
     
  41. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Hi jerotas,

    First of all, great plugin!

    Does MA handle (or does any auto pause/resume) suspend/resume events?

    Following doesn't seems to be working (on latest patch release)

    Code (CSharp):
    1. void OnApplicationPause (bool pause)
    2.         {
    3.                 if (pause) {
    4.                         Debug.Log ("Paused");
    5.                         MasterAudio.PauseEverything ();
    6.                 } else {
    7.                         Debug.Log ("Resumed");
    8.                         //MasterAudio.ResumeAllPlaylists ();
    9.                 }
    10.         }
    Resume in the sample is commented because calling it causes play list to restart from beginning.

    I'm trying to handle this as when resuming on iOS (iPad Air) shot piece of music loops few times before it goes back on track...

    Best,
    E.
     
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I got rid of the warning code by using the local variable instead of the Property, as you suggested. There has to be different code for Restart Playlist and Change Playlist because some fields get initialized different when you change Playlist. If I have time, I can try to add a StartPlaylist method that works like you want. I'll check out if ResumePlaylist works for me.
     
    Last edited: Aug 31, 2014
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes it supports pausing and unpausing. If it's a Resource file, it will unload from memory and can't be unpaused unless you check the "Keep Paused Resources" box in the Advanced section in the Master Audio prefab.

    I'm pretty sure the hiccup you're talking about is a known Unity audio issue and there's nothing we can do about it.
    However, I'm not sure you actually need to pause anything from that event as the audio will not be heard anyway when you put the app into the background? i.e. it should pause everything without you calling pause.
     
  44. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Thanks for the prompt reply...

    Actually I've located audio issue, I was using compressed + streaming causing that. Switching to either native + streaming OR compressed + compressed in memory resolves that.

    I won't need that anymore. But it still looks like calling MasterAudio.PauseEverything on pause event still does not pause anything, right? I'm not using resource files btw, all clips.
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ah right, the dreaded streaming hiccup.

    PauseEverything pauses all SFX and all music. However inside Unity I can't get OnApplicationPause to fire for some reason. Maybe the same is happening to you?

    I just tried PauseEverything and ResumePlaylists on one of my example Scenes and it works fine. It doesn't restart the clips from the beginning either.
     
  46. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    I can confirm functions are working fine. If I call pause on resume, or anywhere else, it works.. just not when called in on pause event. There is recent change in patch release, I wonder if that could be related...

    • (584789) - iOS: Update and render additional frame after app suspension. Allows customising paused app's thumbnail.
    Anyways, great work with the MA! Also nice to hear that it's U5 compatible already... ;)
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Which patch is that? That sounds like it would actually make what you want possible, not impossible :). And thank you for the compliment.
     
  48. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yeah I'm on that version too. I guess I never tried to do MA code from ApplicationPause since it seems to pause itself. Well, if it doesn't work, there's not much I can do about it. Can you report the bug to Unity? There's no CoRoutines or anything like that in "StopEverything" so it should work.
     
  50. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Sure, I'll report as soon as this one goes out!