- From: Chris Rogers <crogers@google.com>
- Date: Tue, 7 Feb 2012 12:41:41 -0800
- To: philburk@mobileer.com
- Cc: public-audio@w3.org
- Message-ID: <CA+EzO0nooAtTt-z6wkUZV6FTFcr-Lm1mR2Vv0Br+oepzqr0BVg@mail.gmail.com>
On Mon, Feb 6, 2012 at 6:19 PM, Phil Burk <philburk@mobileer.com> wrote: > I have begun doing some experiments with the Web Audio API described here: > > <https://dvcs.w3.org/hg/audio/**raw-file/tip/webaudio/**specification.html<https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html> > > > > In general, I really like the API. It will be great to have a flexible > set of synthesis modules available from JavaScript. I was impressed > with the inclusion of FFT support, convolution, occlusion, etc. I was > also very happy to see that timestamps are supported. That is so crucial. > Phil, thanks for having a look at the specification. Sample-accurate timing was one of the primary design goals of the system, and we're doing our best to test these APIs with automated tests (called "layout tests"): http://svn.webkit.org/repository/webkit/trunk/LayoutTests/webaudio/ One specific test we have for "note" scheduling is here: http://svn.webkit.org/repository/webkit/trunk/LayoutTests/webaudio/sample-accurate-scheduling.html We're currently working on layout tests for the AudioParam automation APIs to make sure that the engine renders precisely. > > I am now trying to do some "Hello World" type examples and have hit a > few snags. Perhaps someone could help me. > > My first test was to generate a tone using an oscillator. > > <http://www.softsynth.com/**webaudio/tone.php<http://www.softsynth.com/webaudio/tone.php> > > > > But I could not find the oscillator class. I could use a looping buffer > but that would be difficult to use for FM or multi-octave sweeps. It is > also difficult to control aliasing with a looped wavetable, even with > multi-point interpolation. > > Luckily I was able to use a JavaScriptNode to implement a simple sine > oscillator. It would be nice to have an AudioOscillator class with sine, > sawtooth, square, pulse and impulse. The oscillator should accept > frequency values that can go negative for extreme modulation. > > An AudioNoise class would also be very useful with white noise, pink > noise and red noise generation. Stochastic synthesis is very handy for > wind, explosions, percussive sounds, etc. > Up to this point we've relied on AudioBufferSourceNode for general sample playback, and also periodic waveform playback. I completely agree that there are some challenges and limitations to this approach. Nevertheless, I've worked on a demo using this approach in my "wavetable-synth" and have made some initial (although incomplete and not fully developed) anti-aliased wavetables: http://chromium.googlecode.com/svn/trunk/samples/audio/lib/wavetable.js But, back to your proposal. Having the pure and extremely high-quality anti-aliased oscillators would be great to have, especially if you have code to contribute. Sound quality does matter, so I really appreciate this. One thing I'm curious about is how these oscillators can avoid aliasing when used in FM applications. It's certainly a goal of mine to have audio-rate signals modulating AudioParams like .playbackRate or .frequency The sine, sawtooth, square, pulse and impulse oscillators are considered common in computer-music and so would fit into the Web Audio API's philosophy of implementing common audio building blocks. I would suggest that the AudioOscillator could have an attribute called .oscillatorType which could be one of several values. I would also be interested in your take on how to implement anti-aliased oscillators with arbitrary waveforms. Optimally, the AudioOscillator would be able to handle more than just the simple waveform types. I have some ideas of my own, but we can leave that for later discussion. Cheers, Chris > > Thanks, > Phil Burk > >
Received on Tuesday, 7 February 2012 20:45:49 UTC