All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Dannenberg <rbd@cs.cmu.edu>
To: alsa-devel@alsa-project.org
Subject: Can ALSA MIDI use timestamps for precise timing?
Date: Thu, 24 Aug 2017 13:51:00 -0400	[thread overview]
Message-ID: <fdc3abae-84b8-d94c-991d-cdd30c4d9f64@cs.cmu.edu> (raw)

Hi,

    I wrote PortMIDI long ago and now that it's going into Audacity and
we're having timing problems in Linux, I'm revisiting the code and
wondering if ALSA has a fundamental design problem. I'm hoping I'm
missing something, but here's the problem:

    PortMIDI wants to send MIDI messages at precise times according to
arbitrary clocks. In Audacity, the important clock to synchronize to is
the audio sample clock. To synchronize MIDI, one can in principle use
timestamps and let the device driver, which presumably runs with very
low latency, dispatch MIDI from a queue to the device or destination.
The question is then what timestamp to use. ALSA has some options.
There's relative timing, but if you send with relative time and you get
unscheduled just as you are executing the write call, you'll be late.
There's absolute timing, but the docs say that's relative to when you
start the queue, but when exactly is that? The problem becomes precise
timing of queue creation doesn't it? And there's no timestamp provided
for when to start. If "absolute" mean exactly the system time, that
would be great, but I think that's not the case.

    Is this a fundamental design error, or am I missing something?

    Thanks. -Roger Dannenberg



_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

             reply	other threads:[~2017-08-24 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 17:51 Roger Dannenberg [this message]
2017-08-28  9:11 ` Can ALSA MIDI use timestamps for precise timing? Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fdc3abae-84b8-d94c-991d-cdd30c4d9f64@cs.cmu.edu \
    --to=rbd@cs.cmu.edu \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.