Search Unity

Save and compress audioclip data?

Discussion in 'Developer Preview Archive' started by schipman, Mar 2, 2012.

  1. schipman

    schipman

    Joined:
    Jan 22, 2010
    Posts:
    45
    Hi, does anyone know of a way to save audioclip data (captured via the microphone) into something other than wav using Unity? Like ogg or mp3?
     
  2. svenskefan

    svenskefan

    Joined:
    Nov 26, 2008
    Posts:
    282
    Hi!
    your question seems to imply that you have figured out how to save audioclip data to wav?
     
  3. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    I would love to know if anyone succeeded with this.
     
  4. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Unity will give you the raw samples from the microphone. There are quite a few libraries that will translate that to various formats.

    There are also a few voice chat packages on the asset store. They usually use the very fast u-law or similar, which produce good performance and acceptable quality for voice, but isn't recommended for music and similar.
     
  5. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi,

    A while back, I shared a writing to wav script here.

    Not tested in 4.0 beta, and written while I was even less experienced than I am now, but it certainly works in 3.5+.

    Gregzo
     
  6. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    Wow, that's nice. Did you find a way to convert to ogg as well? So far I've been using the oggenc unix executable, but I'd prefer a c# solution.