Audio Mixer patch

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.

Inputs

NameDescription
Audio 1-8

Input the audio signals you want to mix.

Output

NameDescription
Audio

Output the mixed audio output.

Example — harmonizer effect effect

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.

This is what the audio effect sounds like.

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:

  1. The output of the Audio Player patch is connected to the Audio port in three Pitch Shifter patches. This splits the audio into 3 identical streams.
  2. Each Pitch Shifter patch is connected to a separate Gain patch.
  3. Each Gain patch is connected to Audio 1-3 ports in the Audio Mixer patch.
  4. Finally, the Audio output of the Audio Mixer patch is connected to a patch representing the Audio property of a speaker in the scene.

Adjusting the pitch and gain

To achieve the effect in this example we changed the:

  • Semitone Adjustment in the three Pitch Shifter patches to: -7, 0 and 5.
  • Amount input in each Gain patch to 0.7.

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.

Troubleshooting

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.