Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    So I can imagine how it might not sound realistic in 3D, but in my 2D game the LP filter seems like it doesn't fit.
    And I'm mainly thinking of using the occlusion for SFX and ambient sounds which don't require fading.

    So what's the best way for me to add this sort of occlusion effect which adjusts the volume?

    Cheers :)
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It's in SoundGroupVariationUpdater.cs. LateUpdate method calls UpdateForOcclusion method I believe. In there is all the occlusion code.

    If you make something that you think sounds good and realistic, please share with me and I'll consider adding it as an option.
     
  3. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Is there a way to change the bus that a sound group is assigned to at runtime? For example, I have ten sound groups of different ambient sounds; only two will ever be playing at once: one fading in, and one fading out. Can I bounce them on and off of "FadeIn" and "FadeOut" buses or do I need to make ten different buses?
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I don't think there is. Could you explain why you would need that? There may be a way to do it already without switching buses is what I'm thinking. i.e. you can fade Sound Groups as well.
     
  5. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Well I ended up just creating new AudioSources, grabbing the clips from MasterAudio and assigning the AudioMixerGroups to the AudioSources, so that works for now. But the reason I'm doing it currently is because I have lists of ambient sounds that are supposed to play for different weathers and locations and I want to crossfade the lists. I guess I could fade all the sound groups simultaneously but having them all on a bus and mixer seemed nicer if I want to add effects or anything.
     
  6. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    Hi, I'm using Unity 5.1.3f1, because upgrading it for 5.3 crashes my game. So I'm stuck with 5.1.3f1 for now. I created MasterAudio's prefab and the layout is driving me nuts. Is this a 5.1 glitch?

    Thanks.
     

    Attached Files:

  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'll add it in the next version, but this may get you by for now. Not sure if it works, but it might.

    Code (csharp):
    1.  
    2. MasterAudio.GrabGroup("Arrow").busIndex = MasterAudio.GroupBuses.FindIndex(x => x.busName == "NewBusName");
    3.  
     
    Last edited: May 17, 2016
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No idea what you have going on there, but make sure you've grabbed the 4.0.2 version, v4.0 had a lot of bugs. I've used it fine with all versions since 4.3.

    If you're already on the newest version, are there any warnings or errors in the Console window when you see stuff like that?
     
    Last edited: May 17, 2016
  9. jerotas

    jerotas

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

    • Fixed bug where Retrigger Limit using frames caused errors.
    • Fixed bug where Occlusion check after loading a Dynamic SGC on a new Scene would log errors.
    • Changed Occlusion option "Turn on per group" to "Turn on per bus or group".
    • Added "Use Occlusion" option to Buses when "Turn on per bus or group" is on in Occlusion settings.
    • Added option "Include Ray Cast Origin Collider" for Occlusion. Only visible and available on Unity 5.2+. This is for 2D ray casts only, and controls whether the collider you start the ray cast from is considered a hit or not.
    • Removed Transform and followTransform parameters from MasterAudio.PlaySound3DAndForget, since only "Transform" methods should take those.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio is part of the madness sale starting today and running through June 3rd! It's 60% off, for only $18. Perfect time to grab multiple copies as it hasn't been this inexpensive for over a year.

    Our other plugins Core GameKit and Pool Boss are also 60% off "just because". Have a great week!

    -All at DT.
     
    Last edited: May 23, 2016
  11. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    I am wondering if this asset will help with a problem I have with my game. I have a car driving around a scene which is watched from a distance by a static camera, the car can drive through tunnels and canyons and there I want reverb and echo effects to effect the car engine sound, but those effects in Unity can only be applied to the listener which is the camera but that is no in the tunnel etc, does your asset allow for reverb effects to be applied to sounds on objects such that it sounds correct at the camera?
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You'll probably need to change your setup to get this to work right.

    Those effects could be added to a Unity Mixer Group, and another Group without effects. You could have Audio Sources that route to a particular Mixer Group based on whether you're in a tunnel or not. Where the Listener is shouldn't really matter if your effects aren't located there. So, you should be able to solve it with or without our plugin.
     
  13. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Hi team, i just tried installing the master audio 4.0.3 and playmaker and third party package MA_PlaymakerActionsAndScene on new empty unity project now. Then I'm now getting the following console error message.

    Assets/Plugins/DarkTonic/MasterAudio/PlaymakerCustomActions/MasterAudioPlaySound.cs(59,37): error CS1501: No overload for method `PlaySound3DAndForget' takes `7' arguments

    what should I fix this? Thanks.
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That method has lost 2 unused parameters but the Custom Action code wasn't updated. You can edit the Custom Action file to remove them to unblock yourself, but I will post a new one later tonight here. Thanks for letting me know.

    -Brian
     
  15. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Oh, sounds good! thank you.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Here's that action fixed.
     

    Attached Files:

  17. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Great! Thanks!
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem.
     
  19. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    Should I update to v4.x if I have been using 3.5.8.x before? Am I missing much? I am pretty sure I don't need that audio occlusion feature?
    If I upgraded, is the upgrade process simple enough?
     
  20. EgameaUnity1

    EgameaUnity1

    Joined:
    May 17, 2016
    Posts:
    1
    I'm having trouble with unreliable timing of sounds being played via Master Audio. I have code that will play 3 sounds in a row whenever a button is pressed. This works perfect most of the time but about every 6th to 20th time that I press the button the sounds will play at incorrect intervals with 2 of them overlapping. If I bypass MaterAudio and use a standard Unity AudioSource the problem disappears.

    Any idea of what could be causing this?

    Audio recorder when played using MasterAudio:



    Audio recorder when played using a standard AudioSource:

     
  21. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    I have a little feature request which shouldn't require that much work and which would improve the code quality when using master audio.

    Add a editor function which allows to generate an enum of all audio clip names which have been added to master audio and make Master Audio to accept that enum instead of calling all clips as string. This way the user will also get alerted by the editor when an clip has been removed but is still used in code, also typos will not be possible anymore.
     
    Tinjaw likes this.
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There's always bug fixes. I would suggest to go read all the release notes (1st page, 2nd post) for the versions following 3.5.8. Upgrading is easy, just delete the folders:

    1) Assets/Plugins/DarkTonic/MasterAudio
    2) Assets/Plugins/Editor/DarkTonic/MasterAudio

    then re-download from the store.
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No, I have no idea. Haven't heard of this issue before. You might send me a sample project so I can investigate the code.
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    What is funny is that the original version of Master Audio years ago used an enum, and dozens of people complained about it so we switched to strings.

    As far as typos, you should be copy/pasting from the Hierarchy, then a typo is not possible. You also can decorate your Inspector's Sound Group names with the [SoundGroupAttribute] so that you don't even have to copy/paste, just select the Sound Group from a dropdown. If you ever try and play a sound that doesn't exist, you always get an alert in the Console so it's easy to find. And now we even have built-in RelationsInspector integration (magnifying glass icon) that will find components that use a Sound Group so you can delete / unassign them before deleting a Sound Group (only in the current Scene though).

    The enum idea sounds like it might be easy, but it would have to contain the names of all sounds in all Master Audio (and Dynamic Sound Group Creator) game objects in all Scenes, and I have no idea how to go through Scenes to do that. That's one problem, there are more. All the audio plugins I have seen use strings, we are not the only one.

    So while I like the idea (we originally had it that way as I said), it's not practical to do it.
     
  25. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    That's an awesome tip. I'll have to start doing that.
     
    jerotas likes this.
  26. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    I just make a static class called SFX and add public const strings in it, easy.
     
    jerotas likes this.
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    True, or you could put an enum there if you like, and use the Enum.ToString() when you want to play sounds, as long as there's no spaces in the names :)
     
  28. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Aww too bad, however, I think a combination of SoundGroupAttribute and public const strings will do it too. Thanks.
     
    jerotas likes this.
  29. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    @jerotas
    Hey so why don't the PlaySound...AndForget functions return a bool for whether the sound was played or not, that would be nice and it wouldn't cause garbage like the PlaySoundResult versions just to check if the sound got played.

    Cheers
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's a good idea, if it doesn't create Garbage Collection. I think you're right, it probably won't for a bool. I'll add this for the next version.

    However, it will return true if either played or scheduled for future play.
     
  31. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    @jerotas
    Yeah that sounds good. I basically need it so I can easily detect if my sound was played or not based on the Retrigger Limit or stuff like that.

    Cheers
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Makes sense.
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    This has been completed. Next update will have it.
     
    Shadeless likes this.
  34. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Hey Brian,

    Do you have any suggestions for how best to use MA to simulate a car engine sound using a number of loops?

    cheers

    Nalin
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Put all the loops in a single Sound Group as Variations. Make sure that Group is in "Dialog" mode so only one can play at a time and it will stop (or fade out) others that are already playing when you tell another to play.

    Aside from that I think you'd want to change the pitch of the playing variation, which will need to be done through code, using the PlaySoundResult.ActingVariation object that is returned from MasterAudio.PlaySound methods (not the "AndForget" ones though).

    That should get you started.
     
    Last edited: Jun 8, 2016
  36. smasters654

    smasters654

    Joined:
    Dec 20, 2013
    Posts:
    46
    Hi, I am getting an error with Master Audio while using Playmaker:

    Playlist Controller is not initialized yet. It must call its own Awake & Start method before any other methods are called. If you have a script with an Awake or Start event that needs to call it, make sure PlaylistController.cs is set to execute first (Script Execution Order window in Unity). Awake event is still not guaranteed to work, so use Start where possible.
    UnityEngine.Debug:LogError(Object)
    DarkTonic.MasterAudio.PlaylistController:TriggerPlaylistClip(String) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Utility/PlaylistController.cs:840)
    DarkTonic.MasterAudio.MasterAudio:TriggerPlaylistClip(String, String) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:4790)
    MasterAudioPlaylistClipByName:OnEnter() (at Assets/Plugins/DarkTonic/MasterAudio/PlaymakerCustomActions/MasterAudioPlaylistClipByName.cs:20)
    HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
    HutongGames.PlayMaker.FsmState:OnEnter()
    HutongGames.PlayMaker.Fsm:EnterState(FsmState)
    HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
    HutongGames.PlayMaker.Fsm:UpdateStateChanges()
    HutongGames.PlayMaker.Fsm:Start()
    HutongGames.PlayMaker.Fsm:processEvent(FsmEvent, FsmEventData)
    HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent)
    HutongGames.PlayMaker.Fsm:Event(FsmEvent)
    PlayMakerFSM:OnLevelWasLoaded()


    Is there anyway to receive an event in Playmaker with the Master Audio actions when the playlist controller is initialized?

    I looked through google's search results and found a few others having this problem but I didn't find a solution.

    Thanks!
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You would have to code this up if you need Playmaker. However, you may not.

    Note that if you use a Dynamic Sound Group Creator prefab to create a "temporary Playlist", you can fire a Custom Event when its items are created. That Custom Event can be listened to with the EventSounds component, where you can play sound effects and do anything else that EventSounds can do, without writing any code. In this case you wouldn't need to do anything in Playmaker.

    I am adding to the roadmap: optional Custom Events to fire after Playlist Controller is initialized.

    Without coding though, the only thing Custom Events can do is trigger audio actions that EventSounds can perform (which is quite a lot).
     
  38. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Thanks.

    Is there a way to play all the loops at different pitches/volumes to get a richer sound i.e. using cross fading between them?

    cheers

    Nalin
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can set up crossfading by using the fade option of Dialog type group, then setting a fade in time on each variation to match that.
     
  40. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Hi Brian

    I cannot see a method to change the pitch of the playing variation, as the OriginalPitch is simply a get property?

    cheers

    Nalin
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You get to it through the normal AudioSource fields. Like so:
    Code (csharp):
    1.  
    2. var result=MasterAudio.PlaySound3DAtTransform("Arrow");
    3.  
    4. if (result.ActingVariation!=null)
    5. {
    6.  
    7. result.ActingVariation.VarAudio.pitch=1.5f;
    8.  
    9. }
    10.  
    11.  
     
    Last edited: Jun 10, 2016
  42. Yodzilla

    Yodzilla

    Joined:
    Mar 21, 2013
    Posts:
    48
    I'm looking to set up random pitches for a few of my sounds and I have a few (hopefully) quick questions:

    1) Is there any way to change pitch without changing playback speed?
    2) What does the pitch value correlate to? The range can be set from -3 to 3. What do those numbers mean/do? Is that percentage speed of the original sound? Something to do with semitones?

    Thanks for any help you can give.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #1, no. $400 DAW's can't even do this without sounding terrible, especially when lengthening sounds.
    #2, 1 is normal pitch. 2 is double pitch (up one octave). 3 is up 2 octaves. .5 is minute 1 octave. Negative pitches are the same, but played backward, when Unity decides to cooperate and do it. So -1 is normal pitch, backward. I forget what the other negative pitches. You can try them out if interested in backward sounds.

    By the way, the pitch is "normal Unity audio" for the Audio Source component, so there's probably more documentation out there.
     
  44. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    hi, team.
    master audio playmaker action (Master Audio Play Sound's use this location and attach to gameobject) is not working.
    i'd like to play 3d sound but sound object pos is vec(0,0,0) forever.
    of course, this sound's bus control Force to 2D is not enable. i use unity5.3.5.
    Thanks in advance.
     
  45. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Hi all,

    I'm currently running Unity 5.3.5f1 with the latest version of Master Audio (v4.0.3).

    At the start of the scene I start some background music, then when watching a Unity ad (which automatically pauses the game) and finishing the ad, the game resumes, but the background music has now stopped.

    It seems to happen on some devices, and not on others. Any ideas?
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Try turning on gapless song transitions in advanced settings. It's possible that during the ad, the code that does auto-advance to the next song is not running during the ad. Or it could fail due to erratic framerate on some devices. But if so, gapless should fix it since it's scheduled way ahead of time.
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Did you install the latest custom action for that (the one that actually compiles)? The old one has a compile error and I've posted an updated one 1 or 2 pages back on this thread.
     
  48. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Yes, exactly i changed old file to the fixed updated action file and master audio ver is 4.0.3.
    in order to make sure this problem, i tried to play 3d sound using playmaker action in new project(included the Master Audio and Playmaker only), but it's happened. Just in case, i made sure whatever audio source component spatial blend become 3D.
    i took out MasterAudio.PlaySound3DAndForget("TestSound") from c# code on updated action and tried to test a new c# script using it then audio position is remaining on vec 0,0,0.
    MasterAudio.PlaySound3DAtTransform("TestSound",transform) is properly working.
    Thanks.
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, I have fixed the action to work in all 3 modes. Sorry about that. Here's the fixed one.
     

    Attached Files:

  50. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    Awesome! It works fine! Thank you for helping me.