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

Re: Reflections on writing a sequencer

From: Adam Goode <agoode@google.com>
Date: Thu, 26 Jul 2012 11:02:26 -0400
Message-ID: <CAOf41NkaMdOaBH2Pdu8mRkQD3FGCpcygDpfs=jvNGeafcZyrgg@mail.gmail.com>
To: Peter van der Noord <peterdunord@gmail.com>
Cc: public-audio@w3.org
I think you would do node.noteOn(e.playbackTime +
(samplesWrittenThisCallback / sampleRate)).

On Thu, Jul 26, 2012 at 10:56 AM, Peter van der Noord <peterdunord@gmail.com
> wrote:

> can you give an example?
> Let's say i am in my buffer-write loop (in response to an
> AudioProcessingEvent), and at a certain point in that loop (i may or may
> not have written a number of values already) i want to call note-on on
> another node to be fired exactly at the same time that the buffervalue i'm
> writing (or about to write) would reach the soundcard. how would that work?
> at least, that's what i understand i can do then...?
>> An AudioProcessingEvent exposes the exact time of the audio to be generated in the sample stream as the "playbackTime" attribute.  Not that this makes callbacks any more useful as a source of exact timing, but it does mean that there is no need to keep track of time in separate variables.
Received on Thursday, 26 July 2012 15:03:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:11 UTC