Replacing scriptProcessorNode with AudioWorklet
I am working on recording microphone input from the user and processing it. The problem is that I am using scriptProcessorNode to process data, but here it said that is has been deprecated and replaced with AudioWorklet.The problem is that there is no clear way to replace this functionality with AudioWorklet, and from all of the example projects with AudioWorklets from Google, none of them is doing anything with microphone input. Is there a way to replace this code with Audio Worklet? Here is the code that "should" be replaced.
// Connect analyser
this.options.source.connect(this.analyser);
// Create ScriptProcessorNode
this.scriptProcessorNode = this.options.context.createScriptProcessor(this.options.bufferLen, numChannels, numChannels);
// Connect scriptProcessorNode (Theretically, not required)
this.scriptProcessorNode.connect(this.options.context.destination);
// Create callback to update/analyze floatFrequencyData
var self = this;
this.scriptProcessorNode.onaudioprocess = function (event) {
self.analyser.getFloatFrequencyData(self.floatFrequencyData);
self.update();
self.store(event);
self.monitor();
};
// Connect scriptProcessorNode
this.options.source.connect(this.scriptProcessorNode);
audio-recording web-audio voice-recording
add a comment |
I am working on recording microphone input from the user and processing it. The problem is that I am using scriptProcessorNode to process data, but here it said that is has been deprecated and replaced with AudioWorklet.The problem is that there is no clear way to replace this functionality with AudioWorklet, and from all of the example projects with AudioWorklets from Google, none of them is doing anything with microphone input. Is there a way to replace this code with Audio Worklet? Here is the code that "should" be replaced.
// Connect analyser
this.options.source.connect(this.analyser);
// Create ScriptProcessorNode
this.scriptProcessorNode = this.options.context.createScriptProcessor(this.options.bufferLen, numChannels, numChannels);
// Connect scriptProcessorNode (Theretically, not required)
this.scriptProcessorNode.connect(this.options.context.destination);
// Create callback to update/analyze floatFrequencyData
var self = this;
this.scriptProcessorNode.onaudioprocess = function (event) {
self.analyser.getFloatFrequencyData(self.floatFrequencyData);
self.update();
self.store(event);
self.monitor();
};
// Connect scriptProcessorNode
this.options.source.connect(this.scriptProcessorNode);
audio-recording web-audio voice-recording
add a comment |
I am working on recording microphone input from the user and processing it. The problem is that I am using scriptProcessorNode to process data, but here it said that is has been deprecated and replaced with AudioWorklet.The problem is that there is no clear way to replace this functionality with AudioWorklet, and from all of the example projects with AudioWorklets from Google, none of them is doing anything with microphone input. Is there a way to replace this code with Audio Worklet? Here is the code that "should" be replaced.
// Connect analyser
this.options.source.connect(this.analyser);
// Create ScriptProcessorNode
this.scriptProcessorNode = this.options.context.createScriptProcessor(this.options.bufferLen, numChannels, numChannels);
// Connect scriptProcessorNode (Theretically, not required)
this.scriptProcessorNode.connect(this.options.context.destination);
// Create callback to update/analyze floatFrequencyData
var self = this;
this.scriptProcessorNode.onaudioprocess = function (event) {
self.analyser.getFloatFrequencyData(self.floatFrequencyData);
self.update();
self.store(event);
self.monitor();
};
// Connect scriptProcessorNode
this.options.source.connect(this.scriptProcessorNode);
audio-recording web-audio voice-recording
I am working on recording microphone input from the user and processing it. The problem is that I am using scriptProcessorNode to process data, but here it said that is has been deprecated and replaced with AudioWorklet.The problem is that there is no clear way to replace this functionality with AudioWorklet, and from all of the example projects with AudioWorklets from Google, none of them is doing anything with microphone input. Is there a way to replace this code with Audio Worklet? Here is the code that "should" be replaced.
// Connect analyser
this.options.source.connect(this.analyser);
// Create ScriptProcessorNode
this.scriptProcessorNode = this.options.context.createScriptProcessor(this.options.bufferLen, numChannels, numChannels);
// Connect scriptProcessorNode (Theretically, not required)
this.scriptProcessorNode.connect(this.options.context.destination);
// Create callback to update/analyze floatFrequencyData
var self = this;
this.scriptProcessorNode.onaudioprocess = function (event) {
self.analyser.getFloatFrequencyData(self.floatFrequencyData);
self.update();
self.store(event);
self.monitor();
};
// Connect scriptProcessorNode
this.options.source.connect(this.scriptProcessorNode);
audio-recording web-audio voice-recording
audio-recording web-audio voice-recording
asked Nov 1 at 8:44
Filip Skukan
7917
7917
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have a simple example of creating an AudioWorkletProcessor. You can check it here. It only works on Chromium, Firefox don't have support for AudioWorklet yet.
It's an example I've prepared to show a webpack error I'm having, so please check only the source code. If you run the project it will fail unless you comment audio-meter.js line 8 and uncomment line 11. The file audio-meter.worker.js is duplicated with the same content.
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53097768%2freplacing-scriptprocessornode-with-audioworklet%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have a simple example of creating an AudioWorkletProcessor. You can check it here. It only works on Chromium, Firefox don't have support for AudioWorklet yet.
It's an example I've prepared to show a webpack error I'm having, so please check only the source code. If you run the project it will fail unless you comment audio-meter.js line 8 and uncomment line 11. The file audio-meter.worker.js is duplicated with the same content.
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
|
show 1 more comment
I have a simple example of creating an AudioWorkletProcessor. You can check it here. It only works on Chromium, Firefox don't have support for AudioWorklet yet.
It's an example I've prepared to show a webpack error I'm having, so please check only the source code. If you run the project it will fail unless you comment audio-meter.js line 8 and uncomment line 11. The file audio-meter.worker.js is duplicated with the same content.
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
|
show 1 more comment
I have a simple example of creating an AudioWorkletProcessor. You can check it here. It only works on Chromium, Firefox don't have support for AudioWorklet yet.
It's an example I've prepared to show a webpack error I'm having, so please check only the source code. If you run the project it will fail unless you comment audio-meter.js line 8 and uncomment line 11. The file audio-meter.worker.js is duplicated with the same content.
I have a simple example of creating an AudioWorkletProcessor. You can check it here. It only works on Chromium, Firefox don't have support for AudioWorklet yet.
It's an example I've prepared to show a webpack error I'm having, so please check only the source code. If you run the project it will fail unless you comment audio-meter.js line 8 and uncomment line 11. The file audio-meter.worker.js is duplicated with the same content.
edited Nov 13 at 12:41
answered Nov 12 at 5:31
Alvaro Maceda
3291314
3291314
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
|
show 1 more comment
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
I cannot access the link you attached
– Filip Skukan
Nov 13 at 8:00
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Sorry, I've corrected the link.
– Alvaro Maceda
Nov 13 at 12:41
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Did it solve your problem, Filip?
– Alvaro Maceda
Nov 16 at 12:51
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
Hey, I was having some issues and I didn't really have time to debug it. I see audio-meter.js is trying to import audio-meter.worker.js but audio-meter.worker.js is not providing any default export. I am trying to test the site on localhost.
– Filip Skukan
Nov 17 at 14:04
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
My bad, it works actually. What are you doing with the audio input?
– Filip Skukan
Nov 17 at 14:15
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53097768%2freplacing-scriptprocessornode-with-audioworklet%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown