Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
Web Audio API: outputChannelCount not working when I inherit from AudioWorkletProcessor

I have the following example. I try to pass the options parameter via calling super(...). When I do this, I don't get 2 output channels as I specified, instead I only get 1 output channel.

class Processor extends AudioWorkletProcessor {
    constructor() {
        super({outputChannelCount: [2]});
    }

    process(inputs, outputs, parameters) {
        console.log("output channels: ", outputs[0].length);
        return true;
    }
}

registerProcessor('processor', Processor);

When I try the same passing the options to the AudioWorkletNode instead, like in the following example, it works as expected.

    let audioContext = new AudioContext();
    (async () => {
        await audioContext.audioWorklet.addModule('processor.js');
        audioWorkletNode = new AudioWorkletNode(audioContext, 'processor', {outputChannelCount: [2]});
        audioWorkletNode.connect(audioContext.destination);
    })();

This is not working in any browser I tried.

Am I doing something wrong? Is this a bug? Is there something in the Web Audio API specification that I am missing here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think what you describe is expected. The constructor of an AudioWorkletProcessor doesn't take any arguments as defined by the IDL definition here:

https://webaudio.github.io/web-audio-api/#AudioWorkletProcessor

The options that you pass to the AudioWorkletNode constructor on the main thread get stored as something called the pending processor construction data. They get applied automatically and there is no way to change them from within the processor.

I guess this is to make sure the AudioWorkletNode and its corresponding AudioWorkletProcessor always have the same configuration. If you could change the configuration within the processor the AudioWorkletNode would be out of sync until the information travelled back again.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda