Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Audio Fmod memory limit? Fails on importing 2 hour long audio file

Discussion in 'Audio & Video' started by imaginationrabbit, Sep 26, 2021.

  1. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    339
    I've tried every way possible to import an audio file that is 2 hours long. The only format that Unity can process it as is "PCM" which works in the editor but causes FMOD out of memory errors in builds.

    I'm making an interactive film so I need the full audio file for the films multiple soundtracks. My Pc has 64gb of ram btw.

    This is the error that appears when I try to switch the .wav file to Vorbis in the Unity editor

    Code (CSharp):
    1. Errors during import of AudioClip Assets/Audio/FullMix_Ru_MDotMix.wav:
    2. FSBTool ERROR: Run out of memory.
    3. FSBTool ERROR: Internal error from FMOD sub-system.
    4.  
    If I set it to PCM it works in the editor. In a build all the audio files fail to process whether they are 1 second long or a minute long. They throw this error

    Code (CSharp):
    1. Error: Cannot create FMOD::Sound instance for clip "FlyWhoosh" (FMOD error: Unsupported file or audio format. )
    I tried importing the 2 hour file as wav, mp3 and ogg. Unity cannot process any of them, they all throw the out of memory error. Switching to PCM is the only thing that does not throw an error but again it breaks the builds.

    Any ideas? Thanks.

    Edit: Did some more searching and it seems Unity just cannot import/process audio files that big so I'll create an Audio wrapper class that treats multiple clips as one. Its strange though as Unity can import and use a 2 hour 40gb 4k video file just fine but craps out with a 1.2gb audio file? :confused:
     
    Last edited: Sep 27, 2021
    hippocoder likes this.
  2. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    339
    Created a simple script that allows you to interact with several audio clips as a single audio clip (Play, PlayAudioAtTime, Stop) script is here

    If you use Play it will auto-play the next clip for seamless playback- PlayAtTime will find the right clip to play the time from-

    Use case: You have a 2 hour audio file to sync with a Video track and Unity can't import it/work with it- break it into two or more pieces and use the above script to interact with it. Use the video time with PlayAudioAtTime
     
  3. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    339
    I found a simpler solution on Unity answers- take 2 audio clips and make them one with this method

    EDIT: trying to use that method with 2 one hour audio files causes it to crash so I used the script I made posted above and it works fine.
     
    Last edited: Sep 30, 2021