-
-
Notifications
You must be signed in to change notification settings - Fork 237
Splitting and Merging Audio
Instead of copying the audio to a single destination you can use the MultiOutput class and add multiple final output classes to it: e.g. a I2SStream and the VolumeMeter class which measures the volume.
You can define the outputs in the constructor or you can define them by calling the add method.
Here are some examples:
You can use the InputMixer class to combine multiple inputs into one output. Just add the Sources that need to be mixed to the Mixer and use it as copy source. Note that this is however only working if the basic audio input is in PCM format and is the same across all inputs:
- number of channels
- bits per sample
- sample rate
Here is a simple InputMixer example
You can use the OutputMixer class to mix multiple outputs into one single output. You need to define the total number of outputs and then write the data for each output to the mixer. Note that this is however only working if the basic audio output is in PCM format and the same across all outputs:
- number of channels
- bits per sample
- sample rate
Please note that mixing on the output side is quite challenging and requires plenty of additional memory.
Here is a simple OutputMixer example
You can use the InputMerge class to combine 2 mono input channels into a stereo signal. The first input stream is ending up on one channels and the second stream on the other.
Here is a simple Merging Example
You can use the ChannelSplitOutput class to extract a mono channel from a stereo signal or to split the stereo signal into two separate mono signals. Just define for each relevant channel your selected output class.
The ChannelsSelectOutput class can be used do extract one or multiple channels to one or more outputs. Just select the channels: e.g. 2,3 creates a stereo signal consisting of channel 2 and channel 3.