Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[20% off!] 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. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    80
    Hi,

    I have a Windows Store Universal Windows Platform project, which I run inside Visual Studio 2015 on Windows 10, Unity 5.5.0f3.

    Before showing a Windows Ad, I call MasterAudio.MuteEverything() so that all sound is muted while the advertisement is playing. However, the sound is not muted, and the game background music keeps playing simultaneously with the advertisement sound.

    Is there something I'm doing wrong? shouldn't all sound be muted with MuteEverything() ?
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    It worked last time I tried it. Is your music in a Sound Group or Playlist (Playlist is normal), I'll try again and see if it works on my end.
     
  3. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,043
    Just FYI, I still have problems with MasterAudio causing Unity to crash when exiting play mode in the Editor. i.e. Game plays fine in the Editor, audio all works, then when you stop play mode, the Editor crashes and needs to be restarted. Only happens in projects with MasterAudio imported, and stops happening if I delete MasterAudio from the project. Definitely something that needs to be looked into.
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    I would guess that it happens with a failure in the "Persist Runtime Changes" code, you have turned that on in Advanced Settings, correct (off by default)? That's the only code that runs when you press stop. I did fix a couple bugs in that code fairy recently, but they only logged errors to the Console, not crashed Unity.

    If I can't reproduce it, I can't look into it...and no, I can't reproduce it.

    You might want to try it in a new empty project, and find that it doesn't happen there. It may be some weird conflict with another plugin you're using.

    If you send me your project I can take a look, otherwise I have nowhere to start. Or if you can narrow it down to it happening with Master Audio plus plugin X, I can possibly take a look (only if we own that plugin though, not buying something to troubleshoot an obscure error).
    -B
     
  5. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    80
    My music is in a Playlist.
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    I just tested in Example Scene #1 (Standalone_Scene) in the package and calling MasterAudio.MuteEverything does indeed mute the music. So I can't reproduce your problem.

    If you can give me steps to reproduce I can look into this more.

    -Brian
     
  7. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    80
    Fixed it!

    I've never seen anything like this. I had break points inside OnEnable() and OnDisable(). On game start-up, and first scene load, the first break point that got hit was the one inside OnDisable()!!! That didn't look right. I hovered over the break point, and the pop-up showed the correct line number, but that the break point was inside Start()!!! I was left speechless...

    Googling didn't provide any useful answers. So, I deleted the whole UWP project, and rebuilt it from Unity, and now everything works properly.

    I can't thank you enough for you support.
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Glad you are fixed, not sure what caused that weirdness!
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    V 4.0.7 will be live shortly, changelog:

    • Important change: Changed "Occlusion Check Time Gap" setting to "Max Ray Casts Per Frame". Defaults to 4. The other setting wasn't distributing the load correctly on slow devices (mobile mostly). You may need to adjust this new setting to your liking.
    • Fixed bug about stuttering gap on "Gapless" setting when using Song Transition Type of "New Song From Beginning".
    • Fixed warnings in Unity 5 that happen when using "Save Runtime Changes" option.
    • Fixed bug with volume jump during gapless transitions while setting PlaylistVolume from code.
    • Fixed bug: during edit mode, could not change a Sound Group assigned to a bus back to [No Bus].
    • Fixed bug: after unpausing a Sound Group, any playing Variations would not re-enabled the "Updater" script so fades wouldn't work.
    • Fixed issue where a disabled AudioListener would still be used for Occlusion ray casts sometimes. Now it will find the first enabled one.
    • Fixed bug: Audio Clips with Preload Audio Data = true would stop when told to pause.
    • Fixed bug: Relations Inspector showed "MechanimState" settings set to "None". Now hidden.
    • Fixed bug: Relations Inspector did not show Linked groups for some actions.
    • Fixed bug: Doing a bus fade after using AdjustVolume on a Variation would lose the adjusted volume.
    • Added AmbientSound script. There's a control for Sound Group and one for "follow caller" or not. This is the new best way to play ambient sounds, NOT using Event Sounds with Start event.
    • Relations Inspector now shows Ambient scripts as well!
    • Added 2 more smaller range Audio Source Templates. For any Master Audio and Dynamic Sound Group Creator prefabs you are already using, you will need to drag in the 2 new Audio Source Templates to make the red alert boxes telling you about them to disappear.
    • Added Ray Cast Origin Offset slider to Occlusion settings. Also added a way to override that global setting on each Sound Group.
    • Added Ray Cast Frequencies to each Sound Group so you can override the main settings per group.
    • Added "Frequency Change Time (sec)" field on Occlusion Settings. Defaults to 0. This controls how long the new target frequency from the occlusion ray cast will take to transition. During this amount of time, there will be no further ray casts or occlusion calculations.
     
  10. gypsycamp

    gypsycamp

    Joined:
    Sep 2, 2015
    Posts:
    9
    Hey, I am running 3 clips synchronized in one playlist, so far so good, but they do not crossfade. I need to be able to achieve nice dovetailing crossfades. Is there a way to fix this?
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    If you are saying that you have Song Transition Mode set to "Synchronize Clips" in that Playlist, then each song will automatically loop and will not change to the next song automatically, unless crossfade time = 0. It's not possible to have auto-advance work with crossfading and synchronize at the same time because of unsolvable bugs, so it's been disabled and you will notice that the song is looping at runtime even if you didn't check "loop".

    You can crossfade to the same point in a different song at any time, but you need to tell Master Audio to go to the next song because they're looping and will not auto-advance as I said.

    i.e.
    Code (csharp):
    1.  
    2. MasterAudio.TriggerNextPlaylistClip();
    3.  
    Or use EventSounds for a no-coding approach. Can you confirm why you're using the Synchronize Clip setting? It might not be what you want...
     
  12. gypsycamp

    gypsycamp

    Joined:
    Sep 2, 2015
    Posts:
    9
    Ok, so no auto Advance then, what I want to achieve as with a normal playlist is to be able to overlap the playing clip to get the reverb tail. Since master audio don't support bpm sync, synchronized playlists is a way of mimic the transitions from different arrangements on beat. Without the tail and overlapping crossfade it is hard to get a nice transition. I work mostly with orchestral music so the reverb tail is important. I guess I can fake it by having 3 playlists play at the same time, not synchronized and just change volume to have only one audible with volume above 0, over time they will not be aligned though I guess.
     
    Last edited: Feb 9, 2017
  13. gypsycamp

    gypsycamp

    Joined:
    Sep 2, 2015
    Posts:
    9
    Just to be clear, the crossfade auto advance I want to achieve is at the end of each loop when it loops so to speak. But still retain the synchronized behavior so that the clip do not start from the beginning as is the behavior when synchronized clips is off.
     
    Last edited: Feb 9, 2017
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Have you tried adding the reverb to the Mixer Group in Unity instead of baking it in the track? Then would you not need crossfading?

    Why would the 3 playlists not be aligned? Not following you here.
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    I understand. As I said, there are unsolvable bugs with that approach, so it's disabled.
     
    Last edited: Feb 9, 2017
  16. gypsycamp

    gypsycamp

    Joined:
    Sep 2, 2015
    Posts:
    9
    It worked out with three playlists set to play on start. I then adjust the volumes so they crossfade between each other, but not in synchronized mode to allow auto advance crossfades for my reverb tail. Unity's built in reverb is not preferable for me and since we working mainly with mobile I try to stay away from the run time effects to save performance. I often experience that a regular playlist can loop strangely, not at the exact spot the same time so thus I am worried that three playlists over time will loose synchronicity, if they do not slip up in the same frame.
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Correct, if you don't have Gapless Song Transitions turned on (which only works when cross-fading is off), there's a 1-2 frame time randomness of when the crossfading track will start. Can't really do anything about that.

    You're still using crossfade right?
     
  18. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    I am currently on Master Audio V 4.0.7 and I'm experiencing some heavy gc-allocs every frame:


    It seems like soundGroupVariation.LowPassFilter is calling GetComponent<AudioLowPassFilter>() per frame since it's always null (I'm not using Low Pass Filter)?

    Do you know what might be the solution to this?
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Someone let me know about this last week. Fixed already, for the next version. If you have no Low-Pass Filter, then you're not using Occlusion, so comment out line 599 of SoundGroupVariationUpdater.cs.

    This line.
    Code (csharp):
    1.  
    2. // occlusion
    3. UpdateOcclusion();
    4.  
     
    dreasgrech likes this.
  20. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    179
    Hey, hope you're doing well! I recently purchased your asset and have been integrating it, and I really like how easy it is to work with! I did have a couple of questions....but then I read your excellent documentation and API and was able to figure it out! (retrigger percentage for sounds to play faster, and then the ability to load sounds when needed using unity 5's disable audio preloading option)

    Thanks so much!
     
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Awesome, keep in touch if you have any more issues or questions!
     
    zornor90 likes this.
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    V 4.0.8 will be live in a few minutes. Changelog:

    • Bug fix: Occlusion code no longer causes any Garbage Collection when occlusion is turned off (or on), except possibly during the frame that you turn it on during runtime (which wouldn't happen in normal game play I think).
     
    dreasgrech likes this.
  23. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    I'm currently trying to create a MasterAudioGroup at runtime with clips that I dynamically load from my Resources folder, but I can't find any methods which facilitate creating a MasterAudioGroup by code at runtime.

    The closest I've found is in MasterAudioInspector.CreateSoundGroup(AudioClip), but is there anything that is accessible during runtime?

    ---

    Another option I could possibly work with is having the MasterAudioGroups already predefined but having no variations at the start. Then at runtime, I could add the AudioClips as a SoundGroupVariation to the MasterAudioGroup. Is that possible/feasible?
    I think the call for that would be MasterAudio.CreateGroupVariationFromClip(...) ?
     
    Last edited: Feb 24, 2017
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    There's a static MasterAudio.CreateSoundGroup (I think is the name) method that is used by the Dynamic Sound Group Creator game object. You could use that, but it takes populating a LOT of fields and objects to use properly. Not really meant for usage outside of the DGSC and not supported for other purposes. That's because there are tons of options for a Sound Group and you'll need to supply values for all of them.

    Why do you want to load Resources dynamically at runtime? You know you can use Resource file names directly in the Master Audio UI right? And that takes care of unloading them when they aren't playing (saves on audio memory), which your code probably will not.
     
    Last edited: Feb 24, 2017
  25. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    No, I didn't know that.

    I'm now trying out having the variations set as Resource instead of Clip in MasterAudio, but encountered an issue where I'm unable to access the actual AudioClip after starting to play this variation.

    Code (CSharp):
    1. var playResult = MasterAudio.PlaySound3DFollowTransform(groupName, sourceTransform, 1, pitch, 0f, variationName);
    2. var audioClip = playSoundResult.ActingVariation.VarAudio.clip;
    3. // audioClip is NULL
    This works as expected when using the non-Resource variations. Is this due to some async loading operation taking place with the Resource variations?

    The only reason I want to access the clip is because I need it's "length" (audioClip.length).
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    You may be correct. Perhaps it is because it's still loading (async) and not playing yet as you said. That may be what's going on. What do you need its length for? Just trying to make sure there's not another way to do what you're trying to do, which may already be built in so you don't need to code...
     
  27. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    But I love to code! It's usually much less maintenance for me when I handle things in code rather than fiddling around in Inspectors :p If there's a coding vs non-coding, I'd always go for the coding way.

    The reason I use the length of the clip is because I'm doing some calculations with it to determine at which point of the song I should skip to because they need to be synced with other songs.

    I could have the length of the clips hardcoded in some Inspector and then manually having to set all of the clip lengths in these Inspectors, but it's much more convenient and maintainable to simply access the length of the clip directly.
     
  28. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Ok, you like to code. As long as it's not reinventing the wheel I'll help you out of course :)

    You lost me with "song". If it's a song you should be using Playlists not Sound Groups. Playlists can still use Resource files as well. There are extensive syncing features in the Playlist Controller. Have you looked into them?
     
  29. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    MasterAudio.HasAsyncResourceLoaderFeature() <- currently that's hardcoded to true, but if I change it to false I get the expected result and everything works fine because SoundGroupVariation.Play(..) loads the file using the non-async version (PopulateSourcesWithResourceClip(..)).

    Would it be at all possible to have this as an option that specifies whether Resource clips should be loaded synchronously or asynchronously?
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    You're looking in the wrong place. That setting is used yes, but there's another setting in Advanced Settings / Resources, which is set to "on" by default, called "Always Load Resources Async". You can change that to "off" if you like. Just uncheck the checkbox in the Inspector. The setting you called out is used to determine whether to display the "always" checkbox in the Inspector or not.

    However that can cause frame rate stutter if it doesn't load async (depending on the size of the Resource file and the target platform) as the frame basically waits for it to finish loading, which is why we default the option to "on".
     
  31. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    197
    Thanks, I've now unchecked "Always Load Resources Async" from MasterAudio and unchecked "Load Resources Async" from the individual MasterAudio groups.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Ok, you should be set then :)
     
  33. Amalfi-Prozen

    Amalfi-Prozen

    Joined:
    Feb 2, 2014
    Posts:
    32
    Hi, in this plugin is there audio occlusion for unity 2D (Collision2D, rigibody 2D, SpriteRender, ecc..).
    Thanks for answer!!!
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Yes. There's a ray cast type selector in the Occlusion settings, where you choose Physics3D or Physics2D. SpriteRenderer - I have no idea what that has to do with raycasts, so I don't know. But the others yes.
     
  35. Amalfi-Prozen

    Amalfi-Prozen

    Joined:
    Feb 2, 2014
    Posts:
    32
    thanks, I bought!!!!
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Excellent, let us know any questions you have when you get into it.
     
  37. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    390
    The pause playlist functionality is no longer working for me. Seems to have broken when I updated the plugin. Any advice?
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    I just tried on the Standalone Scene that's included and it works fine there. Does that work for you?

    If it does, you'll need to let me know what specifically to try that might not work. You also may need to send me a sample project that reproduces the bug since I may not be able to reproduce it otherwise. There are a ton of Playlist and other settings that could be a factor here.
     
  39. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    446
    Hi. This is a very basic question. Sorry if it was covered before. I would like to play sounds independently from one another. I have several variations in the same group. Not sure if that makes any difference. Currently, if I call
    Code (CSharp):
    1. MasterAudio.PlaySound("success");
    several times in a row with a 1-second interval, the sounds never overlap. Is there a way to change that behavior so that the sounds play asynchronously?

    Thanks.
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    You can only have one of that sound play at a time because you've kept the default "Voices / Weight" field value of 1. Go change it to whatever max you want (max number of that Variation that can play at the same time). However, if you have 3 Variations (all have a default of 1 initially), you should be able to play 1 of each Variation all at the same time. Unless you have changed the Sound Group to "Dialog Mode".

    Yes, someone asks this question about once a month, consistently.
     
    zornor90 likes this.
  41. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    179
    Haha...was literally about to ask this XD. Thanks, that's actually a really smart way to handle things
     
  42. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    446
    :):). Thanks! That was what I was looking for.

    Any way to quickly change Voices/Weight for the entire group? I have over 200 variations. I found the "Eq. Voices" button, but it only resets everything to 1.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    It looks like I have bulk copy settings for just about everything except that :(

    I'll add it to the roadmap to add in that button in the copy settings section for Groups. You're going to have to change each Variation one at a time. Sorry about that!
     
  44. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    446
    Yes, that would be nice :) Until this is implemented, can I write a script for bulk changing "Voices / Weight"? Is it possible, and how can that field be accessed?

    Also, is it necessary to have both Voices and Weight combined in the same field? Just curious.
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    You could write a script if you want the same weight on all Variations. Probably easier to just modify the MasterAudioGroupInspector code so that "equalize weights" button does it. Just change line 1695 value of 1 to whatever your weight should be.
    Code (csharp):
    1.  
    2. vari.weight = 1;
    3.  
    It is totally necessary that Voices and Weight are the same field. Here's why. When the weight is > 1, extra copies of that game object are created at runtime during the Awake event. Now each game object under the Sound Group can play only 1 sound at a time (don't allow PlayOneShot as explained in the docs because it gives up a lot of control over the individual sounds), so yes the weight = voices automatically. Because when you tell MA to play Sound Group X and pick a Variation at random, it picks one of the game objects randomly. Make sense or no?
     
  46. bradbecker

    bradbecker

    Joined:
    Dec 26, 2014
    Posts:
    98
    Similar but different problem: multiple objects in the game that use the same Ambient Sound Group with multiple variations. Only the first object will actually plays the sounds. All other objects are silent. Weights are > 1 and polyphony is not limited. Not in Dialog mode. Tried in both Normal mode and Chained Loop mode. Anything else I should check or can multiple objects not share the same ambient sound group?
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    Just did a test, put 3 cubes with the same Ambient Sound script into the Scene, and am able to hear the sound from all 3. So I can't reproduce what you're *not* hearing. I hear all 3 different Variations.

    It's definitely not going to work in Chained Loop Mode though, with multiple things using the same Sound Group. That will mess with the randomizer.

    I would make all the Variations loop while you're figuring out what is going on. Does the mixer show that they are all playing and you just can't hear some of them?

    Ah, are some of the game objects with the Ambient Sound script too far away from the Audio Listener (distance greater than the Max Distance of the Variation's Audio Source)? If so, they aren't supposed to play until they're in audible range. That's mostly why the Ambient Sound script was built, to manage this and not have ALL ambient sounds playing all the time, which is terrible for performance (and hard to track which ones you're actually hearing).

    Let me know what you discover.
     
  48. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    446
    Thanks for the suggestion! Changed line 1550. Works like a charm.

    So if I have 300 variations with voices/weight set to 5, MasterAudio creates 1500 game objects on Awake()? I may be wrong, but isn't that too resource-intensive, especially for mobile?
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    It could be (by default) depending on the size of the audio clips. The number of Audio Source components that aren't playing anything has no performance impact, only an impact on audio memory. The copies of each Variation with the same clip take up 0 audio memory as of Unity 5 though.

    Other things to help on audio memory:
    1) Use resource files instead of "preloaded Audio Clip". That way the audio memory of the wav / ogg file will only be used when it's playing then automatically unloaded. This can cause slight latency as the clip loads before it can play. It's a trade off and useful for sounds that aren't played very often. Unchecking "Preload audio data" on the import settings of the clip does the same things as well. Automatic loading / unloading.
    2) I don't believe that a mobile game needs 300 Variations set up all at once. Investigate using Dynamic Sound Group Creators for per-Scene or temporary Sound Groups.

    Having a lot of game objects doesn't really matter unless you're doing a terrible coding practice such as:

    GameObject.FindObjectOfType

    But you wouldn't do that, right? :)
     
    Last edited: Mar 9, 2017
    username132323232 likes this.
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,149
    V 4.0.9 will be live in 20 minutes. Changelog:

    • Changes to Linked Groups (on Sound Group Inspectors). There is no longer the option of "Play when Requested", only "play when played". Now there are separate sections for "Start Linked Groups" and "Stop Linked Groups". The "Start" ones are as before. The "Stop" ones enable chaining of Sound Groups, and play when the Sound Group's Variations stop playing. This lets you set up chains of FX.
    • Added "Linked Groups To Play" dropdown for both Linked Group types (start and stop). Choices are "All" (default) and One At Random.
    • SoundGroupAttribute now has a gear icon to edit the chosen Sound Group, and preview / stop icons.
    • Added preview and stop buttons to Sound Group settings on Event Sounds.
    • Master Audio game object is now in the Ignore Raycasts layer.
    • All children of Master Audio game object (followers / variations / etc) now take the layer of the MA game object once the Scene starts. This will help make the triggers used by Audio Listener Follower not interfere with raycasts.
    • Now having more than one of the same Sound Group set up in Music Ducking will log a warning to the Console and show you a red error box in the Inspector.
    • Added a button to Copy Settings in Sound Group's Inspector so that you can bulk copy the Voices / Weight field from one Variation to any/all others. This field was strangely missing from that section.
     
unityunity