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

Resolved We should be able to remotely load a compressed audio (MP3, OGG... etc.)

Discussion in 'Audio & Video' started by jgmakes, Aug 10, 2020.

  1. jgmakes

    jgmakes

    Joined:
    Jan 10, 2019
    Posts:
    75
    Unity apps should be able to load compressed audio files (not just WAVs) remotely at runtime.

    Unity is clearly hugely popular for x-platform mobile use cases, and mobile devices are often using cell network data and not guaranteed connected to 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 can freeze up the phone 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 hoping the Unity team would consider offering this feature in the future.
     
    hippocoder likes this.