NorskTransform.audioMix() method

Mix multiple audio streams together into a single output, with optional gain control on each input.

Signature:

audioMix<Pins extends string>(settings: AudioMixSettings<Pins>): Promise<AudioMixNode<Pins>>;

Parameters

Parameter Type Description

settings

AudioMixSettings<Pins>

Settings for the mixer, including the gain vectors

Returns:

Promise<AudioMixNode<Pins>>

Example [14_compose.ts]

Compose multiple sources into a single output and vary how they are arranged

const mixerSettings: AudioMixSettings<"input1" | "input2"> = {
  id: "mixer",
  onError: (err) => console.log("MIXER ERR", err),
  channelLayout: "stereo",
  sampleRate: 48000,
  sources: [
    { pin: "input1" },
    { pin: "input2" }
  ],
  outputSource: "output"
};

const mixer = await norsk.processor.transform.audioMix(mixerSettings);
mixer.subscribeToPins([
  { source: input1, sourceSelector: audioToPin('input1') },
  { source: input2, sourceSelector: audioToPin('input2') }
]);

Run the following commands together to generate example inputs at urls srt://127.0.0.1:5001?pkt_size=1316, rtmp://127.0.0.1:1935/acme/high:

ffmpeg -v error -re -stream_loop -1 -i data/InkDrop.ts  -vcodec copy -codec copy -f mpegts -flush_packets 0 'srt://127.0.0.1:5001?pkt_size=1316'
ffmpeg -v error -re -stream_loop -1 -i data/Weaving.ts  -vcodec copy -codec copy -f flv 'rtmp://127.0.0.1:1935/acme/high'

Find Examples