Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

InAudio 2 - New & Open Source

Discussion in 'Assets and Asset Store' started by InnerSystems, Mar 5, 2014.

  1. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    LogoAssetForum.png

    Hi there, I would like to tell you a bit about InAudio and why its now open source. Well, it's open source because I got a job in an AAA game company and now I want to to make it available to as many people as possible and on all platforms. So why waste your money on another solution? And this does not mean that developed is dead, don't worry!

    What is InAudio? It's in my opinion, a powerful tool to add great audio to your game. It has dedicated tools for playing music, sound effects and an event system. All audio design and events are created code-free with an extensive API to control the playback, including an event hook for common things like enabling and collisions.

    Grab it now on the Asset Store or Github for free!

    With the release of the new audio system in Unity 5, InAudio got a lot better. It now has a brand new music player that supports layered music, easy crossfading and it is always gap-free. Alongside this is a deep AudioMixer intergration, and a total rewrite of the audio clip loading to take advantage of the new Unity 5 loading system. Did I mention it is fast? Even on mobile, your hardware will give up long before InAudio is even breaking a sweat.

    For sound effects, you can easily combine, sequence, (weighted) randomize and loop your audio clips, all gap-free of course. For your variation needs, volume, pitch, looping and delay can all be fully randomized for every single clip if you so desire.

    Using InAudio is on the design front always code-free with an extensive API to control the playback during runtime. If also has an event hook for your daily needs with hooks for enabling/disabling and collisions among others.

    I really hope you will find this new and free version of InAudio useful and please let me know below or on email about any thoughts, comments or feature requests.

    Asset Store | Documentation | Support email: inaudio@outlook.com | Github

    Core features:
    :: Music player, layered & sample-accurate.
    :: Deep Audio Mixer integration.
    :: Lots of randomization options.
    :: Always sample accurate audio.
    :: Event hooks for code free implementation.
    :: Instance limiting.
    :: Audio splines for volumetric audio.
    :: High-performance with hundreds of audio sources even on mobile.
    :: Scene independent, no scene clutter.
    :: Easily handle 100+ audio sources on mobile.
    :: Memory handling via Unity 5 clip loading.
    :: Preview audio right from the editor.
    :: Code-free memory management.
    :: Minimal allocations.

    Music.png
    Events.png
    Event-hook.png
     

    Attached Files:

    Last edited: Apr 9, 2015
    chelnok likes this.
  2. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Changelog

    InAudio 2
    -Remastered for Unity 5
    -Completely new Music system
    -Highly improved audio clip loading
    -Event Actions for music with playback and volume control
    -Improved GUI

    For a full history, please check the full changelog.
     
    Last edited: Mar 29, 2015
  3. jdyeager

    jdyeager

    Joined:
    Aug 18, 2008
    Posts:
    29
    Hm, just so you know, your video is repeating about a minute or so of content at around the 4:30 mark.

    - Josh
     
  4. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Thank you for pointing that out. Will fix it swiftly.
     
  5. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    439
    This asset seems interesting. How does it compare with the much more expensive Master Audio?
     
  6. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    [Well, now its open source]

    Quite well I would say. I have sent you a copy of the newest version of InAudio to use in any of your project(s). If you need support and/or newer versions, please consider buying it.
     
    Last edited: Mar 29, 2015
  7. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Hi everyone, I just released a major upgrade to InAudio and released it open source!
    Please check it out!
     
  8. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    61
    Awesome asset. The audio mixers work well using Music, but not when using audio via the Audio Window. I have it set on the parent folder of the audio nodes I'm using, but it just won't route through the mixer. :(

    Any idea?

    Edit:

    I fixed it by modifying InPlayer.cs. In PlayNode, I have it searching parents for the mixergroup to use. I'm not sure if this is right, since it might be better to be setting it somewhere rather than walking up the chain.


    Code (CSharp):
    1.  
    2. InAudioNode currentNode = current;
    3. AudioMixerGroup mixerGroup = current.MixerGroup;
    4. while (mixerGroup == null)
    5. {
    6.         currentNode = currentNode._parent;
    7.                 if (currentNode != null)
    8.                 {
    9.  
    10.                     mixerGroup = currentNode.MixerGroup;
    11.                 }
    12.                 else
    13.                 {
    14.                     break;
    15.                 }
    16.  
    17.    }
    18.  
    19.    Current.AudioSource.outputAudioMixerGroup = mixerGroup;
     
    Last edited: May 18, 2015
  9. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    398
    Very cool, thanks for making this free!

    Do you know if it will compile to universal windows store apps?
     
  10. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Hi sballew7, thanks for finding the bug. Your solution is correct, I have sent you a new version of InAudio with this bug fixed alongside another small other one I found while looking into this. You can simply import it onto your current project and you won't loose your InAudio project data.


    It does! In the version on the asset store right now, you will have to change a single line 354 in InPlayer.cs to
    Code (CSharp):
    1.  
    2. get { return new ReadOnlyCollection<InRuntimePlayer>(audioSources); }
    3.  
    As with sballew7, I have send you a new version with this bug fixed.
     
  11. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    61
    Hey InnerSystems,

    I encountered another bug that I hopefully have found a fix for.

    Here are some reproduction steps, followed by the solution I put in place.

    1) Play a music group using InAudio.Music.PlayWithFadeIn(someMusicGroup, 1f);
    2) After fading is done, fade the music out. InAudio.Music.FadeAndStop(someMusicGroup, duration);
    3) After fading is done, fade the music back in. InAudio.Music.PlayWithFadeIn(someMusicGroup, 1f);
    4) When the music finishes fading in, it will stop playing.

    In step #2, starting a fade out will set toFade.PlayingInfo.DoAtEnd = MusicState.Stopped.
    Unfortunately, this remains on the music group. When fading back in, this property is still set, and the music will stop playing as soon as it fades in.

    I have done two different solutions. I am not sure which is better, and I could use some guidance.

    One was to add the following line at the end of each FadeIn method:
    Code (CSharp):
    1. musicGroup.PlayingInfo.DoAtEnd = MusicState.Nothing;
    My worry is that there are too many places where this needs to be done (probably any time music is to be played), and I know I missed some areas.

    My second solution was to try fixing it in a single location. I modified the MusicVolumeUpdater's section that handles fade completion. Upon completion, it sets the DoAtEnd to MusicState.Nothing. This ran into an issue with too many threads and made Unity crash, so I obviously missed something. (EDIT: The thread crash seems to be unrelated, so I'm trying to get to the bottom of it myself.)

    Code (CSharp):
    1.  
    2. if (playingInfo.Fading)
    3.                 {
    4.                     float currentTime = Time.time;
    5.                     if (currentTime >= playingInfo.EndTime)
    6.                     {
    7.                         group.runtimeVolume = playingInfo.TargetVolume;
    8.                         playingInfo.Fading = false;
    9.                         if (playingInfo.DoAtEnd == MusicState.Stopped)
    10.                         {
    11.                             InAudio.Music.Stop(group);
    12.                         }
    13.                         else if (playingInfo.DoAtEnd == MusicState.Paused)
    14.                         {
    15.                             InAudio.Music.Pause(group);
    16.                         }
    17.                         playingInfo.DoAtEnd = MusicState.Nothing; // <--- NEW LINE: The music state switches to nothing after fading is done.
    18.                     }
    19.                     else
    20.                     {
    21.                         var duration = playingInfo.EndTime - playingInfo.StartTime;
    22.                         var left = playingInfo.EndTime - currentTime;
    23.                         group.runtimeVolume = AudioTween.DirectTween(playingInfo.TweenType, playingInfo.StartVolume, playingInfo.TargetVolume, 1 - left / duration);
    24.                     }
    25.                 }
    26.  
     
    Last edited: Jun 9, 2015
  12. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    61
    I finally got to the bottom of the "too many threads" error. I thought it was unrelated, but I have finally pinpointed it to when I upgraded to the latest InAudio. Perhaps I missed some upgrade steps? A thread dump of Unity shows a TON of threads being created when using the latest InAudio version. It only happens in the editor while in play mode. This was tried on Unity 5.0.1 and 5.0.2.

    I have reverted back to my previous version and the thread issue is resolved. I also patched it by using a third solution, which was to modify the MusicPlayer's PlayMusicGroup method. It looks like all Play methods end up here, so it seemed like a good central place.

    Code (CSharp):
    1.  
    2. private static void PlayMusicGroup(InMusicGroup toPlay, double playTime)
    3.         {
    4.             var musicPool = InAudioInstanceFinder.InMusicPlayerPool;
    5.             var mixer = toPlay.GetUsedMixerGroup();
    6.  
    7.             var editorClips = toPlay._clips;
    8.             int clipCount = editorClips.Count;
    9.             for (int j = 0; j < clipCount; j++)
    10.             {
    11.                 var playingInfo = toPlay.PlayingInfo;
    12.                 playingInfo.State = MusicState.Playing;
    13.                 playingInfo.DoAtEnd = MusicState.Nothing; // <---- NEW LINE: Set end state to nothing.
    14.                 var player = musicPool.GetObject();
    15.                 toPlay.PlayingInfo.Players.Add(player);
    16.                 player.clip = editorClips[j];
    17.                 player.loop = toPlay._loop;
    18.                 player.outputAudioMixerGroup = mixer;
    19.                 player.PlayScheduled(playTime);
    20.             }
    21.  
    22.  
    23.             for (int i = 0; i < toPlay._children.Count; i++)
    24.             {
    25.                 PlayMusicGroup(toPlay._children[i] as InMusicGroup, playTime);
    26.             }
    27.         }
    28.  
     
  13. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    That is a very odd problem, which I haven't seen while testing it. I'm gonna investigate this issue and report back.
     
  14. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    61
    Using Process Explorer, the threads look to be created and destroyed rapidly. But they are created faster than they are destroyed.

    The threads look to be called:
    Behaviour::Transfer<YAMLWrite>
     
  15. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    First of all, thank you very much for the bug fix. I have submitted a new version with this included.
    However, I cannot reproduce your issue. Looking at Unity's thread count, it only fluctuates with 1-2.
    InAudio does not directly spawn any threads, so the additional ones must be a weird coincidence.
    If it keeps not working, please write a message to me with more detail so we solve this problem.
     
  16. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    61
    Thanks for looking at it. When I get time, likely next week, I will attempt the upgrade again and report back.
     
  17. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,028
    Very Nice work InnerSystems!

    I'm currently doing a deep evaluation of all Interactive Music solutions in Unity prior to starting a couple of projects and almost overlooked this. Glad I checked it out!
     
  18. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,028
    What's the quickest way to change the selected element color in the editor?
    The current dark blue makes it really hard to read.

    What's the best strategy for using layers in an interactive music composition when you might need to control track dynamics by turning layers on and off?
     
  19. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Right now it would probably be best to simply change the volume of the tracks that you shouldn't hear.
    You though also use PlayAtSkipSamples() to play at the at correct time and skip any samples so it matches up. I am currently working on a better solution utilizing something like PlayAtBeat() or something like that. I don't have an ETA though.

    For the color, change the texture SelectedBackground in InAudio/Icons. I may find a better way to set the color at some point.
     
  20. Rienhl

    Rienhl

    Joined:
    Nov 14, 2013
    Posts:
    41
    Hey guys! Do you know if InAudio works correctly on Unity 5.1.1f1 and supports WebGL builds?
    I've been using "Fabric", but to my surprise when I want to build for WebGL, lots of .dll errors appear.
    It works correctly on Unity Editor but fails to build.

    Just want to know if using InAudio will avoid this problem

    Thanks!
     
  21. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Update: It works in WebGl!

    There is nothing stopping InAudio to run on any platform. As the entire source code is included on the asset store, it's all about if Unity supports the needed features on a platform. If WebGl supports PlayScheduled and looping, everything should be working.
    That being said, I haven't really tested it on WebGl yet, but I know it compiles. So that is a start.
     
    Last edited: Jul 3, 2015
  22. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    I just tested it in WebGl and it does indeed work, even if not as well as all the other platforms. Randomization, volume & pitch control, spatial blend, etc. all work as intended. WeblGl audio looping however is not sample accurate and more complex sequences of sounds also have some problems, but everything else seems to work. If you are using it for individual sounds effects and simple music, it should work fine for you.
    These or similar problems will likely be there for all WebGl projects for now.
     
    Last edited: Jul 4, 2015
  23. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    When i import both core gamekit and InAudio i get this error:

    Assets/InAudio/Scripts/Editor/InAudio/TreeView/MusicDrawer.cs(138,28): error CS0117: `UndoHelper' does not contain a definition for `RegisterUndo'

    I am not sure who the is culprit here, since the error is in the the inaudio file but core gamekit doesnt seem to use it's own namespace in it's undohelper.cs file. If you have any idea how to fix this, please let me know.
     
  24. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Hi, the culprit in this case is GameKit if its UndoHelper isn't wrapped in a namespace and the correct solution would be that they wrap it.
    I will rename the UndoHelper in InAudio to InUndoHelper and privately send you a new version of InAudio with this fix. It will then be submitted to the Asset Store in the coming days.

    Ok, for some reason I cannot send it to you, but PM me and I'll give you a link.
     
    Last edited: Oct 11, 2015
  25. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    Thanks for getting back to me so quickly.:) I wasn't even sure this project was still alive. "New free version" unfortunately often means "i don't have time for this anymore, gl hf customers" (see soundmanager pro for example).
    If you still maintain this i am a bit startled it seems to gain so little attention. The asset store isn't exactly bursting with good audio solutions, and many of those are pre-unity 5 and/or pretty expensive.

    I reported this issue in the core gamekit forum too, but since it's sunday i don't expect a quick reply.
     
  26. InnerSystems

    InnerSystems

    Joined:
    Feb 23, 2014
    Posts:
    14
    Actually, send me an email at inaudio@outlook.com it will be easier to send you a new version.

    You are right that free usually means unsuported, but for InAudio I'm still there. As this transitioned into a spare time project I don't have as much time as those who does it full time obviously, but I'm still developing new features and making sure it works as new Unity versions comes out.
     
  27. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    Ok, seems everybody is working this sunday. This is the reply from the gamekit dev:

    So it looks like you don't need to make a public patch. Thanks again for your help, much appreciated.
     
  28. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    I am testing the music part of InAudio right now and I am a bit confused about the workflow. I use two play/stop actions to crossfade from one piece of music to another using event hooks attached to a box collider that was already in place as a level exit.

    First I am confused about the crossfade action, which my layman intuition tells me is exactly made for this, but I have no idea how to use it and what it's even doing. The "target" parameters don't work for music groups, folders or anything else i tried to drag in there so i even failed to get it to do anything at all.

    Second, i am not quite sure how the audio manager script object is supposed to be used. If I load/destroy it in every scene i obviously can't fade out the previous music because i already destroyed the manager. However if I create a single manager and use don't destroy on load i have to always temporarily create an audio manager to access the inaudio windows, for example for assigning event hooks to objects.

    I guess I could add the typical singleton create/check/destroy behavior to it, but I suspect thats neither elegant nor necessary. So how do I use the audio manager best for multiple scenes?
     
  29. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    I still haven't found a way to work with audio managers across scenes. When I destroy an audiomanager, unity pops a million errors about that it's audiosource is still being referenced.
    That is the music thats still running, but using stop all music on an event hook doesnt work and warns that it's target is a null reference. Pretty much regardless of what i attach the event hook to (empty object, audiomanger...) or on what it event fires (enable, disable, destroy...)

    The only solution i found is to stop all music groups individually, but of course that doesn't exactly scale.
     
  30. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    220
    It would be great if there's DLL version of InAudio2, as all the major audio libraries are getting bigger and bigger these days and making Unity's compilation slower. (the main reason I stopped using MasterAudio.)
     
  31. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    92
    There is a MusicPlayer.Pause - any reason why there isn't MusicPlayer.Unpause?

    Something like:

    Code (CSharp):
    1.  public void Unpause(InMusicGroup musicGroup)
    2. {
    3.     if (musicGroup == null)
    4.     {
    5.         return;
    6.     }
    7.  
    8.     UnpausePlayers(GetParent(musicGroup));
    9. }
     
  32. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    375
    Importing inAudio 2 when already having LeanTween installed gives the following error:

    I tested inAudio in an empty project first, a InAudio/LeanTween folder was included... it's not there in my actual project - which I'm using LeanTween in.

    What's the fix here? How come the isn't folder included?
     
    Last edited: Jan 31, 2017
  33. Baumkuchen

    Baumkuchen

    Joined:
    Feb 14, 2016
    Posts:
    8
    Is There are a Function, a Property Or an event which i could use to check if a sound is still playing on that GameObject?

    I would like to start ( after playing is completed ) a new random sound from a Randomiser.