Tone.js
Tone.js copied to clipboard
Feature Request: Tone.Processor()
While we can use Tone.Context.addAudioWorkletModule()
and Tone.Context.createAudioWorkletNode()
, it would be cool to see a Tone.Processor()
Node for custom processing. The idea I am suggesting is that it uses AudioWorklet as the processor and has these features:
- set a buffer size from 128 to 16384. (Maybe use a ring buffer for this or something)
- choose either 'buffer' or 'array' for audio data to be presented as in the processing callback
- allowing features like making custom AudioParams and or setting numberOfInputs etc
- works along with Tone.Transport as well as context time
- allowing to start and stop the processor to save performance
example Idea:
let processor = new Tone.Processor({
//context: BaseContext,
numberOfInputs: 1, //number
numberOfOutputs: 1, //number
bufferSize: 128, //PowerOfTwo
dataType: "array" // string: "buffer" | "array"
//other props etc...
});
processor.onprocess = (event) => {
//event contains the info of audio data and timing etc
//process audio data here:
};
How does the idea sound? I think it would be very useful tool to have. :)
Hi team! Any plans on this?