Search Unity

Audio Audio Filter only works on 2 channels (5.1 Audio Installation)

Discussion in 'Audio & Video' started by Korun3, Aug 14, 2019.

  1. Korun3

    Korun3

    Joined:
    Aug 26, 2018
    Posts:
    2
    Hey,

    I'm a freelancer currently working on an 5.1 Audio Installation project and have been researching ways to work with multi-channel Audio in Unity.

    My goal is to make a solution that allows tweaking the volumes of every channel of an AudioClip during Playback. (Realtime - not during creation.)

    I achieved that using multiple AudioSources and by using a method from following blog:
    https://thomasmountainborn.com/2016/06/10/sending-audio-directly-to-a-speaker-in-unity/

    Now I was hoping I could create a more elegant solution using AudioFilter (https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAudioFilterRead.html), but after testing the AudioFilter seems to only work on two channels. Event function parameter "channels" is 2 even if the audio played has 6 channels.

    Could not found anything about that neither in Docs nor in Forums.
    Is there some magic I'm missing? Or is this a bug/feature?

    Thanks.
     
  2. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    789
    if you change default output mode in project settings -> audio you'll get appropriate # of channels in filter callback
     
  3. Korun3

    Korun3

    Joined:
    Aug 26, 2018
    Posts:
    2
    That solved the issue, Thanks!

    I'll just set it by script using the highest driver capability.