Describe the feature
Because many developer have little knowledge for Sound or DSP (Digital Signal Processing), it is difficult to handle OscillatorNode or AudioBufferSourceNode. Therefore, enable to control oscillator or one-shot audio on the music side on v2.
Is there a prototype?
For example,
Oscillator
const context = new AudioContext();
const note = new NoteNode(context, { note: 'A', source: 'sawtooth' });
note.connect(audiocontext.destination);
note.start(0); // -> 440 Hz
One-shot
const context = new AudioContext();
const note = new NoteNode(context, { note: 'A', source: buffer }); // `buffer` is the instance of `AudioBuffer` from `decodeAudioData`
note.connect(context.destination);
note.start(0); // -> 440 Hz
Describe the feature in more detail
This API (NoteNode) is higher abstract than OscillatorNode or AudioBufferSourceNode. This API is inspired by BASIC.
... Or, MML (Music Macro Language) parser will be implemented by Web Audio API (Example).
This proposed API seems very high-level, and is probably better implemented in userland JavaScript. In fact, we already have Web Audio API synthesizers with a similar API that you're suggesting. For example: https://tonejs.github.io/
I agree with you on v1. But, for example, as BiquadFilterNode and IIRFilterNode are implemented, I think that it is better if high-level API like NoteNode is also implemented on v2 as is the case with BASIC. (Of course, this proposal costs for implementation ...)
Also, the example using an AudioBuffer seems under-specified. What's the relationship between the given note and the buffer itself? If the buffer is from decodeAudioData, it could contain anything so how will the note option work?
Sorry ... I did not consider it. I agree with you. But, the major purpose of this issue is in order to propose higher-level API than v1. So, prototype is provisional (Or, please think only oscillator).
Most helpful comment
Also, the example using an AudioBuffer seems under-specified. What's the relationship between the given note and the buffer itself? If the buffer is from
decodeAudioData, it could contain anything so how will the note option work?