Search Unity

Dynamically creating audiomixers with audio sources

Discussion in 'Audio & Video' started by WorshipCookies, Jun 18, 2015.

  1. WorshipCookies

    WorshipCookies

    Joined:
    Jun 8, 2013
    Posts:
    2
    Hey guys, I am still kind of new to Unity and I have been extensively exploring the audio system. I am currently working on a research project that would require some flexibility on how audio assets are chosen and played during run time.

    Basically I would like to know if its possible to create an audio pipeline using scritping that goes like this: AudioSource -> AudioMixer -> MasterMixer, where the MasterMixer is a singleton and the AudioMixer is unique to each audio source. Ideally the parameters of the AudioMixer would also be exposed, in order to alter values of associated effects during run time. AudioClips are obtained through a soundbank.

    Is this even possible with Unity? Any help would be appreciated.
     
  2. aihodge

    aihodge

    Joined:
    Nov 23, 2014
    Posts:
    163
    AFAIK there is no way to create an AudioMixer via script. In your case, why have a separate mixer for each AudioSource - why not use a single mixer for the entire project and route AudioSources through individual groups on the mixer?
     
  3. WorshipCookies

    WorshipCookies

    Joined:
    Jun 8, 2013
    Posts:
    2
    Hey aihodge, thanks for the quick reply! I have been looking at alternatives to this solution. The reason for this is that I am trying to build a prototype that attempts to study the effects of sound over gameplay, where levels and sound are procedurally generated. I want to have a degree of control over each AudioSource and apply and keep track of all the parameters of specific effects during gameplay. There is also an element of unpredictability as the number of clips chosen can vary substantially.