From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: David Henningsson <coding@diwic.se>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2] sound: rawmidi: Add framing mode
Date: Wed, 24 Mar 2021 22:29:44 +0900 [thread overview]
Message-ID: <20210324132944.GB3711@workstation> (raw)
In-Reply-To: <cab75b18-37ca-eacb-deff-b25900b169ba@diwic.se>
Hi,
On Wed, Mar 24, 2021 at 12:18:59PM +0100, David Henningsson wrote:
> On 2021-03-24 11:03, Takashi Iwai wrote:
> > This looks like a good middle ground solution, while we still need to
> > address the sequencer timestamp (basically we should be able to send
> > an event with the timestamp prepared from the rawmidi side).
>
> I believe the new framing mode would be useful both for readers of rawmidi
> devices, and the seq kernel module.
>
> I have also been thinking of doing something in usb-midi (because I assume
> that's the most common way to do midi input these days), to improve
> performance for packets with more than three bytes in them. Right now a
> sysex would be cut off in chunks of three bytes, each one with its own
> timestamp. If so, that would be a later patch.
I've been investigated with some old documentations since David posted his
initial idea[1]. However, I always have concern that we can really find
timestamp for incoming data for MIDI message in hardware/software IRQ
contexts.
As you know, in the specification, MIDI message has no timestamp. Even
if MIDI Time Code (MTC) is included in the specification, it's the role
for hardware MIDI sequencer to decide actual presentation time for
received MIDI messages. In this meaning, your patch is reasonable to
process the received MIDI messages.
However, the timing jitter of IRQ handler invocation is issued in this
case, as well as PCM interface, even if the data rate of MIDI physical
layer is quite low nowadays (31.25 Kbit / sec ~= 3906.25 byte / sec).
As long as I experienced, in actual running Linux system, the invocation
of IRQ handler has no guarantee for timing jitter, mainly due to CPU level
IRQ mask (like spin_lock). Therefore the interval of each invocation is not
so precise to decide event timestamp, at least for time slot comes from
MIDI physical layer.
Nevertheless, I think your idea is enough interesting, with conditions to
deliver information from driver (or driver developer) to applications
(ALSA Sequencer or userspace applications). Even if we have some
limitation and restriction to precise timestamp, it's worth to work for
it. It seems to be required that improvements at interface level and
documentation about how to use the frame timestamp you implemented.
P.S. As long as referring old resources relevant to the design of
hardware MIDI sequencer in late 1990's, the above concern seems to be real
to engineers. They are always requested to process MIDI message in real
time somehow beyond buffering and timing jitter.
[1] Midi timestamps
https://mailman.alsa-project.org/pipermail/alsa-devel/2021-March/182175.html
Regards
Takashi Sakamoto
next prev parent reply other threads:[~2021-03-24 13:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 5:42 [PATCH v2] sound: rawmidi: Add framing mode David Henningsson
2021-03-24 10:03 ` Takashi Iwai
2021-03-24 11:18 ` David Henningsson
2021-03-24 13:29 ` Takashi Sakamoto [this message]
2021-03-24 12:44 ` Takashi Sakamoto
2021-03-24 15:57 ` David Henningsson
2021-03-26 4:46 ` Takashi Sakamoto
2021-03-26 7:55 ` Takashi Iwai
2021-03-26 16:29 ` David Henningsson
2021-03-26 16:44 ` Takashi Iwai
2021-03-27 1:51 ` Takashi Sakamoto
2021-03-28 6:39 ` David Henningsson
2021-03-28 7:40 ` Takashi Iwai
2021-03-30 19:35 ` David Henningsson
2021-03-31 7:40 ` Takashi Iwai
2021-04-05 12:13 ` David Henningsson
2021-04-06 12:01 ` Takashi Iwai
2021-04-10 11:41 ` David Henningsson
2021-04-12 16:03 ` Takashi Iwai
2021-03-27 3:44 ` Takashi Sakamoto
2021-03-27 3:10 ` Takashi Sakamoto
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=20210324132944.GB3711@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=coding@diwic.se \
--cc=tiwai@suse.de \
/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.