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

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I found and fixed a bug where FX tails would get cut off on non-looping sounds. This will be in the next update!
     
  2. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I have few use cases.

    1. I'm playing a looping fire crackle sound, so I'm using a OnTriggerEnter to play, OnTriggerLeave to stop. PlaySound3D does not return me a handle which I can stop the sound. I would want something like

    int soundID = MasterAudio.PlaySound3D

    // later

    MasterAudio.StopSound (soundID);


    2. I have multiple characters setup with different sound groups. I could spawn any random multiple of them, but I want to limit the total number of characters sounds in the scene to 5. Now only each soundgroup can set its own limit. This is sort of my previous question on how to reserving sound channels.

    3. I also see you have removed enum in favor of strings. In mobile, it is still not preferable to have strings, so can you add index based methods to SoundGroups.
     
  3. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Hey guys, just stopped by to look at the API again for something, thought I'd give a thumbs up and pat on the back while I'm here. Thanks for the updates and congrats on the continued success, noticed you're doing quite well on the top lists lately. :-D
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thank you Rirath. I'm sure it has a lot to do with the features we offer plus the support. A lot of the great feature ideas have come from users!
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #1, I think you may have misread the ReadMe. PlaySound3D method returns a PlaySoundResult object, which has a property of ActingVariation, on which you can call Stop or AdjustVolume methods. It's in there. However, Acting Variation is null if the sound wasn't played, so check the other properties first (SoundPlayed and SoundScheduled). If one of them is true, it won't be null.

    #2, edit - this is now in V 3.1.2 as bus voice limit control.

    #3, I don't see that we have any choice but to use strings. A lot of users complained about the enum, (even going so far as to rate the plugin low solely because of it) so we removed it out of necessity. I understand that strings are not as good for garbage collection purposes on mobile. I don't see "byIndex" working reliably at all though, so I'm extremely reluctant to add it. Explanation: any time you delete a SoundGroup that wasn't the very last one you added, the indexes (integers right?) would change. Do you have a creative way to get around that?
     
    Last edited: Dec 15, 2013
  6. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Interesting, I've been curious about this in general. I generally try to avoid strings as I do care about mobile performance, but any idea what kind of performance difference it makes long term / big picture? Free users sadly don't have the profiler, so performance differences are a bit harder to track down short of using the stopwatch functions. :)

    Mostly just asking out of curiosity, I've somewhat come to accept that some strings are hard to avoid without doing everything yourself.

    By the way, just a head's up: Your "Click Here for the asset store page" links (top and bottom) in the OP seem outdated. Looks like they should point to: #/content/5607 but instead point to: #/content/10754.
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I haven't had any issues using the strings from Master Audio in our games. No stuttering or anything like that. I can't give you profiler comparisons, we never needed to take it that far. Our problems were mostly excessive draw call, shader and physics problems, not audio or garbage collection issues.

    Thanks for the heads up on the link.
     
  8. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I'm one of them who complained but I didn't rate it down :) What I meant is, MasterAudio should not handle the enum, that is up to application to maintain it if the user decides to delete a soundgroup. MasterAudio should just provide index based access into sound group,

    enum MyCustomEnum { SoundA, SoundB }; // app level

    MasterAudio.PlaySound3D ( (int) MyCustomEnum.SoundA , ...);
     
  9. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Hi.. just recently bought Audiomaster, very cool. I'm trying to play an explosion sound when my shuriken particle explosion triggers, whats the best way to do that? I tried the trigger script, but none of the options work. Its a firework like explosion that flies towards the ground and explodes on impact with an invisible box. Also, if the script does do this, where should it go? I also have playmaker... Thanks!
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Right, you're talking about MA creating and modifying a text file to be able to do that, which I didn't find a way to do reliably. If I did, I'd need to assign an actual integer value to each item in the enum or still deleting an item that wasn't the last would incorrectly re-map any items after it.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    What exactly triggers the particle to emit? If it's a trigger or other event listed in the EventSounds events, you can use that. You would put the script on the prefab that contains the trigger.

    Or you can just use a Playmaker PlaySound custom action if the event is in Playmaker.
     
  12. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Im new to Unity...thanks! The effect is of a piece of debris landing on the ground and exploding when it hit.
    I believe its within the particle system, when there is a collision within the shuriken system, it spawns a particle Effect thats a child of a collision FX.
    It doesn't have a rigid body, so I assume its a seperate collision system, for FX.
     
  13. dark_tonic

    dark_tonic

    Joined:
    Mar 23, 2011
    Posts:
    138
    That's not a supported event currently. We'll look into adding it in the next version.
    In the meantime, you can add a script that uses this event (or use a Playmaker action that hooks into it):

    https://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnParticleCollision.html

    And then call MasterAudio.PlaySound methods (or the PlaySound custom action in Playmaker).

    However, if you already have custom action or code that makes it "explode when hit", then you don't need either of these. Just add the PlaySound code or custom action in the same place.
     
    Last edited: Dec 14, 2013
  14. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Thanks, I'll try that. I assume its in the FX code, I didn't add any special code to spawn the burst, it happens when the fx collides with a trigger plane.
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Then I'm sure that event shown above is being used. Just find that event and add Master Audio code there.
     
  16. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    I'm not a coder so not even sure where to start. ;P Is it possible to create a script that adds controls for this?
    Thanks! I appreciate the help
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well I just told you where to start :)
    Open the script, look for:
    Code (csharp):
    1. void OnParticleCollision
    And add a line like this in there:

    Code (csharp):
    1. MasterAudio.PlaySound("yourSoundGroupName");
    As I said, I am working on adding in actual controls for this. But if you want to try fixing it in the code, that's how.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Headtrip, I have added Particle Collision to the list of events in Event Sounds. If you'd like to beta test it for me, send an email to support@darktonic.com with your invoice# and I'll send you the newest.
     
  19. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It's that time of week again! Master Audio V3.1.2 has been submitted. Here are the changes:

    • Breaking change: (not really, but need to pay attention). Added a container folder "DarkTonic" for the top-level Master Audio folder. This way we're able to avoid duplicate class errors from UndoHelper if you use more than one of our products. When upgrading to this version, please delete the Master Audio folder first or create a "DarkTonic" folder in Assets and move the Master Audio folder into it before upgrading.
    • Added an "Equalize Song Volumes" button in the Playlist section that you can click to mathematically even the volume of all songs in a Playlist. This does not alter the clips, just moves the volume sliders for you.
    • Added an "Equalize Variation Volumes" button in the Playlist section that you can click to mathematically even the volume of all Variations in a Sound Group (from the Sound Group Inspector). This does not alter the clips, just moves the volume sliders for you.
    • Changed the color of the Playlist divider so it looks different than the song divider and users don't get confused what they're editing.
    • Changed the color of the Group divider in Dynamic Sound Group Creator so it looks different than the Variation divider and users don't get confused what they're editing.
    • Added a very simple Playmaker Scene into the optional Playmaker package.
    • Bug fixed: FX Filter tails were cut off promptly when non-looping sample ended. Now you have an optional field "FX Tail Time" that you can set to allow for as long as you like. This only shows up and does anything when you have one or more FX Filters active on the Variation. Defaults to zero.
    • Added Particle Collision event to Event Sounds.
    • Added a voice limit field for buses. It default to unlimited, but you can set it to any number from 1-32.
     
    Last edited: Dec 15, 2013
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Just wanted to give you the heads up that I added bus voice limit controls to the newest version (submitted). You can email me with your invoice# if you'd like a copy without having to wait for approval.
     
  22. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    What's the text file for? Isn''t it stored as a prefab only?
     
  23. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    What's the text file for? Isn''t it stored as a prefab only?
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It is, currently. In order for the indexes (integers) to mean something and work consistently, they would need to map to names. That's what the text file would be for.
    You said it would be up to the application to maintain that list. Unfortunately it can't do that if the user deletes a prefab directly (in the Hierarchy). Also as I said MA would have to keep track of the names in an enum which should go in its own text file. I haven't found a way to do that that always works.
     
    Last edited: Dec 15, 2013
  25. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    969
    Hello MasterAudio,

    Just bought your product and playing with it. I want to a certain playlist to fade in when it is triggered. How do I do this? I tried the following but neither seems to work:

    Code (csharp):
    1. // trigger first before fade
    2. MasterAudio.TriggerRandomPlaylistClip(NON_BATTLE);
    3. MasterAudio.FadePlaylistToVolume(NON_BATTLE, 1.0f, SOUND_FADE_DURATION);
    Code (csharp):
    1. // fade first before trigger
    2. MasterAudio.FadePlaylistToVolume(NON_BATTLE, 1.0f, SOUND_FADE_DURATION);
    3. MasterAudio.TriggerRandomPlaylistClip(NON_BATTLE);
     
  26. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    969
    Got it. I set the PlaylistController's volume to zero.

    I find that not intuitive. Could you add custom fading for playlists as well?
     
  27. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Oh, that was how it works before you removed the enum. You are mistaken, I'm not asking for that. The enum is handled at application level. What I would want is an array based index to access the sound directly.

    PlaySound3D (int index, ...);

    I did not check what data structure you are using to storing, I presume a List. You could make an index access
     
  28. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Would making a checkbox to "crossfade the first song" so that it ramps up from zero volume even though it's the first song you're playing do what you want? When changing songs, new songs do crossfade in from zero volume. I'm afraid that adding custom fading will mess up the crossfade code, so we probably can't handle it that way.
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    As I said, I don't see how to do what you want, without have an automatic generation and updating of a text file containing an enum. And as I said, I'm not going to go down that path. How exactly would the int's map to the sounds without changing their values ever if not an enum? I don't see a good way. Therefore, strings will remain, due to the complaints of the enum - even though an enum does have better performance. If you want to discuss this more please email at support@darktonic.com.
     
    Last edited: Dec 16, 2013
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Please don't download the new version, there are issues with it. I will re-submit ASAP.
     
  31. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    I went to import this and the structure is a complete mess.

    Instead of just a DarkTonic folder (critically important when importing into existing projects to keep packages separate and under control) there's an Art folder (what?) and a huge bunch of playmaker folder items, an itween folder and it even has itens to go in resources.

    Could you check this latest release please?
    Could you please organise this so it imports into just one high level folder?
    (apart from Gizmo...i get the need for that)

    ty!
     
    Last edited: Dec 18, 2013
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I will check now. It's possible the Asset Store did not post the newest. I did for sure check the package myself that was uploaded and it was fine.
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yep, the package is incorrect again. Damn. I will upload a correct version again momentarily. Nobody download this until I give the go-ahead please!
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I've fixed the issue (triple-checked this time), and resubmitted. Hopefully we'll get a fast track approval, I emailed the Asset Store people and let them know what the issue is. Since I had to submit everything I went ahead and used the latest, which had a few additions:

    Master Audio V 3.1.3
    • Made the Variations show up in the Group Inspector in alphabetical order, same as Hierarchy.
    • Added Variation Sequence dropdown to the Group Inspector. Choices are Randomized (default), and Top To Bottom.
    • Added a "Refill Variation Pool after inactive time" optional field that shows up when you choose Top To Bottom for Variation Sequence. This will automatically refill the Sound Group Variation Pool after not playing the Sound Group for X seconds.
    • Added a RefillSoundGroupPool method to MasterAudio. This method allow you to refill the pool of the Variation sounds for a Sound Group. That way you don't have to wait for all remaining random (or top to bottom) sounds to be played before it refills.
    • Added StopBus command to MasterAudio, a Playmaker custom action for it, and to Event Sounds.
     
  35. dark_tonic

    dark_tonic

    Joined:
    Mar 23, 2011
    Posts:
    138
    We're good on that. Just a DarkTonic folder and Gizmos folder. The rest are deleted.
     
  36. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Great, ty!
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No, thank you for reporting the issue!
     
  38. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hey Jerotas, you might want to keep a list of the files that's been wrongly packed and sent to Asset Store, some users might had already upgraded by mistake and don't know which files to delete. Currently they are listed on the Asset Store Package Contents.
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Actually I believe it's my fault, not the Asset Store. Just delete all folders except Dark Tonic and Gizmos. The rest should not be in there. And in Gizmos folder, delete the 3 Playmaker icons.

    Top-level folders that you should delete:
    1) Art
    2) iTween
    3) Playmaker
    4) PlaymakerCustomActions
    5) Resources.
     
    Last edited: Dec 18, 2013
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Heads up, the Master Audio package is disabled (not there) in the Asset Store until they test this one. Shouldn't be long. I'll post when it's back.
     
  41. LoftyTheMetroid

    LoftyTheMetroid

    Joined:
    Oct 26, 2012
    Posts:
    57
    Just wanted to say that me and my team purchased Master Audio and it's been great for us! (Sale price really helped sweeten the deal. :D)

    Quick question, though. I'm integrating Master Audio with our voice-acted cutscenes. If you remember, you suggested the following approach:

    I took your advice and set up a Sound Group for each character along with variations and a Dialogue bus. Since we have the option of pausing the game when another character is speaking, I'm trying to use MasterAudio.PauseBus() and MasterAudio.UnpauseBus(). However, since I also took the Resource file approach that you suggested, I can't seem to UnpauseBus(). When I looked in the code, PauseBus() seems to stop the sound if it's a Resource file. For now, I'm instead just using the AudioClip method, which is working perfectly.

    Anyway, I was wondering what the reason was behind stopping and not pausing Resource file sounds? If that's unavoidable, do you have an alternate solution that would allow me to pause audio dialogue, or should I just use AudioClips instead of Resource files like I've been doing?

    Thanks!
     
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I just figured people would forget to unpause the Resource files sometimes and the memory would never be reclaimed if the clip never ended, so I unloaded them when you pause. I can take that code out though if you'd like?
     
  43. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Two questions:

    1) How do you add songs to a play list programmatically? There doesn't seem to be an explicit API for this or documentation on it. I can add clips via MusicSetting entries for the currentPlayList in the PlaylistController, but I haven't looked through the code enough to know if this is something that works correctly.

    2) Is there a way to crossfade a song to another song - and then cross fade back to where you left off?

    I.e. a queuing system. You enter an area, start the area song, you enter a subarea, crossfade to the new area's song, and then when you leave that new area crossfade back to the higher level area's song (where it left off). Of course, you could theoretically have N subareas, but realistically it wouldn't be more than a few.

    I can code a solution that has multiple playlists where N=max possible number of levels a subarea can go, and then cross fade out the "leaving area" song, until it is done via a call back and then pause it before it is complete(?) At the same time start crossfading in another playlist with the "entering area" song (and then in reverse once going back to the original area).

    This seems kind of hackish, because it relies on N playlistcontrollers, etc., but it would be pretty easy to code. Just not sure if there is a better, non-hacky way.

    Note: am using paid version.
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #1, you can't programmatically add songs, you need to set them up beforehand. Let's first determine if there's a genuine need for that or if we can do what you want in another way. I've never tried to programmatically add MusicSettings, it might just work if that's what we end up wanting to do. But I should make a better API for it if so.

    #2, no, you can't do that either. You can crossfade back to either the beginning of the song, or the same point in another song as you are in the current song. We could possibly add a way to start the song in a custom position that you pass in if that's what you want?
     
  45. JustDev1412

    JustDev1412

    Joined:
    Nov 12, 2013
    Posts:
    5
    I just buy this but I'm very new in unity

    Can u guide me step how to add music sound to 2D Infinite Runner Toolkit ?

    (I don't understand too much with your readme file)


    Thank.
     
  46. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Well, this is a pretty common use case in games today.

    For example:

    1) In most games when you enter combat typically you crossfade to another song and then when done you return to the original song where you left off. If you kept restarting the original song (or starting another) it would become jarring after a while.
    2) Another example is in many games today if you enter a building that is a point of interest, say a church or a tavern or something, you typically would want to play flavor music for that location while you are there and then return to the baseline music when you leave.

    In terms of programmatically changing play lists, my entire game is data driven. Almost all of the data is externalized and editable through an external editor, including the sounds, buses, etc of Master Audio which I added over the past day or so while adding sound support. Ideally I would like a designer to be able to choose the music for certain things in my external editor rather than in Unity and then drive that through code.

    I can probably move most of the music stuff to Unity in hard-coded playlists, but this isn't ideal and still doesn't solve my problem.

    Now for sound effects, etc, I have that working just fine via my editor as I can add sound groups and sound variations dynamically at run-time in Unity.


    Note: I have thought about this and I can think I can work around not being able to change playlists through code as a workaround for now. However, I would like to see if we can come up with a solution for the fading problem above.
     
    Last edited: Dec 19, 2013
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We use that plugin as well for our upcoming runner games. Mostly you're not going to be able to use EventSounds or Playmaker to play the sounds with no code. You'll want to edit the PlayerManager.cs script and add lines like the following to play sounds:

    Code (csharp):
    1. MasterAudio.PlaySound("Jump");
    In the appropriate places. See to how to actually set up the Sound Groups, watch the two videos to get an idea of that. To play music, also watch the videos. If you have any questions after that, let me know :)

    Oh, you can put sounds on Coins and such when they despawn using Event Sounds. Use the Disable event.
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #1, here's an increasingly common and "more new technique" you may wish to employ (or not). Have a heavier version of the main non-battle music and cross-fade into it at the same point in time (instead of starting it over). Then cross-fade back to the same point in your original song when you're done. This makes music seem more seamless so it's becoming pretty popular to do. However, this Master Audio can already do.

    Back to your point, what it sounds like you want to do is for songs to have memory of where they last left so they can resume there the next time they're played. I'll put that down for a future version.

    I'll also make sure adding songs to a playlist programmatically works right.
    Thank you.
     
    Last edited: Dec 19, 2013
  49. LoftyTheMetroid

    LoftyTheMetroid

    Joined:
    Oct 26, 2012
    Posts:
    57
    Well, I personally wouldn't want that. I feel like it should be the programmer's responsibility to explicitly ensure sounds aren't left paused indefinitely if they elect to use Resource files; they should be calling Stop() after a Pause() if necessary, otherwise Pause() and Unpause() aren't reflective of their actual functionality when Resource files are being used. (Actually, does Unpause() even serve a functional purpose for Resource files...?)

    BUT, that said, I can definitely see where this would be a useful feature. It's convenient and helps many programmers make a more efficient product when they're not dealing with nitty-gritty details.

    I'm not sure what the average Unity developer would prefer, so it's your call whether or not you should keep it. However, at least for my own personal use, is it simple enough to just comment out those Resource file checks in PauseBus(), PauseSoundGroup(), etc., or would that lead to unseen complications?

    (And BTW, thanks again for another quick response!)
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, I will turn that "feature" off. I may make it an option though. If so, it will default to on. Watch the upcoming release notes!