I am working on a mod player which is an audio file with 4 different tracks (channels) using webaudio/audioWorkletNode.
I got it working correctly using a 2 channel (stereo) audio node:
- channels (tracks) 0 & 3 are mixed into the left channel
- channels (tracks) 1 & 2 are mixed into the right channel
The problem is that I'd like to analyse and show a waveform display for each of the tracks (so there should be 4 different analysers).
I had the idea of creating an audioWorkletNode with outputChannelCount set to [4], connect an analyser to each of the node's four channels, and then use a channelMerger to mix it into 2 stereo channels.
So I used the following code, expecting it to create a node with 4 channels:
let node = new AudioWorkletNode(context, 'processor', { outputChannelCount: [4] });
But the outputChannelCount parameter seems to be ignored. No matter what I specify, it's set to 2 channels in the end.
Is there a way to do it another way, or must I handle the analyse myself, using my own analyser?