Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Could Tiny do with a Tracker Music player?

Discussion in 'Project Tiny' started by Arowx, Jan 23, 2020.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194


    Music Trackers allow music tracks to be extremely small as they are broken down into a small set of sounds and the Track is the sequence or timing order and pitches the sounds are played back.



    Could this be ideal for Tiny or are there more modern compression algorithms that make trackers obsolete?
     
  2. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
  3. v_vuk

    v_vuk

    Unity Technologies

    Joined:
    Jul 11, 2017
    Posts:
    36
    This is a really interesting idea -- audio has often ended up being by far the biggest asset size. Would be nice to have a lightweight option.
     
  4. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    104
    Sorry for pulling up a thread that's a number of months old, but I feel this is super relevant to Project Tiny :)
    Nope, even Unity's own tracker blog post will tell you that using our latest compression for MP3 or OGG sound files you will still use 1mb per minute of audio. The size goes up with the length of the song.

    Not so with tracker music - after the initial outlay of the instrument samples, the additional note data costs practically nothing. With tracker music you can make long, meandering ambient tracks that last for say, 10 minutes, and still not incur more than the initial filesize, eg. 10s of kb. depending on the length of your instrument samples. Hell check out the super high quality tracker songs that come with OpenMPT, they have large samples and sound like fully mastered music recordings and still are only a couple 100kb per song.
     
    Last edited: Aug 21, 2020
    NotaNaN and Arowx like this.
  5. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    104
    Just an update;

    I can't quote on Tiny audio, just on native Unity. Playback is broken for .IT (Impulse Tracker) and .S3M (Scream Tracker). And when I say broken I mean unplayable. .IT files play back whisper quiet with no way to boost it and .S3M just break completely and don't play at all. The best format that works is .XM (Fast Tracker) format. I haven't tried the others yet, just working my way back in terms of tracker formats from most to least featured. This is a real bummer, because the .IT format has neat features like allowing notes on the same channel to continue to play over one another as the decay of the previous note continues over the top of the next note. Without this, in .XM format the notes have a very artificial clipped sound. Never a problem for chip tunes but definitely noticeable when making "proper" sounding music. Also you don't get low pass filters as an instrument effect which can be very useful for atmospheric instruments that change gradually for the note duration.

    But the worst part is I have my strong suspicions that, while Unity can play the tracker song, it does so by exporting it to a raw audio format and compressing it to .ogg format in the build. Negating any storage gains from using a tracker format in the first place.

    Best to use some external library like this. https://answers.unity.com/questions/577402/multi-channel-audio.html
     
  6. HeyItsLollie

    HeyItsLollie

    Joined:
    May 16, 2015
    Posts:
    68
    What I would give for tracker formats to be properly supported in Unity, with programmatic control. I genuinely search a couple times a year for a Unity-ready playback library, just to see if anyone has taken up the task. (The topic has come up on the Unity forums more than a few times, but it's not exactly a small task for a single developer to tackle.)

    It's important to note, it's not just about small file-sizes. Tracker music offers a huge canvas for creating dynamic music, simply because it's all just instructions for audio playback. The big points are:
    • Direct control over playback speeds.
    • Individual access to volume and panning, for up to 32 channels in .IT and .XM.
    • Precise seeking of playback positions in songs, allowing for non-linear song structures. EG: A song with multiple phases and transitions. (Note data is entered Line by Line into Patterns. Patterns are then ordered into Sequences - effectively, playlists for patterns. You only need to seek to a specific position in a sequence, rather than a specific timecode or timesample.)
    • .IT and .XM formats support MIDI macros, allowing for external messages to be sent directly via songs.
    • And yes, tracker format filesizes are often very tiny in comparison to WAV/MP3/OGG.
    There are a few pre-existing playback libraries out there that are worth exploring. One library in particular that may be well-suited for Tiny is Libxmp-Lite, a lightweight subset of Libxmp that is designed to be embedded in games and small applications.

    Another is Libopenmpt, created by the developers of OpenMPT, a popular modern tool for creating tracker music. This would also bring support for their .MPTM module format, which supports multiple Sequences per module — meaning several songs can be built around the same set of audio samples, with minimal additional cost to filesize. Again: Multiple songs for the price of one tracker module. I'm just saying!

    Forgive my attempted hard-sell, but Unity's native support for tracker modules has always been stunted. A bonus feature that came with implementing FMOD way back in 2010, rather than a truly useful feature with programmatic control. Unity currently doesn't even allow seeking playback positions in tracker modules, completely negating their usefulness. It's long-overdue for some attention.
     
    CameronBondeSAE likes this.
  7. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    104
    Hey thought I would update you guys - just tested 2021.2.7f1 and all the tracker formats I threw at it worked perfectly! I don't know who did what when but I'm super happy with this! I tried .IT, .XM, .S3M, and .MOD. all perfectly, no problems with volume or anything! Notes on the same channel overlap correctly in .IT files :)

    UPDATE: Couple issues I uncovered;
    • .IT files, the "instrument filter" doesn't work, that thing where you can make the instrument sound more muffled over time, it just doesn't happen.
    • Loop points glitch in .IT files, and are ignored in all the other formats, ah well...
     
    Last edited: Feb 27, 2022
    BackgroundMover likes this.
  8. mimiCryMuffin

    mimiCryMuffin

    Joined:
    Oct 23, 2015
    Posts:
    12
    It's don't work for webGl=((