using external MIDI device to control the computer
Hi,
I would like to use a digital piano keyboard
attached to the serial port (MIDI-to-host 38400 bps MIDI connection) to generate some events on the computer.
E.g. if I press the two lowest notes at the same
time, I can move the mouse cursor or switch desktops, etc. I imagine I would have to have a kernel module which would implement filtering of certain events and passing them to some place, like a pipe that my control
program (perhaps perl) would read and perform corresponding actions that I would program it to do.
Is there currently a way to "insert a MIDI filter"
into the MIDI stream received from the digital piano ? Or at least to say "copy all MIDI events into this socket / pipe for pickup by an application" (and that application would then recognize these special "control" events and would generate the system commands
/ events) ?
How can I use the piano to control the computer ?
(while I am recording, or some third app is consuming the MIDI stream on its own, and I have no control over that app)
If there currently isn't a way to filter or duplicate
the incoming MIDI stream, what would be necessary ?
thanks - john
______________________________________________________________________
File your taxes online! http://taxes.yahoo.ca
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 4 lines
etc. I imagine I would have to have a kernel module which would implement filtering of certain events and passing them to some place, like a pipe that my control program (perhaps perl) would read and perform corresponding actions that I would program it to do.
not to appear too snobbish, but this is linux, and we don't do stuff like that in the kernel.
at this time, there isn't any equivalent of OMS-like filtering for the ALSA sequencer, but its pretty simple to write a sequencer client that collects all the data and represents some or all of it at its own sequencer port(s). you would then connect other applications to the filter's ports, and see a filtered version of the MIDI stream.
Quoted 4 lines
How can I use the piano to control the computer ? (while I am recording, or some third app is consuming the MIDI stream on its own, and I have no control over that app)
the sequencer can multiplex MIDI data to multiple clients. several clients can connect to the same sequencer port, and they will all see the data. i don't know that this scales to very large multiplexing systems, but it will certainly work fine for a few clients.
--p
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 1 line · --- Paul Davis
Quoted 1 line
etc. I imagine I would have to have a kernel
module which would
Quoted 1 line
Quoted 1 line
implement filtering of certain events and passing
them to some place,
Quoted 1 line
Quoted 1 line
like a pipe that my control program (perhaps perl)
would read and
Quoted 5 lines
Quoted 1 line
perform corresponding actions that I would program
it to do.
not to appear too snobbish, but this is linux, and we don't do stuff like that in the kernel.
:-)
Quoted 1 line
at this time, there isn't any equivalent of OMS-like
filtering for the
Quoted 2 lines
ALSA sequencer, but its pretty simple to write a sequencer client that collects all the data and
represents some or all of
Quoted 1 line
it at its own sequencer port(s). you would then
connect other
Quoted 1 line
applications to the filter's ports, and see a
filtered version of the
Quoted 1 line
MIDI stream.
a sequencer client ? as a userspace program ? How
could it then get the (filtered) data back for the MIDI app into /dev/midi ? I didn't think there was a way for a userspace program to feed "incoming" data into /dev/midi, and therefore I thought that it would have to be a kernel module, not a userspace pgm.
Quoted 4 lines
Quoted 2 lines
How can I use the piano to control the computer ?
(while I am recording, or some third app isconsuming
Quoted 1 line
the MIDI stream on its own, and I have no control
Quoted 8 lines
over
Quoted 1 line
that app)
the sequencer can multiplex MIDI data to multiple clients. several
clients can connect to the same sequencer port, and they will all see
the data.
I just tried a multiple (two) concurrent "cat/dev/midi" and the first one succeeded, and the other failed : "cat: /dev/midi: Device or resource busy". How can "several clients connect to the same sequencer port " so they all see the data ?
Quoted 1 line
--p
thx - john
PS: sorry for these broken up lines, yahoo gives me pretty narrow box to work with. :-(
______________________________________________________________________
File your taxes online! http://taxes.yahoo.ca
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 6 lines
a sequencer client ? as a userspace program ? How could it then get the (filtered) data back for the MIDI app into
/dev/midi? I didn't think there was a way for a userspace program to feed "incoming" data into/dev/midi, and therefore I thought that it would have to be a kernel module, not a userspace pgm.
the sequencer API isn't structured around /dev/midi, its structured around sequencer ports. clients have their own ports which they connect to other ports. all the raw midi devices automatically become clients with ports (which correspond to the h/w they control) when the sequencer module is loaded, so you can always send/receive data to them. a client can be a user space program or a kernel space entity. any number of clients can be connected to a port.
Quoted 2 lines
How can "several clients connect to the same sequencer port " so they all see the data ?
as i said, /dev/midi isn't the sequencer, its the raw MIDI device, and there isn't a way to multiplex access to it except via the sequencer.
--p
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
For PCM, alsa has a method to hook the stream, and insert one's own bit of code thus modifying the PCM audio stream as it passes through alsa-lib to the alsa-driver.
I don't know if this is possible for MIDI data, but I am sure it could be implemented in alsa-lib in quite a need way.
Cheers
James
Quoted 45 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of fn ln
Sent: 20 March 2002 12:01
To: [email protected]
Subject: [Alsa-devel] using external MIDI device to control the computerHi,
I would like to use a digital piano keyboard
attached to the serial port (MIDI-to-host 38400 bps MIDI connection) to generate some events on the computer.E.g. if I press the two lowest notes at the same
time, I can move the mouse cursor or switch desktops, etc. I imagine I would have to have a kernel module which would implement filtering of certain events and passing them to some place, like a pipe that my control
program (perhaps perl) would read and perform corresponding actions that I would program it to do.Is there currently a way to "insert a MIDI filter"
into the MIDI stream received from the digital piano ? Or at least to say "copy all MIDI events into this socket / pipe for pickup by an application" (and that application would then recognize these special "control" events and would generate the system commands
/ events) ?How can I use the piano to control the computer ?
(while I am recording, or some third app is consuming the MIDI stream on its own, and I have no control over that app)If there currently isn't a way to filter or duplicate
the incoming MIDI stream, what would be necessary ?thanks - john
Quoted 7 lines
______________________________________________________________________
File your taxes online! http://taxes.yahoo.ca_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel