W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Re: oscillators and the Web Audio API

From: Phil Burk <philburk@mobileer.com>
Date: Wed, 08 Feb 2012 11:07:31 -0800
Message-ID: <4F32C7F3.7030907@mobileer.com>
To: public-audio@w3.org
Hello Joe,

On 2/8/12 7:49 AM, Joe Berkovitz wrote:
> As much as I like the idea of built in high quality oscillators, I am
> concerned about scope creep.

I share your concern. One can go crazy adding lots of obscure modules. 
But over time it has become evident what modules can be considered core 
functionality. For signal generators that would be:

* sine - pure tones
* sinePM - phase modulated sine oscillator for "FM"
* sawtooth - rich spectrum for subtractive synthesis, string sounds
* square - woody sound for reeds
* pulse - simple timbral modulation, square is just a 50:50 pulse
* wavetable - for arbitrary or natural sounds

* white noise - flat spectrum, harsh sound
* pink noise - softer, more pleasant sound
* red noise - useful for random modulation

I will review the WebAudioAPI to see if anything else is missing.

> Is it possible to take a v1 wavetable-like approach using prefilled
> buffers containing various looped waveforms, played at varying playback
> rates. instead of algorthmic oscillators?

A single wavetable works well over a limited pitch range. It's fine for 
a keyboard playing notes at fixed pitches.  But for sound effects the 
frequency is often modulated over several octaves and may even go 
negative. You can get some serious aliasing from that.

A wavetable might work if you start with a large wavetable for the 
bottom octave and then internally generate filtered wavetables with the 
same size for the higher octaves. You can then interpolate between 
wavetables based on frequency.  But it might be easier to just provide 
the basic oscillator types with DPW band limiting. The code is tricky 
but quite small.

Phil Burk
Received on Wednesday, 8 February 2012 20:06:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 8 February 2012 20:06:10 GMT