Skip to content

Using WebAudio - AudioWorkletProcessors to process Audio Data #819

@arvind-iyer-2001

Description

@arvind-iyer-2001

Question
I'm tryin to use WebAudioAPIs to add my custom audio processor, (for now it just outputs the input value, I'll need it later to perform some Audio Analysis, not needed to modify the output).
I have been trying to use the below code to process the audioTrack data but have not been able to see any results of its working.
How can I make this work.

AddAudioProcessor Callback
image

const addAudioProcessor = useCallback(async () => { if (audioTrack) { const mediaStream = new MediaStream(); mediaStream.addTrack(audioTrack.mediaStreamTrack); const audioContext = new AudioContext(); audioContext.createMediaStreamSource(mediaStream); await audioContext.audioWorklet.addModule("Test-Processor.js"); const testNode= new AudioWorkletNode( audioContext, 'test-processor' ); testNode.connect(audioContext.destination); } }, [audioTrack])

Test-Processor.js
image

I have been refering to the WebAudio Documentation to implement this.
https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletProcessor

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions