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

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    That's fine when I'm running a build of my game from scratch, when my manager scene loads first, but I spend most of my time with that manager scene open + another Active Scene open (a game level) for developing (scene is active so I can adjust lighting settings etc properly). I might just be missing some obvious way around this, I'm a very green coder!

    I'm guessing you changed the way this was handled recently though (or script execution order?), because I've been using MA in the above fashion for ages with no problems. It's just when I updated yesterday for the ambient sound upgrade this began happening. So 1-2 versions back it was fine.
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    AmbientSounds I believe always had that script execution order. But even if not, that alone couldn't cause this problem anyway. The script execution would only matter if both scripts were in the same Scene as it was loaded, but if you're getting it broken then you're loading a Scene first that has AmbientSound scripts, and then later loading a Scene with MasterAudio in it, which is precisely the reason it doesn't work. Master Audio game object must already exist in the Hierarchy when AmbientSound script becomes enabled. Otherwise it's ignored and doesn't work.

    I'm saying you need to load the Scene with the Master Audio game object first, so that it's there to register the Ambient Sounds scripts when they become enabled.

    Or, you can put a copy of your Master Audio game object that's in the manager Scene into every single other Scene, and when you arrive there from a different Scene that already had a Master Audio game object that's persistent, it will auto-delete the new one so it's not a problem. Although I haven't tried on a multi-Scene project, so give that a shot and see if it resolves the issue.

    I did fix several issues with Ambient Sound recently, but nothing regarding its initial registration, which has always worked properly for me.
     
  3. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hello there,

    happy owner for Master Audio since yesterday and so far I have to say: it's brilliant.

    I'm just having a struggle with Sword swhoosh.

    While the "on collision" events works fine for impact. I can't figure out how to do it for the sword swing.

    I didn't see the Mechanim scripts in my project; I believe it has been changed to Animator Event?

    If yes, I tried adding an animator event on my sword swing start

    upload_2018-7-9_1-11-35.png

    And then the script on my player who has the animator:

    upload_2018-7-9_1-12-15.png

    This doesn't work.

    I didn't find documentation for that. Or I missed it and I'm sorry for that obviously

    Could anyone point me to some documentation/tutorial please?

    Also I'm not sure it's the best solution as in this case I'm not using Master Audio itself apparently (and I kinda like the control over there)

    So I'm opened to any help :)

    thank you!
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yeah you can't use Audio Sources on your game objects with Master Audio, that defeats the purpose of middleware.

    We don't have any "Animator Event" scripts at all, I'm not sure what that is. The mechanim scripts are able to be added when you select a state in Animator view. Like this:

    upload_2018-7-8_16-19-59.png
     
  5. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Ah ok, so this was probably from another of my assets... sorry for that.

    I'll definitely check on those script within the animator then. Thanks a lot for this fast answer
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem!
     
  7. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Me again, how are you doing?

    I have a question about Playlist Controllers. When you create one you get two audio sources and this is causing a problem for me when audio is output through the top one and in another situation it plays through the bottom one.

    How do I prevent this from happening? It is imperative that I only get audio playback from the top one because otherwise it messes up my silence detection.

    This is how it plays from the top one:
    Code (CSharp):
    1.  
    2. if (PlaylistController.InstanceByName("playlist-vocals").CurrentPlaylistClip == null)
    3. {
    4.         foreach (var item in PlaylistController.Instances)
    5.         {
    6.             string str = item.PlaylistName;
    7.             string strControllerName;
    8.             strControllerName = PLAYLIST_PREFIX + str;
    9.             MasterAudio.StartPlaylist(strControllerName, str);name);
    10.         }
    11. }
    bottom one:
    Code (CSharp):
    1.  
    2.        foreach (var item in PlaylistController.Instances)
    3.         {
    4.             string str = item.PlaylistName;
    5.             string strControllerName;
    6.             strControllerName = PLAYLIST_PREFIX + str;
    7.             MasterAudio.StartPlaylist(strControllerName, str);name);
    8.         }
    9.  
    so basically when I have the check:
    Code (CSharp):
    1. if (PlaylistController.InstanceByName("playlist-vocals").CurrentPlaylistClip == null)
    things work as expected but I am not sure what I should do.

    Any help would be appreciated.
    Thanks!
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You don't keep it from happening. That's how it's supposed to work. There are two audio sources because it's needed for cross fading. It also alternates which one it uses even if you're not using cross fading.

    Why do you need to detect silence, and would the track being paused also mean it's silent for your purpose? I can give you code if you answer these.

    Oh and I'm doing well, thanks!
     
  9. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    In my application, I only have one track inside each of 8 playlists. I need individual volume control for each track and because all songs have the same length and need to be synced, you recommended that setup.

    I am detecting silence using Koreographer (this is a part of the application where events are driven when there is silence in the audio tracks, not for mixing purposes, but for logic) and it always looks to the top AudioSource, so when the bottom AudioSource is selected Koreographer won't kick in.

    Thanks a lot for your lightning fast response!
     
  10. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Oh and when pausing all tracks are paused and no silence event is triggered by this pause. No single track can be paused individually, the pause button is global.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Doesn't matter. You will be checking the PlaylistState property of the playlist controller instead of CurrentPlaylistClip. If it's not "Playing" or "Crossfading" then it's silent. That's an enum so they arent really strings as I typed them.
     
  12. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Got it, thanks for the help.

    Another question I have, and couldn't find a resource for it, is about setting custom events. I need to know when a song starts and when a song ends. So far I began to set the Playlist Started Event by selecting in the dropdown the event I created in the Master Audio object in the hierarchy.
    But I can't figure out how to proceed. I need to run a line everytime a song starts and when it ends. Do I need to inherit from ICustomEventReceiver in order to accomplish this or is there another way?

    Thanks again!

    By the way, I just upgraded to MA Multiplayer, it will be very helpful in the near future. Your stuff is awesome!
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You could make a class that implements the ICustomEventReceiver interface, but that's kind of a PITA. Easier to just subscribe to the events of a PlaylistController, docs here: http://www.dtdevtools.com/API/maste...1_1_master_audio_1_1_playlist_controller.html

    You get SongChanged, SongEnded and another one. You would use the first 2 and specify code to run when the event happens. These are not "Custom" events, just normal .NET events.

    Thanks for the upgrade!
     
  14. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392

    Sighs, I tried unsuccessfully song ended event like this:
    Code (CSharp):
    1. // delegate void DarkTonic.MasterAudio.PlaylistController.SongEndedEventHandler    (string songName)  
    2. using UnityEngine;
    3. using UnityEngine.EventSystems;
    4. using DarkTonic.MasterAudio;
    5.  
    6. public class DelegateExample : MonoBehaviour {
    7.   PlaylistController.SongEndedEventHandler SongEnded;
    8.  
    9.   void Awake() {
    10.       SongEnded = new PlaylistController.SongEndedEventHandler(SongStopped);
    11.   }
    12.  
    13.   void SongStopped (string songName) {
    14.         Debug.Log(MYOM);
    15.   }
    16. }
    Can you please let me know what I am doing wrong?

    Thanks man
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    PlaylistController.InstanceByName("YourPlaylistControllerName").SongChanged += delegate {
    // add code to do something
    };
    PlaylistController.InstanceByName("YourPlaylistControllerName").SongEnded += delegate {
    // add code to do something
    };
     
  16. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thanks Brian
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No problem. Like I said, they are .NET events, and so you may have seen stuff like that before (Prime31 and most plugins do stuff like that).
     
  18. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    Hello there, I can't find a way to tell MasterAudio to simply restart a sound if there are no voices left? I just want that, when I ask a sound to play multiple time quickly in a row, it just restart each time instead of not being played. I also wonder why this isn't default? Don't we all prefer to have a sound restarting that not being played at all?
    Thanks a lot!
     
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Not the default becauae it's weird and usually not desired for a majority of sound effects.

    Anyway I believe you're looking for the "Retrigger percentage" field for the Sound Group, which defaults to 100% (not used). If you lower it to 40% then it will allow any Variation already playing to be restarted if all voices are busy and the at least 40% of the clip has been played. It used to be the default to have this at 50% but people got confused by it and also didn't want it usually so I turned it off by default.

    Normally for most Sound Groups this field will not be used and you will just increase the Voices / Weight field until you have enough voices and don't need retrigger. Except for perhaps machine guns and super fast noises like that.
     
  20. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    Thanks for the instant answer. oops I guess that my weird needs aren't the norm...! just have a majority of situations where I need only 1-2 voices 99% of the time. I don't want to preload 30 voices in memory just in case the 1% happens (e.g. spam click). So retrigger is definitely a better option for me in those situations.

    Anyway, it works perfectly thanks a lot! <3

    P.S: sorry for not finding that solution by myself but I got a bit confused by the doc description of retrigger percentage. Mainly because I don't understand how a "percentage" could work with 1 variation and 1 voice...?
     
    Last edited: Jul 14, 2018
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The retrigger just looks at all voices playing and finds one thats past x%. Docs not clear there eh? Should I revise the wording?

    By the way, increasing the number of voices does not occupy any more memory if its the same Audio Clips. As of unity 5 point something. 2 or 20 voices is the same memory wise.
     
    Last edited: Jul 17, 2018
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    V 4.1.9 changelog:

    • Fixed compile error in Resonance Audio package.
    • Fixed warning on Unity 2018.2
    • Now compatible with Bolt Visual Scripting.
     
  23. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hi, big Bolt user here - what did you do that makes it compatible? I was already using Bolt with MA, I didn't see blocking points (I think)
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Absolutely nothing. I contacted the Bolt author to ask if it could do static methods (Playmaker could not a couple years ago so) and he said it does so it's compatible with our plugins automatically. We're just making that public knowledge because someone asked about it recently.
     
    Necka_ likes this.
  25. fastgamedev

    fastgamedev

    Joined:
    Mar 27, 2014
    Posts:
    79
    Hi @jerotas

    Bought your asset a while back, integrating it now. We have a simple feature request: Enable/Disable ducking through API.

    We have a playlist for music and sound groups for sfx. Ducking is enabled. All works well when both music and sfx are heard. But the players can choose to mute sfx in the game (achieved by muting the sfx bus). With sfx muted, the music still ducks whenever sfx is played, but since no sfx is actually heard, it sounds wrong. We need to be able to enable/disable ducking whenever sfx are muted/unmuted.

    Also, please add enable/disable ducking as a Sound Events action, - that's how we mute/unmute sfx.

    Thank you,
    Arman.
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    This is a reasonable request. I'm wondering though if it might be better for the ducking code to just check (is the sound silent) and not duck if it is.

    Then you don't need to toggle ducking.

    What do you think?
     
  27. EntertainmentForge

    EntertainmentForge

    Joined:
    Feb 20, 2014
    Posts:
    15
    Hi guys,

    Just a quick question. Is there a way to change all bus selections at once? Or to make sounds into my SoundEffects bus by default when they are created?
    https://prnt.sc/k9j7ch

    I am making a game that has 28k words and full voice over and I'll have to choose bus-es a few thousand times manually otherwise. So this would help big time.

    Thanks!
     
  28. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Turn on bulk edit mode on the master audio mixer, select any number of sound groups or all in your case then change the bus selection on one of them and it will apply to all selected.

    You're probably going to have really long scene load times with that many audio clips and are going to have to make the vast majority loaded from a resource file or turn off the preload audio data checkbox on the audio clip.
     
  29. EntertainmentForge

    EntertainmentForge

    Joined:
    Feb 20, 2014
    Posts:
    15
    Thanks, jerotas!

    But is there such an option for Dynamic Group Mixer as well?
    https://prnt.sc/k9mtrz

    Exactly because of scene load time and memory I use Dynamic Group Mixer so I can have just lines I that need for certain scenes (still there will be about 300-500 sounds per some scenes, but I guess that won't be as bad).
     
  30. fastgamedev

    fastgamedev

    Joined:
    Mar 27, 2014
    Posts:
    79
    That would be even better :)
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No the DGSC doesn't have the option. But if you get it into the master audio game object you can do it all there. you can then use the sound group organizer to lose a bunch of groups from MA into SGO into DSGC and it will keep the bus setting.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok thanks. Will add to roadmap.
     
    fastgamedev likes this.
  33. EntertainmentForge

    EntertainmentForge

    Joined:
    Feb 20, 2014
    Posts:
    15
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Anytime.
     
  35. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hey, I'm getting this error on an android build using Unity 2017.4.8f1 & the latest version from the asset store:

    I'm also getting this one and think it could be related to Core Gamekit:

    Any ideas please?
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'll be able to look at this tomorrow. Didn't know that new version came out, I'm on Unity 2018.
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I installed that Unity version and was able to export to Android with both CGK and MA without any errors or warnings. So I am not sure what to suggest. I guess you should google that error because it's not happening on my computer. Sorry I'm not of more help.
     
  38. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks for the reply, it's happening on the Android devices, not in the build process.
     
  39. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    I have no better wording to suggest but will let you know if I do! Awesome to know for the memory usage, will simplify my life a lot.

    Quick question: how could I set the Replay Limit Mode (Time Based) bellow 100 ms?
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If compiling doesn't catch it, then it's an actual problem in the Unity compile process for Android (hasn't been reported on any other platform). If you have code line numbers then I can attempt something, otherwise I'm flying blind here.
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can't. That's a hard-coded limit I placed on the Inspector code.

    That's really fast and would sound like stuttering for most effects. I would suggest if you want faster, just use the Frame-based one which can go down to 1 frame.
     
  42. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    No sorry, I only have what I've posted.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Nothing I can really do then.
     
  44. SoulGameStudio

    SoulGameStudio

    Joined:
    Jan 18, 2016
    Posts:
    46
    I can't guarantee the FPS on user end (and I don't want to force it) which can easily mess with a Frame Based replay limit. But I just found the hard-coded value, works like a charm at 0.05 for me ^^
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thanks for the details, I have changed the minimum in the next version to 0.05 so you won't have to redo that change when you update next.
     
    SoulGameStudio likes this.
  46. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    118
    Hey, what would be best setup to use Master Audio for voice over lines (10k+ audio files) ? More specifically for memory/load time management.
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    A little latency probably won't matter for voice over. I'd do all of them in Resource files. As long as the total isn't over 4GB.
     
  48. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Hi, can you assign the AudioSource being used for an audio clip? I have a character that I do not want to play an attack audio if they are in the middle of playing a hurt audio, to prevent the perception of "two voices" for a single entity. I was hoping there was a way to check if an AudioSource is already playing before playing new audio, so that the character can only play one audio clip at a time. When skimming through the asset store page, I wasn't sure if we can assign the AudioSource, or if the system is based upon AudioSource.PlayAtPoint/pooled AudioSources decoupled from the gameobjects or something.
     
    Last edited: Aug 24, 2018
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We don't attach your Game Objects because they can be destroyed at any moment and we need to guarantee that the number of voices you specify are always available.

    It's pre-Instantiated (not pooled) Audio Sources that follow your Game Objects as they move if you tell it to. They live under the Master Audio game object. We don't do AudioSoure.PlayAt or PlayOneShot, because if your object got destroyed, it would cause audio artifacts (for PlayAt), and PlayOneShot because you lose control over the audio (it's fire and forget).

    So, no, you can't change where an Audio Clip lives, but it's not needed. What you can do is send all your player SFX to a Master Audio bus, and put a voice limit of 1 voice on that Bus. There's also an option on the bus to "stop oldest" so if additional voices past the voice limit are told to play, it will kill the oldest one and play the new. Should work perfect for you.
     
    hungrybelome likes this.
  50. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Sweet! Sounds like an interesting solution.