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

Re: oscillators and the Web Audio API

From: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
Date: Tue, 7 Feb 2012 10:17:07 +0200
Message-ID: <CAJhzemV6HAWuJOEus7n23r3A+6ZgDsV7-Og3pW0bkeF94KkFhQ@mail.gmail.com>
To: philburk@mobileer.com
Cc: public-audio@w3.org
I have been planning to do this for a while now, as I have made a pretty
flexible oscillator algorithm for audiolib.js, allowing for FM, combined
waves (synchronized multi-oscillator) and not to mention PWM for any wave
shape (allows for pretty cool sounds). I also have a JS noise module with
white, pink and brown/red noise.

However, as I've complained before, Web Audio API, for now, isn't very
extensible from JS. I've made suggestions earlier that you should be able
to make custom AudioParam instances, making JS extensions to the graph
first class citizens. Otherwise, it doesn't make much sense to make these
elements as separate modules, but just do all the synthesis in JS, because
you can't get access to all the automation benefits, etc., anyway.

So, I'd like to discuss that issue further before making such modules. Of
course, it would be fairly trivial to port most of my algorithms to C, and
have them as native modules for greater performance benefits, but I don't
think I have enough time to do that right now. :/

Chris, has there been any progress on the AudioParam being made accessible
to JS extensions?

Jussi

On Tue, Feb 7, 2012 at 4:19 AM, 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.
>
> 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.
>
> Thanks,
> Phil Burk
>
>
Received on Tuesday, 7 February 2012 08:21:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 7 February 2012 08:21:10 GMT