W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: [Web MIDI API] send() timestamp

From: Chris Wilson <cwilso@google.com>
Date: Tue, 18 Dec 2012 11:23:12 -0800
Message-ID: <CAJK2wqWAL_kGPbc8sQT-EyxaVpZfcK6zo3MEbDYMdYPENWx2rA@mail.gmail.com>
To: Marcos Caceres <marcos@marcosc.com>
Cc: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>, "public-audio@w3.org" <public-audio@w3.org>
OK, I pulled in a lot of the structural protection changes, and the
performance.now polyfill, and tested on Chrome/FF/Safari on OSX.


On Sun, Dec 16, 2012 at 1:05 AM, Marcos Caceres <marcos@marcosc.com> wrote:

>
>
>
> On Saturday, 15 December 2012 at 15:04, Marcos Caceres wrote:
>
> > Ok, I think I'm getting it now :) I'll try to set up a little experiment
> and see if I can replicate the above (though it won't really work in the
> reference implementation as we are still relying on setTimeout for
> scheduling... which only has a precision of 4ms)
>
> Ok, got it all going :)
> http://marcoscaceres.github.com/WebMIDIAPIShim/
>
> So, to replay a recording made locally, it's basically:
> //pre-recorded data
> var record=[{data:[...], stamp: 123113}, … ];
>
> //time playback relative to "now"
> var start = window.performance.now() - record[0].stamp;
> record.forEach(function(packet){
> output.send(packet.data, packet.stamp + start);
> })
>
>
>
> I also polyfilled performance.now() for various browsers. See bottom of:
> http://marcoscaceres.github.com/WebMIDIAPIShim/WebMIDIAPI.js
>
> Hopefully that all looks about right now (bar the changes I made to API to
> make it easier to use… which I hope you will consider).
>
> --
> Marcos Caceres
> http://datadriven.com.au
>
>
>
>
Received on Tuesday, 18 December 2012 19:23:43 UTC

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