jack midi i/o client

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

jack midi i/o client

deviant
hello, it's me again.

here is the first version of a hardware i/o client. it uses alsa rawmidi
ports to do this. "but how do i interface jack midi with my alsa
sequencer program? i NEED jack_midisine for my music, man!" i hear you
ask... well, you could use alsa's virtual midi ports (not hard to set
up) ... or you could wait a few days until i have finished the not quite
finished yet version of the i/o client that can use both raw midi ports
and sequencer ports at the same time.

the client can be compiled as a normal jack client, or as an in-process
client by passing -DUSE_INTERNAL_CLIENT and whatever the flag to create
a shared lib is to gcc when compiling. warning: it will compile ok, but
i haven't tested the internal client version at all. i haven't written a
makefile, so you have to compile it like this: gcc -o jackmidiio
-lasound -ljack jackmidiio.c.

to use this thing, start it up after starting jack. it will open the
rawmidi port hw:0,0,0 for read and write by default. if you don't want
it to do that, set the environment variables JACK_MIDI_IN_DEVICES and
JACK_MIDI_OUT_DEVICES to something else. because : is commonly used as a
separator for fields in environment variables, hw:0,0,0 becomes
hw_0,0,0. note that you have complete control over which devices you do
or do not allow jackmidiio to use. you can open as many devices (they
can even be on different physical devices) as you wish. to open no
devices, simply set the environment variable to "".

caveats:
- there is currently a minimum buffer size the client needs in order to
work. if i remember correctly, on 32 bit platforms it is 8 samples, and
on 64 bit platforms it is 16.
- large sysex blocks are ignored on the input, and can't even be written
to the output.

things i am considering adding to this:
- have the input and output threads attempt to get elevated privileges
- maybe allocate a block of shared memory to use for large sysex events.
that is however a very big maybe, given that this is a realtime system,
and large sysex events most definitely are not realtime friendly.

i think that is about it for now. no doubt i have forgotten to explain
something, so bring on the questions! comments, suggestions and bug
reports would be much appreciated.

ian


jackmidiio_noalsaseq.c (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: jack midi i/o client

Sean Bolton
On May 30, 2005, at 7:28 PM, ian esten wrote:
> here is the first version of a hardware i/o client.

Hmm, can't get this one to work.  It runs all right, but the MIDI
that comes out of JACK is garbled -- often for note-ons, the key
value ends up being where the velocity should be.

I was anxious to have something to drive JACK MIDI with, so
I threw together this:

   http://home.jps.net/~musound/alsaseq2jackmidi.c

It just creates an ALSA sequencer client with input port, a JACK MIDI
client with output port, and copies data from the former to the latter.
  It
doesn't properly exercise the jack_default_midi_event_t.time capability;
it just sets the field to zero.  But I do get good MIDI back out of
JACK with
this.

It was pretty easy to add JACK MIDI capability to ghostess. (ghostess is
a simple GTK+ host for DSSI/LASPA plugins which badly needs a
from-the-ground-up rewrite ;-)  The JACK-MIDI-fied version is here:

   http://home.jps.net/~musound/ghostess-20050531-jackmidi.tar.gz

Currently, the configure script just checks for the existence of
jack_midi_port_get_info() in libjack.so, and if it find it, ghostess
will
be built with JACK MIDI support, omitting the ALSA or CoreMIDI driver.

I didn't get a thing done today that I was _supposed_ to do, but hey,
this is cool!

-Sean



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel
Reply | Threaded
Open this post in threaded view
|

Re: jack midi i/o client

deviant
curses, now i will have to stop telling people i am perfect! only
joking. anyway, i will look into this, and sort out the problem as soon
as i can.
also, the almost finished next version of jackmidiio will be able to use
alsa seq ports and rawmidi ports at the same time. but more on this once
i have tested it and sent it out.
anyway, thanks very much for the feedback and for jumping on this so
quickly :)
ian


On Tue, 2005-05-31 at 17:13 -0700, Sean Bolton wrote:

> On May 30, 2005, at 7:28 PM, ian esten wrote:
> > here is the first version of a hardware i/o client.
>
> Hmm, can't get this one to work.  It runs all right, but the MIDI
> that comes out of JACK is garbled -- often for note-ons, the key
> value ends up being where the velocity should be.
>
> I was anxious to have something to drive JACK MIDI with, so
> I threw together this:
>
>    http://home.jps.net/~musound/alsaseq2jackmidi.c
>
> It just creates an ALSA sequencer client with input port, a JACK MIDI
> client with output port, and copies data from the former to the latter.
>   It
> doesn't properly exercise the jack_default_midi_event_t.time capability;
> it just sets the field to zero.  But I do get good MIDI back out of
> JACK with
> this.
>
> It was pretty easy to add JACK MIDI capability to ghostess. (ghostess is
> a simple GTK+ host for DSSI/LASPA plugins which badly needs a
> from-the-ground-up rewrite ;-)  The JACK-MIDI-fied version is here:
>
>    http://home.jps.net/~musound/ghostess-20050531-jackmidi.tar.gz
>
> Currently, the configure script just checks for the existence of
> jack_midi_port_get_info() in libjack.so, and if it find it, ghostess
> will
> be built with JACK MIDI support, omitting the ALSA or CoreMIDI driver.
>
> I didn't get a thing done today that I was _supposed_ to do, but hey,
> this is cool!
>
> -Sean
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Jackit-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jackit-devel
>



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Jackit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jackit-devel