Skip to contentSkip to conversation

Which API for MIDI?

DISCUSSION Denis de Leeuw Duarte 5 participants 8 messages Dec 10, 2003 – Dec 11, 2003

lore
Share & tools
lore
#0 lore raw

Hello folks,

I'm starting work on a new midi sequencing app, but I'm a bit confused by the different API options ALSA offers. I've been reading whatever snippets I can find on the web, mostly mailing list archives, and if I understand correctly my options are basically the rawmidi API and the alsa sequencer API. With the former I must handle all timing myself in user space and with the latter this is all done by ALSA, is that a correct description or am I mistaken?

My question is: if my first priority is to have stable, reliable timing and performance, which API should I choose, taking the current state of the alsa sequencer code into consideration?

Many thanks in advance to anyone who can shed some light on this.

Regards,

Denis

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#1 lore raw
Quoted 6 lines · Denis de Leeuw Duarte

I'm starting work on a new midi sequencing app, but I'm a bit confused by the different API options ALSA offers. I've been reading whatever snippets I can find on the web, mostly mailing list archives, and if I understand correctly my options are basically the rawmidi API and the alsa sequencer API. With the former I must handle all timing myself in user space and with the latter this is all done by ALSA, is that a correct description?

Yes. And the sequencer can connect/route between ports, and supports ports handled by userspace apps. The user of your sequencer won't be happy if it's restricted to rawmidi ports.

Quoted 3 lines

My question is: if my first priority is to have stable, reliable timing and performance, which API should I choose, taking the current state of the alsa sequencer code into consideration?

The current state of the sequencer _code_ is just fine. It's the documentation you'll have problems with (but the rawmidi docs aren't better).

HTH
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#2 lore raw
Quoted 11 lines · Clemens Ladisch
Quoted 6 lines · Denis de Leeuw Duarte

I'm starting work on a new midi sequencing app, but I'm a bit confused by the different API options ALSA offers. I've been reading whatever snippets I can find on the web, mostly mailing list archives, and if I understand correctly my options are basically the rawmidi API and the alsa sequencer API. With the former I must handle all timing myself in user space and with the latter this is all done by ALSA, is that a correct description?

Yes. And the sequencer can connect/route between ports, and supports ports handled by userspace apps. The user of your sequencer won't be happy if it's restricted to rawmidi ports.

more things to consider:

* what kind(s) of sync-to-external will you need?
* do you want to receive/send MIDI sysex data?

last time i checked, the latter was impossible to do via the sequencer API (please correct if things have changed). afaik, the former isn't always easy to do with the sequencer either.

i've ended up supporting both raw and sequencer access to MIDI ports, dropping the sequencer timing and queue mechanisms in order to gain flexibility in sync and tempo matters. of course that requires realtime threading for MIDI i/o to achieve stable timing.

Quoted 7 lines
Quoted 3 lines

My question is: if my first priority is to have stable, reliable timing and performance, which API should I choose, taking the current state of the alsa sequencer code into consideration?

The current state of the sequencer _code_ is just fine. It's the documentation you'll have problems with (but the rawmidi docs aren't better).

i found the sequencer API to be well-documented. it's somewhat lacking in code examples, but there are quite a few applications out there that use it (pmidi for a start maybe, and then we have rosegarden, muse etc).

tim

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#3 lore raw
Quoted 3 lines · Tim Goetze

i found the sequencer API to be well-documented.

Internally right?

Quoted 5 lines

it's somewhat lacking
in code examples, but there are quite a few applications out there that use it (pmidi for a start maybe, and then we have rosegarden, muse etc).

I just spotted this older doc

http://www.alsa-project.org/~frank/alsa-sequencer/

Never seen or heard of it before.

Unsurprisingly it is quite comprehensive. How much has the api changed in the past 4 years? If someone who is well versed in the current implementation wants to vett this doc and provide an update I'll happily add it to the site docs.

You'll get your name in the big bright lights and everyone will associate you with Guru status.

This has to be one of the last core programming docs needed.

Signature · 22 lines
Patrick Shirkey - Boost Hardware Ltd.
Http://www.boosthardware.com
Http://www.djcj.org - The Linux Audio Users guide
========================================


 Apparently upon the beginning of the barrage, the donkey broke 
discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops.

United Press International
Rockets on donkeys hit major Baghdad sites

By P. MITCHELL PROTHERO
Published 11/21/2003 11:13 AM



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
#4 lore raw
In reply to Tim Goetze
Quoted 5 lines · Tim Goetze

* what kind(s) of sync-to-external will you need?
* do you want to receive/send MIDI sysex data?

last time i checked, the latter was impossible to do via the sequencer API (please correct if things have changed).

Sending/receiving sysex has always been possible AFAIK. It's certainly possible now.

Regards,
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#5 lore raw
Quoted 9 lines
Quoted 5 lines · Tim Goetze

* what kind(s) of sync-to-external will you need?
* do you want to receive/send MIDI sysex data?

last time i checked, the latter was impossible to do via the sequencer API (please correct if things have changed).

Sending/receiving sysex has always been possible AFAIK. It's certainly possible now.

its bounded by size limits that have to (re)set in advance. when i tried to download new firmware (1MB+) via SYSEX to an Alesis ADAT, it was very difficult to discover this limitation.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#6 lore raw
Quoted 6 lines · Paul Davis
Quoted 2 lines

Sending/receiving sysex has always been possible AFAIK. It's certainly possible now.

its bounded by size limits that have to (re)set in advance. when i tried to download new firmware (1MB+) via SYSEX to an Alesis ADAT, it was very difficult to discover this limitation.

Yes; it's a problem that ALSA wants to handle each sysex as one large chunk.

This problem occurs in another situation, too: in Standard MIDI files, a sysex command can be split into multiple parts to be sent at specific times, but it's impossible to do this with the ALSA sequencer. (Well, it's possible, but the documentation says that each SYSEX event must contain a complete sysex command.)

I think the sequencer should be changed to allow splitting of sysex commands.

Regards,
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#7 lore raw
In reply to Clemens Ladisch
Quoted 9 lines · Clemens Ladisch
Quoted 5 lines · Tim Goetze

* what kind(s) of sync-to-external will you need?
* do you want to receive/send MIDI sysex data?

last time i checked, the latter was impossible to do via the sequencer API (please correct if things have changed).

Sending/receiving sysex has always been possible AFAIK. It's certainly possible now.

indeed, it works both ways in 1.0.0rc. thanks.

tim

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/