Linux Sound subsystem development
 help / color / mirror / Atom feed
* Re: [linux-audio-dev] External MIDI Sync using OSS/Free
@ 1999-10-26 17:11 Paul Barton-Davis
  1999-10-26 18:49 ` Billy Biggs
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paul Barton-Davis @ 1999-10-26 17:11 UTC (permalink / raw)
  To: linux-sound

>  My sequencer (http://www.div8.net/ttrk) mainly runs off of external MIDI
>sync, and drives a mess of synths and stuff.  I use /dev/sequencer for
>MIDI input and output.

advice #1: do not use /dev/sequencer

two reasons. it doesn't exist in ALSA, which will (soon-ish) be the
default sound driver system for Linux. but more importantly, its a
horrible system. i won't list the problems with it here, but there are
many. 

instead, just let the user specify the MIDI device files to use, and
then use them as "raw" read(2)/write(2) files. this works with OSS,
ALSA, Solaris and a number of other systems. then do most of your
timing stuff at user level. i don't know what your resolution needs to
be, but my "analog MIDI sequencer" program SoftWerk does all its
timing in user space (it has too - it doesn't know what to send to the
MIDI interface until its actually time to send it) and is accurate
down to about 20ms without any special priviledges. it can get a lot
more accurate than that if it needs to. OTOH, SoftWerk is an "old
school" sequencer, from back before the days of the first digital
sequencers. it has a fixed number of event steps per fixed number of
event steps, which is not what most people these days mean by "sequencer".

advice #2: if you really have external MIDI sync (do you mean MIDI clock,
or other stuff ?), then just use that to provide timing for your
application. if you have sensible hardware for your MIDI interface,
then your application will be woken up very rapidly (at least if it
runs SCHED_FIFO) after the MIDI clock byte (or any other MIDI message)
is ready to read.

if you don't have external clock, then you'd be better off using the
real time clock for timing. 

advice 3: install ALSA, and use the ALSA sequencer. its a vastly more
evolved kernel sequencer system, though its still going through some
beta-testing. we would welcome your involvement in that process.

>  Is there a way that I could do this more efficiently?  Since my app
>might not get swapped in until late after the start arrived, and then I
>have to call the ioctl.  This error then remains for the entire duration
>of the song.

use SCHED_FIFO if you can. the only downside is that it does require
that either your program, or a "helper/starter" program run setuid
root. this will reduce to the delay between your program being "ready
to run because MIDI data is available" and "running" to a virtually
insignificant time.

--p

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-10-26 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-10-26 17:11 [linux-audio-dev] External MIDI Sync using OSS/Free Paul Barton-Davis
1999-10-26 18:49 ` Billy Biggs
1999-10-26 19:59 ` Paul Barton-Davis
1999-10-26 21:10 ` Jaroslav Kysela
1999-10-26 21:18 ` Jaroslav Kysela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox