Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using WebAudio - AudioWorkletProcessors to process Audio Data #819

Open
arvind-iyer-2001 opened this issue Aug 31, 2023 · 0 comments
Open
Labels
question Further information is requested

Comments

@arvind-iyer-2001
Copy link

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

@arvind-iyer-2001 arvind-iyer-2001 added the question Further information is requested label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant