Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Introloop - Easily play looping music with intro section [V2.0 RELEASED]

Discussion in 'Assets and Asset Store' started by 5argon, Jan 8, 2016.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    [​IMG]

    Introloop - Easily play looping music with intro section
    Requirement : Unity 5.0.0 or above. WebGL not supported yet as of 5.6.0f3.
    Demo, Installations, Scripting Ref., FAQ : http://www.exceed7.com/introloop/
    Asset Store Link : http://u3d.as/mxD
    Contact : Post on this thread or mail to 5argon@exceed7.com

    Less than 1 minute explanation of what it is :

    Release Note
    • (14/04/2017) Version 2.0 - New functions includes :
      • Pitch - You can now specify pitch in an IntroloopAudio asset file. If you would like to use multiple pitches of the same audio, you can just copy the asset file and have different pitches. It can reference to the same actual audio file. Works fine with pause, resume, automatic memory management.
      • Preload - A feature where critical precision of starting an Introloop Audio is needed. Load the audio by calling IntroloopAudio.Instance.Preload(yourIntroloopAudio) beforehand to pre-consume memory, and then call Play as usual afterwards.
      • Ogg Streaming as Introloop on iOS/Android - In Unity 5.5.2 they added support for choosing "Streaming" with OGG on iOS/Android. I am happy to inform that this option works with Introloop. Everthing will be the same except it will not cost you as much memory of an entire audio on Play as before in an exchange for some CPU workload.
    • (15/12/2015) Version 1.0 - The first version
    Let's recall memorable moment from favorite games you have played. A destined fight with arch rival? Roaming overworld map for the first time? An opening stage that really hooks you that you can't put down the joystick?

    Wondered why they stuck so well in your memory? The answer is music intro and I am going to make you realize that it is important. I think I am not the only one who noticed this so I made Introloop for the person who cares about his own game soundtrack :D

    Many commercial game music has certain charm when you are listening to it in game because they're programmed to have a nice intro that sets the mood of that particular scene, before transitioning seamlessly to a music loop, never having to play the intro again. This is the source of immersive feeling you never get when you listen to the song again in an OST.

    In Unity if you select "Loop" in an AudioSource, the song will loop to beginning when it reaches the very end.

    [​IMG]

    With Introloop, you can specify 2 time point "Intro Boundary" and "Looping Boundary" in your audio. Playing with this plugin, it will now loop back to Intro Boundary when it reaches Looping Boundary, effectively make the section before Intro Boundary an intro section that plays only once and the rest will be looping.

    [​IMG]

    Advantages :
    No need to cut the actual file into 2 parts.
    ► And because of this you can use any compression (like OGG) without fear of messing the precision at the head and tail of audio file. Feel free to utilize the Unity's compression quality slider - and any other audio settings built-in.
    ► By not physically cutting the audio, it is easy to experiment and adjust the loop point right in Unity. In 2 split clips solution you will have to cut the music over and over again until it is seamless enough.
    ► Updating music from your composer is easy, as long as the song structure is the same you can just replace the whole music and use the old boundaries.
    ► Automatic audio memory releasing at appropriate time, which is perfect for mobile project. This is the reason of Unity 5 requirement. Any other solutions that claims to works with Unity 4.x cannot manually free audio data, as this function came with Unity 5.
    ► Supports pause, resume, fade in, fade out and even cross fading between intro-included audio. Built in pop/clicks reduction when stopping the music suddenly. You can also set the default volume per-audio.
    ► Route the entire plugin to your game's Unity 5 audio mixer for your own higher level control. Casting epic spell and wanted to duck the BGM down? No problem, route to your mixer and use Unity 5's great ducking feature on it.
    ► Modular. Easily integrates. Came with no other assortment of audio features.
    ► The license purchase came with full source code.

    It is a common practice used in many commercial games. Intro adds huge value to music, turning into a powerful tool for directing player's feel and blends more into gameplay.

    It's not just about random battles, any feeling you would like your player to feel, use music intro to direct him/her to that direction right from the start then keep it going with your gameplay.

    See real examples from commercial games and try out the demo in the website below.
    http://www.exceed7.com/introloop/

    The demo contains several songs I prepared for you to play with. It is available to try on both desktop and mobile devices, so you can see that it works cross-platform.

    [​IMG]

    [​IMG]

    [​IMG]

    Feel free to ask me any question about Introloop. Criticisms, suggestions are all welcomed as I wanted to know what you guys want. Thank you!

    (As for why WebGL is not supported, on that platform the Scheduled audio functions are not implemented.)
     
    Last edited: Apr 11, 2017
  2. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    960
    Cool.
    Can we expect a smooth loop without any noticable "cracks" when it jumps from end to startpoint?
    In my experience this is the hardest point to solve.
     
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Yes! You can expect it as long as your 2 time point is precise enough. The timing is achieved by not the normal game time nor coroutine but by
    Code (CSharp):
    1. AudioSettings.dspTime, AudioSource.PlayScheduled, AudioSource.SetScheduledStartTime and AudioSource.SetScheduledEndTime
    internally to ensure this.

    I have provided the demo in this page so you can test the seamless-ness. Or alternatively if you don't have the PC now, download this game to your mobile phone and hear if you notice any cracks or not. (The title screen already is using Introloop)
     
    Last edited: Jan 8, 2016
  4. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    182
    Is there a way to change a track's volume in real time? In my game, the player can change global background music volume in the option screen. It'd be nice if they can hear the change in real time.
     
  5. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Yes. For global volume/sfx that you will adjust in option screen, the current best practice in Unity 5 is using the Audio Mixer. You can route Introloop's audio to your mixer by following this tutorial : http://www.exceed7.com/introloop/getting-started.html

    After this, the level of that track you routed to can be controlled from script. Mainly via SetFloat/GetFloat which you can then link to your slider UI.
    https://unity3d.com/learn/tutorials/modules/beginner/5-pre-order-beta/exposed-audiomixer-parameters
     
    hima likes this.
  6. hima

    hima

    Joined:
    Oct 1, 2010
    Posts:
    182
    Thank you! I totally forgot about the new Audio features in Unity5. This mean I have to rewrite how I handle audio in the game again but it should be much easier to deal with.
     
    5argon likes this.
  7. Fallenleader

    Fallenleader

    Joined:
    Jan 26, 2015
    Posts:
    2
    The only flaw I have seen with this, is for systems like the N3DS.
    Ultimately, this solution is exactly what I need, but I cannot guarantee it will work for specific devices, which is why I am holding off on a purchase.
    How would using your solution work for all devices, and not just a specific set for normal everyday user devices?
     
  8. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Hello, thank you for interested in Introloop. It's true that I could not confirm either that if it is working on 3DS or not because I don't have their dev kits. At first I assume it is Unity's job to make the code cross-compile successfully but then there is the case like WebGL where all audio "Schedule" functions are still not implemented. (they told me it is ready in 5.4, but haven't tested since then.)

    I am not sure that it also happen in 3DS or not but I could not verify it. (I will update the website with a list of untested systems along with the next update)
     
  9. Douvantzis

    Douvantzis

    Joined:
    Mar 21, 2016
    Posts:
    60
    Is the track decoded or is it streamed form the source?
     
  10. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Hello, sorry for the late reply. You can choose whatever import settings you like and they will be in effect like it normally did. (Encoding quality, playback mode, etc.)

    Introloop uses original audio without cutting or altering anything. Internally basically it is 4 audio sources which cooperate with each others and each one have your music file loaded, so in turn, audio sources will respect all import settings.
     
  11. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    30
    IntroloopPlayer randomly doesn't play the music at all (Unity 5.5). I don't know how to reproduce it as it seems random.

    In case you need it, the settings for the audioclip is:
    Load in background disabled
    Decompress On Load
    Preload Audio Data enabled
    Vorbis

    Any ideas? Has anyone else experienced this?
     
  12. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Thank you for the report. I will look into this immediately.
    My active project that also uses Introloop is also on 5.5, so I will try to reproduce it. (If I have fixed the issue, I will come back to report again.)

    If the audio file is not sensitive, you can send the audio file, the audio's .meta file, and the corresponding Introloop asset file (that contains the 2 loop points) to me via DM. It will help me find the problem!
     
  13. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    I am pleased to inform you that version 2.0 of Introloop has finally been released. (It is also on sale 30% as a part of Unity open sale until the end of this April 2017.)

    https://www.assetstore.unity3d.com/en/#!/content/51095

    Release Note
    • (14/04/2017) Version 2.0 - New functions includes :
      • Pitch - You can now specify pitch in an IntroloopAudio asset file. If you would like to use multiple pitches of the same audio, you can just copy the asset file and have different pitches. It can reference to the same actual audio file. Works fine with pause, resume, automatic memory management.
      • Preload - A feature where critical precision of starting an Introloop Audio is needed. Load the audio by calling IntroloopAudio.Instance.Preload(yourIntroloopAudio) beforehand to pre-consume memory, and then call Play as usual afterwards.
      • Ogg Streaming as Introloop on iOS/Android - In Unity 5.5.2 they added support for choosing "Streaming" with OGG on iOS/Android. I am happy to inform that this option works with Introloop. Everthing will be the same except it will not cost you as much memory of an entire audio on Play as before in an exchange for some CPU workload.
    The website (http://exceed7.com/introloop/) also has already been updated with demo of version 2.0, which you can try the song with altered pitch. As always, if you found any problems I am ready to help you here or in the e-mail. Thank you!
     
  14. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    2
    Hi,

    That looks great ! i'm trying to achieve that but couldn't get my head around how dspTime and playSchedule functions works.
    Is it possible to loop the intro and the outro instead of looping the middle part ?
     
  15. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    89
    Hello. By definition of intro and outro I think it should not be seamlessly loopable? That's why we need Introloop, to loop the middle loopable part, and you would not have an outro since by definition of "loop" the music should never ends, thus no need for an outro.

    But if you do want to loop the intro over and over, you could set up the intro boundary as 0 and outro boundary as the "supposed to be" intro boundary.

    With the same idea you could set the intro boundary as the "supposed to be" looping boundary and outro boundary as the song's length, it should loop the outro over and over once it arrives there.

    Please do clarify if I misunderstand something. Thank you.
     
  16. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    2
    I actually would like to loop the intro until a certain event, then play the middle part once and then play the "outro" over and over until another event ends the music (fade out).

    EDIT: Nevermind, I actually managed to do what I wanted :)
     
    Last edited: Sep 20, 2017
    5argon likes this.