Hi all,
My current project requires the mixing of multiple audio tracks of a song into one song at run time. I’m trying to figure out if Unity is a viable option for me.
I’m new to Unity and I’m worried that the nature of the engine won’t allow me to access the audio at a low enough level to ensure that the tracks remain in sync during run time.
So my question is: is it possible to mix tracks and keep them synced in Unity? and if so, could you point me in the right direction to go about it?
Thanks, Aaron
Hello,
As it has been said, you have direct access to low level data.
See : AudioClip.GetData(float[] data , 0 ) to retreive your data from an AudioClip, you can then separate the different channels
exemple if you have 3 channels :
data[0] fist sample of channel 1
data[1] fist sample of channel 2
data[2] fist sample of channel 3
_
data[3] second sample of channel 1
data[4] second sample of channel 2
data[5] second sample of channel 3
…
You can do any operations you want on those samples then send them back in a clip or directly to the unity Audio buffer.
see:
AudioClip.SetData
and
OnAudioFilterRead