W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2012

Re: Web Audio API ambient drone

From: Chris Wilson <cwilso@google.com>
Date: Mon, 16 Jul 2012 09:49:24 -0700
Message-ID: <CAJK2wqWLMc3zUO2c_omKzujgkRTV+6vv+Chn7KPcmL=MYDX_zA@mail.gmail.com>
To: Matt Diamond <mdiamond@jhu.edu>
Cc: public-audio@w3.org
Hmm.  If there is a perceptible looping effect, that's broken and should be
fixed.  (I used looped noise in the web audio vocoder (
webaudiovocoder.appspot.com, needs Chrome Dev channel or better), and never
noticed a problem.)  If you happen to run across it again, could you
forward me a repro case?

-C


On Sun, Jul 15, 2012 at 1:06 PM, Matt Diamond <mdiamond@jhu.edu> wrote:

> Thanks for the tip! An earlier version of this did in fact use
> pre-computed noise buffers, but I felt there was a vaguely perceptible
> "looping" effect because of the looping noise sample (it was a cool effect
> though). Another reason was that I was presenting a version of this script
> at a meetup, and felt like utilizing a JavaScriptAudioNode for real-time
> noise generation would be more interesting to demonstrate... but yes, it
> certainly takes a bit of a toll, and running a bunch of AudioBufferSource
> nodes would probably be much less taxing.
>
> Still, I'm pretty impressed that the API is able to handle so much, even
> if it's only on higher-end machines (I'm running it on a year-old MacBook
> Pro).
>
> Matt
>
>
> On Sun, Jul 15, 2012 at 8:03 AM, Chris Wilson <cwilso@google.com> wrote:
>
>> Hey Matt-
>>
>> Neat!  I like the apparent pitch generated by bandpass filter.
>>
>> One comment - instead of continually generating noise via
>> JavaScriptAudioNodes, you'd probably find it much more performant to
>> pre-generate a couple of seconds (to avoid any detectable periodicity) of
>> noise in a Buffer and playing it as an AudioNode.  That would probably be a
>> bit more performant than continually calling Math.random for each sample.
>>
>> var lengthInSamples =  2 * audioContext.sampleRate;
>> var noiseBuffer = audioContext.createBuffer(1, lengthInSamples,
>> audioContext.sampleRate);
>> var bufferData = noiseBuffer.getChannelData(0);
>> for (var i = 0; i < lengthInSamples; ++i) {
>>     bufferData[i] = (2*Math.random() - 1);
>>  }
>>
>> On Sat, Jul 14, 2012 at 12:26 PM, Matt Diamond <mdiamond@jhu.edu> wrote:
>>
>>> Hey all,
>>>
>>> Put together a little experiment in synthesizing an ambient sound
>>> texture using the Web Audio API:
>>>
>>> http://matt-diamond.com/drone.html
>>>
>>> Matt
>>>
>>
>>
>
Received on Monday, 16 July 2012 16:49:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 16 July 2012 16:49:54 GMT