Search Unity

Watch out when using Audio Channels to convert to mono

Discussion in 'Editor & General Support' started by Jessy, Apr 11, 2009.

  1. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    AudioImporter.channels seems to be a handy little addition to Unity, so that you can easily use stereo clips and get positional loudness rolloff for them. However, I just some testing, and realized that anything above -3 dB in the summed-to-mono waveform will be clipped.

    In layman's terms, loud stereo clips will get distorted when turned into mono. I logged a bug, but for now, beware.
     
  2. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Just got word from UT that they couldn't reproduce the problem yet. It's definitely a problem for me. Current system specs:

    MacBook Pro (last revision before the unibody)
    OS 10.5.6
    2.4 GHz
    4 GB RAM
     
  3. Samantha

    Samantha

    Joined:
    Aug 31, 2005
    Posts:
    609
    We found and squashed a lot of these bugs during the 2.5 beta cycle. Any stragglers are probably specific to the asset. I haven't looked at your bug report myself, but did you include the audio file or the project folder? If you reimport the file does the problem go away?
     
  4. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I included several files. The problem does not go away upon reimport.

    As I said, the problem is definitely dependent on the asset. That is to say, any audio with loud peaks will be distorted, at least on my system. The project folder I sent includes four files:

    -20 dB sine wave works perfectly

    -3 dB sine wave works perfectly, but this is the very maximum of what does

    0 dB and -1 dB sine waves are clipped off in each stereo channel at -3 dB
    (the clip may be mono, but my playback systems have two speakers/output channels)
     
  5. caitlyn

    caitlyn

    Joined:
    Jun 20, 2008
    Posts:
    402
    Interesting!

    I really thought we nailed that one during the beta cycle.. but thanks Jesse, submitting the problem files is really helpful. We'll get this to our sound guru ASAP.

    In the meantime, have you found a workaround? How about re-exporting your files with the sound levels normalized to a working level, and converting to mono with your sound editor?

     
  6. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Definitely, the workaround is just to use an external editor to convert to mono. In fact, that's my only choice, in general, consider I mainly use Unity iPhone, and that version of Unity doesn't have the mono converter yet! This is just a mild inconvenience, not a show-stopper. But, I wanted to get this post out there, in case others have the problem, and come searching the forums for what's going on.

    If anyone else does experience the distortion, however, I'd recommend just converting all files to mono externally, because it would be annoying to search all of your audio files for any samples above -3 dB.