Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Remotely loading a compressed audio (MP3, OGG... etc.) natively in 2020!

Discussion in '2020.2 Beta' started by jgmakes, Aug 10, 2020.

  1. jgmakes

    jgmakes

    Joined:
    Jan 10, 2019
    Posts:
    75
    ===== EDIT: Oh my, huge faceplant. =====
    This has existed for a few years now...
    =================================

    Unity apps really should be able to load compressed audio files (not just WAVs) remotely at runtime. 2020 is the year!

    Unity is clearly hugely popular for x-platform mobile use cases, and mobile devices are often using cell network data and not guaranteed to have generous at-home wifi like a game console. I'd like to:

    • Keep the initial app small
    • Load user generated audio content dynamically
    • Use compressed audio formats given a focus on mobile use-cases

    My current use case is one where users record audio in the app, and can be "found" in various locations by other users. This isn't an open direct connection between users (an audio chat). Users are creating audio artifacts. At this moment, I can convert to WAV, save them, and have other users load them as WAVs, but even with a 20 second cap and at the lowest possible quality, they're quite large, and if I were to move to a larger duration, they'd be untenable.

    Current solutions for loading audio at runtime that I'm aware of:

    Loading MP3 and converting to WAV at runtime:
    Using something like NLayer, we can do conversion on the client. This is super expensive conversion process, and often on anything but a flagship phone this can freeze up the system entirely.

    Wrapping in AssetBundles:
    Wrapping an audio file as a compressed format in an AssetBundle would work, but doing so dynamically appears to be quite difficult. This would be necessary for user generated content. The other downside is that we wouldn't be able to consume those files with another non-Unity based app, like a web-based backend/management tool.

    FMOD:

    FMOD allows for loading/playing other file types dynamically, but integrating FMOD (as a complex, powerful external audio solution) just for this one feature is a huge investment.

    Unity has clearly already made this consideration around video. MP4s can clearly be loaded/run at runtime. Imagine if we could only use uncompressed video? Coming from a web dev background I'm surely biased, but browsers have been able to load and play efficient, consumable media types for decades.

    I'm really hoping the Unity team will consider this functionality in 2020.
     
    Last edited: Aug 14, 2020
    hippocoder likes this.
  2. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    505