Search Unity

Flac audio import support, it's 2017 why no flac?

Discussion in 'Editor & General Support' started by larku, May 11, 2017.

  1. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Storing WAV files in a project for import seems pretty silly when we could use flac for the same lossless quality.

    Flac is an open format that would be trivial to implement as an importer for Unity.

    Why don't we have it? What's the deal?

    Please hear us Unity, flac is wanted, it's 2017, why are we using WAV for lossless?? Makes no sense at all.

    There's a feature request here: https://feedback.unity3d.com/suggestions/add-flac-audio-support please vote for it if you want flac support.

    We want flac :(
     
    Last edited: Jul 17, 2017
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Even better would be to expose an API so we could provide any codecs we choose :)

    Any chance Unity?
     
  3. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    I doubt you’ll ever get an API, since every different platform has different audio decoding libraries written in native code. For now, have you tried encoding your FLAC into an .Ogg file? The .Ogg container supports FLAC, maybe Unity has an up to date .Ogg library that will handle FLAC playback.

    Note that iOS doesn’t support FLAC.
     
    _eternal likes this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I don't think we wants to play flacs at runtime, he just wants to be able to use FLAC in his project as his lossless format that will then be converted to whatever platform appropriate format Unity will convert it to.

    Threw some votes on feedback, I'd like to see flac support too.
     
    nco2k and larku like this.
  5. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I gave it a bunch of votes too. FLAC can reduce file sizes anything from 20% to 80% (averaging about 30%), which is handy for shared projects.
     
    larku likes this.
  6. Silktrader

    Silktrader

    Joined:
    Aug 27, 2014
    Posts:
    8
    Even with LFS support GIT repositories can grow to gargantuan sizes with WAVs. Compressed audio clips are sometimes not an option, because they end up being transcoded (with the inevitable loss of information).
    It'd be great to have FLAC support and just as good to be able to control the OGG encoding settings (beyond the percentage based CBR setting).
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    +1 lossless unity compression for stored audio assets
     
    chadfranklin47 and CyRaid like this.
  8. emkusa

    emkusa

    Joined:
    Sep 16, 2016
    Posts:
    3
    +1
     
    CyRaid likes this.
  9. seanguy2

    seanguy2

    Joined:
    May 3, 2019
    Posts:
    1
    FLAC has now reached the mainstream.. but perhaps doesn't work well with games/the current game engines.

    However, WavePack (.wv) is even smaller in size and still lossless.

    You can use FLAC in FMOD, but they have their FMOD Sound Bank (FSB) preferred file format or whatever
     
    Last edited: May 21, 2019
  10. CyRaid

    CyRaid

    Joined:
    Mar 31, 2015
    Posts:
    134
    The feedback site no longer works because they're working on something a bit more scalable I guess? (Says in a forum post when you click on any feedback link, including the one up there ^)

    I'd love .flac support too. It's like having a high quality png, and exporting it to different platforms in different formats, you don't use it for runtime, but you have the highest possible quality one as a starting point.
     
  11. grahfmusic

    grahfmusic

    Joined:
    Aug 26, 2017
    Posts:
    1
    I would to love a flac option which can then be converted to whatever format is required for whichever build. Lossless and much smaller than wav when using high compression.
     
  12. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
  13. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    Good suggestion — I didn't even know that Ogg could be a container for FLAC-encoded files. Unfortunately this doesn't appear to work in Unity 2019.2.8. I'm seeing an error that says FSBTool Error: Failed decoding audio clip, so perhaps Unity can't decode FLAC in the first place. +1 for this feature as well.

    For anyone who wants to test this in the future, you can export wav -> Ogg-FLAC in Audacity with "Custom FFmpeg Export" or by command line if you navigate to your flac.exe and type something like flac --ogg C:\MyAudioFile.wav. The output will be .oga, and you can just rename it to .ogg. You can confirm that the conversion worked by checking the codec field in Foobar or any similar program.
     
  14. Schroedingers-Cat

    Schroedingers-Cat

    Joined:
    Sep 17, 2019
    Posts:
    7
    Ignacii and christh like this.
  15. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    My GoogleFu says flac support was added in Unity 2020.1.0

    https://unity3d.com/unity/whats-new/2020.1.0
    So the manual probably needs an update.
     
    nco2k and christh like this.
  16. Blepius

    Blepius

    Joined:
    Mar 9, 2021
    Posts:
    68
  17. RageAgainstThePixel

    RageAgainstThePixel

    Joined:
    Mar 11, 2020
    Posts:
    66
  18. MaxLohMusic

    MaxLohMusic

    Joined:
    Jan 17, 2022
    Posts:
    67
    I am not sure what "Added support for importing .flac files" means or how to actually use it in code.

    I see that AudioType still does not have "flac" as a type. I am not sure which AudioType to specify when calling UnityWebRequestMultimedia.GetAudioClip.
     
  19. MaxLohMusic

    MaxLohMusic

    Joined:
    Jan 17, 2022
    Posts:
    67
    Last edited: Dec 14, 2023
  20. RageAgainstThePixel

    RageAgainstThePixel

    Joined:
    Mar 11, 2020
    Posts:
    66