[LAD] ALSA Sequencer timestamp on event without scheduling

Felipe Ferreri Tonello eu at felipetonello.com
Mon Sep 19 13:19:15 UTC 2016


Hi Clemens,

On 19/09/16 13:27, Clemens Ladisch wrote:
> Felipe Ferreri Tonello wrote:
>>  * We want to deliver these events *ASAP* to the application -
>> scheduling adds latency, a lot;
>>  * Timestamps are in the past relative to the central.
>>
>> But I still need the timestamp information. Why? The spec doesn't
>> explain, but it makes sense to believe it is used to have a predictable
>> latency, so if the central device wants to layout these MIDI message,
>> they little or no jitter in between.
> 
> MIDI is a real-time protocol, and the sequencer assumes that events are
> delivered in real time.
> 
> If you want to minimize jitter, you have to impose a certain fixed
> latency, and schedule all events that arrived too early.
> 
> If you want to minimize latency, you have to deliver the events
> immediately.
> 
>> Thus, to be MIDI compliant
> 
> Compliant with what?  The MIDI specification does not say anything about
> timestamps associated with events.

MIDI-BLE[1] (MIDI over Bluetooth Low Energy) _does_ specify timestamp
associated with a MIDI message, like I already mentioned.

> 
>> we need to set this timestamp some how on the event. And I think the
>> simplest way, is to use snd_seq_real_time_t on ev.time.time.
> 
> But nobody will read it. 

Applications which cares about the event timestamp already reads it.

But even then, we can patch and add this functionality that is needed by
MIDI-BLE. Unless we find a better way of doing so.

> And without a queue, the timestamp does not
> make sense. 

Applications who cares about timestamp have their own queue implementation.

> And applications that care about the time of received events
> tell the sequencer to overwrite the timestamp with the actual delivery
> time anyway.

Applications only need to care about the timestamp field for that event,
it doesn't matter who set it (the ALSA Seq scheduler or other client, in
this case the BLE driver).

[1] https://www.midi.org/specifications/item/bluetooth-le-midi

-- 
Felipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x92698E6A.asc
Type: application/pgp-keys
Size: 7177 bytes
Desc: not available
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20160919/9a3de83b/attachment.key>


More information about the Linux-audio-dev mailing list