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
    Ok, from what I'm reading:

    http://docs.unity3d.com/Documentation/Components/class-AudioManager.html

    it sounds like you should set it to Best Performance (to get least latency), not Best Latency...that's how I'm reading that document. Any takers?

    Master Audio *should* have zero (or extremely extremely low) latency when playing non-Resource clips because we're not Instantiating or loading anything before playing the sound. It's already there in the Scene, pooled and ready to go.

    This is not true of SoundManagerPro or Audio Toolkit. They both Instantiate on demand and then pool if there's enough instances available. Otherwise they Instantiate more. I call that half-pooling and I think it is borderline false information to say they pool.
     
    Last edited: Jan 22, 2014
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio V 3.3.4 is submitted and should be live in a few minutes. Lots of cool stuff in here that has been requested by many different people! Changelog:

    • Upgraded the optional AudioSource prioritizer to include clip age (time since clip started) in priority calculation. This is all optional, and settable per Sound Group.
    • Added an optional callback method to MasterAudio.FadeSoundGroupToVolume so you can execute code when the fade is finished.
    • Added an optional callback method to MasterAudio.FadeBusToVolume so you can execute code when the fade is finished.
    • Added a Text Group Filter field to the mixer section so you can type a wildcard part of a Sound Group name and filter all results to only those that match.
    • Added many new PlaySound methods: PlaySoundAndForget, PlaySound3DAndForget, PlaySoundAtTransform, PlaySoundAtTransformAndForget, PlaySoundFollowTransform, PlaySoundFollowTransformAndForget. The "AndForget" methods don't create a PlaySoundResult (return type is void). Marked PlaySound3D methods as deprecated. You will need to change those to PlaySoundAtTransform or PlaySoundFollowTransform to be able to compile - don't worry because the error in console will tell you what to do.
    • Updated EventSounds and Playmaker Custom Actions to use the new PlaySound methods.
    • Performance upgrade, got rid of repeatedly called CoRoutine in PlaylistController. Now there are no more of these in MA.
    • Added checkbox for "Log Missing Events" on EventSounds. Defaults to on. If you are creating Custom Events during, turn this off if you want to use them in that EventSounds script.
    • Fixed bug where manually calling CreateItems on Dynamic SGC would not do anything in certain cases.
    • Fixed example scene so that the Dynamic Sound Group Creator clip is not missing.
    • Added Disable Logging checkbox for release builds. Overrides MasterAudio and Group logging settings.
    • Calling MasterAudio.StopAllOfSound now will cancel scheduled sounds that haven't started playing as well (delay parameter > 0).
     
    Last edited: Jan 22, 2014
  3. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051

    Sounds great! No randomize delay on looped chain playback?
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I ran out of time and wanted to get this batch of updates out. That is #2 on my prioritized list right now :)
     
    Last edited: Jan 22, 2014
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I had a half hour so I whipped it out sonicviz.

    V 3.3.5 is being submitted now. Changes:

    • Fixed bug where Chained Loop Groups no longer worked properly after V 3.3.4
    • Added Clip change delay min max for Chained Loop groups. This will specify a range for random pausing between the chained clips.
     
  6. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    A1. ty!
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Not a problem!
     
  8. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I think it would probably be better at a per-Playlist Controller level, as then you would be able to have two different playlists playing at the same time with different crossfade amounts, if I'm understanding it correctly.

    You're awesome!

    The only I reason I'm asking is that with linear crossfading, there is a perceived "dip" in sound when the crossfade takes place if the two clips have roughly the same volume at their fade points. I think equal power fades would be better, as this is the default type of fade in Pro Tools when using crossfades. Here are a bunch of links I found while looking for equations. I'm not sure if you want to go through all this math... I sure wouldn't!

    http://stackoverflow.com/questions/10168842/equal-power-crossfade-in-audio-unit

    - The first picture in the above link is what I "think" is an equal power curve, or at least that's what it looks like in Pro Tools.

    http://avp.stackexchange.com/questions/8002/whats-the-exact-curve-for-natural-audio-fading

    http://forum.liine.net/viewtopic.php?f=25&t=1543

    http://www.soundonsound.com/forum/showflat.php?Cat=&Number=818288&Main=818011

    http://math.stackexchange.com/questions/4621/simple-formula-for-curve-of-dj-crossfader-volume-dipped

    As it turns out, it had nothing to do with Unity or Master Audio. It was Dolby Digital Live which causes around a .1 second latency. Going out from my sound card using S/PDIF to my receiver, I have to use Dolby Digital Live or DTS Connect to get 5.1 surround sound. However, that encoding takes a little bit of time. Plugging my headphones directly into the analog out of my soundcard results in latency free sound.

    Actually, from that document and if Unity works like a Digital Audio Workstation, Best latency should give the lowest latency. In Pro Tools and Cubase for example, setting the buffers really low results in very low latency but the CPU usage will go up pretty fast, meaning "Best Latency". Setting the buffers higher results in longer latencies but the CPU usage is minimal, hence the "Best Performance". I'm guessing the default is somewhere in between. Searches on the Unity forum reveal the same, as people who were having trouble with iOS audio latency found fixes by setting the iOS DSP Buffer Size to Best Latency.

    Thanks for the updates btw! Would you recommend deleting the Master Audio folder and then re-importing, or just importing the package on top of the previous one when updating?
     
  9. mbreitkreutz

    mbreitkreutz

    Joined:
    Dec 4, 2013
    Posts:
    23
    I usually just import on top of the previous version. The only problems I've had when doing this are my own fault due to the fact that I've placed everything in a subfolder so I have to manually move newly added files and this sometimes has complications.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Normally you can just import with the existing files in place. I take care to make sure that works whenever possible, which is the vast majority of the time. Just check the release notes (under the OP on page 1) for any breaking changes since your version and read if there's anything you need to do on those. If not, yeah upgrade in place.

    Great to hear about the latency! I agree with your assessment.

    The fader maths, not so sure. I will take a look at some point. Thank you for the links.

    Per playlist vs per playlist controller crossfade time - if we do per Playlist, that means when you change playlist in the same playlist controller, it could have a different crossfade time. If not, then it would respect the playlist controller crossfade time. Which is more useful or less confusing? A playlist controller is just a host for playing various playlists. Only one playlist at a time though.

    I was also toying with the idea of making a checkbox in each playlist controller for "allow ducking", which would default to true. So you could have 3 controllers with layered music going on, and have only the drums duck, for instance. Cool or not? Easy to add.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Sorry about that! You can try to move them back to their original location before upgrading, then move them back to where you want, if that's any less stressful - it may not be.
     
  12. mbreitkreutz

    mbreitkreutz

    Joined:
    Dec 4, 2013
    Posts:
    23
    Yeah, that's what I do if I run into any problems. It's pretty minimal, though, and not much of a hassle at all. Usually I just have to move the DarkTonic folder into my folder and everything's fine then.
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  14. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! Is there a way to trigger sound based on collider tag, if I have different tags? i.e., if I want to have footsteps, and I have 2 collision plane, one with tag 'concrete', second with tag 'wood', then I add event component to my main character->Collision->Tag filter, does that mean, that for seconds type, I need to add another event component, with different tag selected?

    Or should I, actually, go the other way around, and for every different plane add component, which reacts to character? Still, if I have 2 characters with different boots, that means I still needs to add 2 script event instances to every plane?
     
    Last edited: Jan 23, 2014
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I would put the EventSounds script on the 2 collision planes, and just add a tag filter (or layer filter) for the Player's tag / layer. That way you don't have tons of different components on the player.

    Yes, there's no way to do multiples right now. But you do have minimal mode so they don't need to be huge :)

    The other option is you can send a custom event (using EventSounds) when the player collides with things, then write a custom event receiver to decide which sound to play. That would require code of course.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Heads up to our users that our other "Swiss Army Knife package" Core GameKit (previously named Killer Waves) is on sale for $5 (normally $60) for 48 hours only, starting now! Here's a link.

    The sale is to celebrate the release of a new vastly improved and more powerful V3.0 that includes a full pooling combat system, as well as full access to World Variables in all our Inspectors, a la Playmaker.
     
  17. Steamroller

    Steamroller

    Joined:
    Jan 2, 2013
    Posts:
    71
    Is it possible to crossfade while changing playlist? When I change playlists it seems to just pop from one playlist to another.
     
  18. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Yes, following your clues, I make it even better!
    Just one thing, I find that Dynamic SGC.PopulateGroupData currently is a private function.
    I don't actually want to modify MA source codes but it seems impossible to call WWW.audioclip in Awake() since WWW always need to return an IEnumerator and Dynamic SGC call PopulateGroupData once in Start().
    Eventually I have to change PopulateGroupData to public, so I guess you may consider it too?
    Anyway, you're very kind and thanks for your help :)
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'll see if I can get that to work in the next version.
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You don't need to call PopulateGroupData anymore. It's called automatically inside CreateItems :)

    What are you using WWW for? An asset bundle? I don't think you'd want to call that in awake. Anyway it wouldn't finish downloading by Start.
     
  21. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    PlaySound3DFollowTransform = follows the passed transform's position (if it's moving)?
    PlaySound3DAtTransform = will stay at the passed transform's position, even if the transform is moving?

    Could you please post an example on how to use the new callback?
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's correct about the PlaySound methods.

    Are you asking about the Fade command callbacks, or a different one?
     
  23. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Yes, I'm not sure how to use them properly.
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'll get you an example in a few hours when I'm at my computer.
     
  25. mbreitkreutz

    mbreitkreutz

    Joined:
    Dec 4, 2013
    Posts:
    23
    I just used the callback in my code:
    MasterAudio.FadeSoundGroupToVolume(group.name, 0, 2, delegate() { MasterAudio.RemoveSoundGroup(group); });
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thank you, that looks like how I do it too. You also can specify a method name instead of using a delegate, but the delegate is less code.
     
  27. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi jerotas,

    I've imported the latest Master Audio (3.3.5), extracted the Playmaker package, and the Playmaker action Stop All Of Sound still doesn't stop scheduled sounds from starting after a delay. Can you do a quick test to confirm this on your end?
     
  28. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yep, you're right, it's broken again. I'll hunt down the right fix.
     
    Last edited: Jan 24, 2014
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I've found the problem and fixed it. It will be in the next update.
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio V3.3.6 is submitted to the Asset Store and will be live in a few minutes! Changelog:

    • Fixed bug (again) where Calling MasterAudio.StopAllOfSound would not cancel scheduled sounds that haven't started playing (delay parameter > 0).
    • Fixed it so that when you change playlists on a Playlist Controller, cross-fading still works.
    • Fixed Dynamic SGC so that in Hierarchy view you cannot click "Upgrade data" or drag-create groups, since those don't work there. It tells you to drag the prefab into the scene instead, when selected.
    • Fixed MasterAudio prefabs so that in Hierarchy view you cannot click "Upgrade data" or drag-create groups, since those don't work there. It tells you to drag the prefab into the scene instead, when selected.
     
  31. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    The new PlaySound*AndForget() methods are excellent -- thanks for them! I'm a little resentful -- you're forcing extra work on me -- My first AssetStore review, 5 stars of course :p
    There's a minor bug when used that if you have variations in your group, all variations play simultaneously.
    Here's a quickie patch https://gist.github.com/Arakade/8608912 in case useful.
    HTH, Rupert.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thank you. Now how do you get that bug to occur?
     
  33. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    I have an MA Group with 2 effects which I'm calling with MasterAudio.PlaySound3DFollowTransformAndForget(effectShotName, shot.transform);
    Noticed I'm getting both sounds.
    HTH
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Awesome (not really), thanks!
     
  35. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Should it be possible to loop a clip (like one from garageband that's meant to be seamless) within MasterAudio? I'm getting a slight pause between cycles when it loops in Unity.

    Thanks
    Jim
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If that's happening, it's just not properly loopable in Unity. We use the same audio engine, and built lots of things on top of it, but we have left looping completely alone. It's just a clip in an AudioSource with loop turned on, under the covers. The clip may not be seamless after all.
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You may want to try it as a wav instead of an mp3, if it's an mp3 currently. I heard that mp3's normally aren't gapless.
     
  38. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    Yep, that was it, when I import a native Aiff, there is no gap but when I used an mp3, it turned it into an oggvorbis which resulted in the gap.
    Thanks for the quick support.
    Jim
     
  39. Steamroller

    Steamroller

    Joined:
    Jan 2, 2013
    Posts:
    71
    I've update to the latest version and still can't get cross-fade to work. I've changed the cross-fade time on the master audio controller to something crazy like 10 seconds and still no luck. Is there something I'm missing.
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Glad to hear it!
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I just downloaded the latest, and you're right. Somehow the newest code is not there. I will re-submit ASAP.
     
  42. Steamroller

    Steamroller

    Joined:
    Jan 2, 2013
    Posts:
    71
    Awesome! thanks for the quick reply.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Not a problem. It's now submitted and it's live. I have to go for a bit now, so I can't confirm if the code is correct this time. Let me know if it's still not working!
     
  44. Steamroller

    Steamroller

    Joined:
    Jan 2, 2013
    Posts:
    71
    Works perfectly! Thanks for the fix!
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Any time!
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Submitting a tiny update V3.3.6.2 - I had mislabeled some Project View warnings saying they were Hierarchy View. That could be confusing! That's the only change. It will be live in 10 minutes.
     
  47. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    How should one do the same DynamicSoundGroupCreator setup (I) in multiple levels and (II) on-demand in levels?

    E.g:
    A. Splash scene and multiple Menu scenes don't use any weapon sounds.
    B. Levels 1-5 use weapon 1.
    C. Levels 6-10 use weapon 1 and any of weapons 2-4.
    D. Levels 11-20 might have any of weapons 5-50 (depending on pickups or something).

    My first guess for (I), is either of two choices:
    1. Do from code using MasterAudio.CreateNewSoundGroup() (not ideal)
    2. Create customized DSGC prefabs for (B) and (C). Something like:
    - drag original DSGC to level 1, setup appropriately, drag to Project Hierarchy as DSGC-B
    - drag original DSGC to level 5, setup appropriately, drag to Project Hierarchy as DSGC-C
    - Manually place DSGC-B in Levels 1-10
    - Manually place DSGC-C in Levels 6-10 (so these levels have 2 DSGCs in.)

    But what about (II), i.e. (D) ? Doing (2) for each weapon means overhead of those instances in all levels. Best I can see is leaving each weapon's DSGC prefab in hierarchy and informing my PowerUps of which one to Instantiate() in the scenes when needed.

    Also, I guess I'll leave those DSGCs as "Auto-remove" so they get tidied-up appropriately? Hm, my game's multi-player so I'll need some count to ensure each is only tidied after *all* of that weapon has gone. E.g:
    - P1 gets Mines, DSGC-Mines is instantiated, count++
    - P2 gets Mines, DSGC-Mines.count++
    - P1 runs out of Mines, DSGC-Mines.count--
    - P2 runs out of Mines, DSGC-Mines.count-- <= 0 prompts DSGC-Mines to remove itself.

    I've used a similar pattern for things before so it wouldn't surprise me... :)

    What are better ways to achieve (I) and/or (II) ?

    Thanks in advance!
    List-Happy-Man ;-)
     
  48. jeffc42

    jeffc42

    Joined:
    Feb 9, 2013
    Posts:
    3
    I also see this problem, though in my case it's so bad it was preventing me from upgrading to the current version. Your patch worked for me!

    One simple way to reproduce this is to up the weight (instances) for a sound to a large number. All will play simultaneously, creating a distorted loud sound. I use random pitch on one sound, and for that sound all random pitches play simultaneously creating a sonic mess.
     
  49. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Glad I could help, @jeffc42
    Yeah, I use increased weights and random pitch like yourself. I didn't investigate whether that was part of the problem. Hopefully it'll help @jerotas reproduce if so! Thanks!
     
  50. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    A little curio I noticed while experimenting with DynamicSoundGroupCreators:

    How come DSGC keep all of the design-time stuff hanging around after adding their bits to the MA singleton? (e.g. Both DSGC child DynamicSoundGroups and their child DynamicGroupVariations stay as do their AudioSources. They do seem to delete their filters though.) Are they used? I can see you probably need the DSG and DSGV but guess the AudioSources could be zapped, no?

    No stress, just one of those little things noticed :)

    (time passes)

    OK, I couldn't resist. I added GameObject.Destroy(aVar.audio) and GameObject.Destroy(aGroup.audio) around DSGC line 162 and it seems fine (albeit with the DSGC Editor GUI looking a little bereft!). Worthwhile? (yeah, probably just micro-optimizing without any need ... but I like my scenes leeeean! ;-) )