Use the Audio Mixer patch to combine the output from multiple audio sources, or audio streams.
This patch is very useful for applying the same audio processing effects to multiple audio sources at the same time. For example, you could mix separate audio sources (clips) together before applying the same reverb effect, as in the example below:
Alternatively, you can pass multiple audio streams/sources through different sound effects before mixing them together and outputting them as one.
Input the audio signals you want to mix.
Output the mixed audio output.
To create the harmonizer effect in this example, we split the audio stream from the RockGuitarRiff audio clip (available from Spark AR library) into three identical streams. We then applied a different pitch to each stream, and adjusted the volume levels of each with gain patches, before mixing the signals back together again.
We achieved this with the patch graph below:
In the graph, the audio clip represented by the orange patch is set up to play on a loop as soon as the effect is opened. Familiarize yourself with this setup in this article.
To split the audio and mix it back together again:
Adjusting the pitch and gain
To achieve the effect in this example we changed the:
Adjusting the semitones on two streams creates two different harmonies, each an octave apart (-7, 5). The middle Pitch Shifter is set to 0 to compensate for the latency incurred by the Pitch Shifter audio processing on the other two streams. This configuration allows the second signal to pass through the Pitch Shifter unaltered, while staying in sync with the other two signals.
The Gain patches are set to 0.7, to reduce the level of each signal before they’re combined by the Audio Mixer. It's a good idea to lower the gain of multiple signals before, instead of after, passing them through a mixer or other patch. This avoids pushing the patch beyond its limit and distorting the sound.
I can’t hear the audio when it’s passed through an Audio Mixer
If you can’t hear any audio output from a mixer patch, it could be because you’re trying to combine the input from the microphone with another audio source.
In Spark AR Studio, any audio signal that includes the microphone is muted during effect preview and recording. This prevents undesirable feedback loops where the microphone and speaker signals feed into each other, creating a shrieking sound.
In the graph below, the entire audio output will be muted because a patch representing the microphone is connected to the audio mixer. The sound will only be audible in a captured video of the effect playing.
If you want to hear the output of an Audio Mixer patch during preview while also including microphone audio effects in your Spark project, make sure the microphone is connected to a different speaker than the output of your mixer patch.