Ben Saylor hat gesagt: // Ben Saylor wrote:

> I would like to use a MIDI sequencer to control a MIDI-controlled app
> (pd).  I tried physically connecting the MIDI input and output of my
> SB16PCI externally, but pd and ttrk (sequencer) were unable to open
> /dev/midi at the same time (they both seem to use OSS midi).
> 
> Is there a way to do this?  Maybe some kind of virtual MIDI device that
> could work like a fifo?  Or can ALSA raw MIDI devices be opened by
> multiple programs?
Hey, you found ttrk? Nice app. Here's how I control pd from ttrk:

First you have to configure a virtual midi card within your alsa modules
configuration. Add this:

alias sound-service-1-1 snd-seq-oss
alias sound-service-1-8 snd-seq-oss
alias sound-slot-1 snd-card-1
alias snd-card-1 snd-card-virmidi

This configures a virtual midi card as the second card with index 1,
assuming you have one real soundcard, which would be very useful ;)

Now you have to find out the port numbers for your virtual midi card with 
aconnect(1):

$ aconnect -li
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
        Connecting To: 63:0
client 72: 'Virtual Raw MIDI 1-0' [type=kernel]
    0 'VirMIDI 1-0     '
client 73: 'Virtual Raw MIDI 1-1' [type=kernel]
    0 'VirMIDI 1-1     '
client 74: 'Virtual Raw MIDI 1-2' [type=kernel]
    0 'VirMIDI 1-2     '
client 75: 'Virtual Raw MIDI 1-3' [type=kernel]
    0 'VirMIDI 1-3     '

$ aconnect -lo
client 72: 'Virtual Raw MIDI 1-0' [type=kernel]
    0 'VirMIDI 1-0     '
client 73: 'Virtual Raw MIDI 1-1' [type=kernel]
    0 'VirMIDI 1-1     '
client 74: 'Virtual Raw MIDI 1-2' [type=kernel]
    0 'VirMIDI 1-2     '
client 75: 'Virtual Raw MIDI 1-3' [type=kernel]
    0 'VirMIDI 1-3     '

To use ttrk with PD they have to communicate via a 'a'connected pair 
of ports, so you have to connect two ports with:

$ aconnect 72:0 73:0

This gives the following setup:

$ aconnect -lo
client 72: 'Virtual Raw MIDI 1-0' [type=kernel]
    0 'VirMIDI 1-0     '
        Connecting To: 73:0
client 73: 'Virtual Raw MIDI 1-1' [type=kernel]
    0 'VirMIDI 1-1     '
        Connected From: 72:0
client 74: 'Virtual Raw MIDI 1-2' [type=kernel]
    0 'VirMIDI 1-2     '
client 75: 'Virtual Raw MIDI 1-3' [type=kernel]
    0 'VirMIDI 1-3 

and this means, that /dev/snd/midiC1D0 catches midi messages and sends them
to the connected /dev/snd/midiC1D1. 
You get these numbers from the "VirMIDI 1-0" and "VirMIDI 1-1" messages)

The only thing left is configuring the apps to use this connection. With ttrk
this is easy: Just tell it the midi device in ~/.ttrkrc like this:
mididev = /dev/snd/midiC1D0

PD only uses /dev/midi?? devices. To have it use for example /dev/midi11 you 
have to start pd witch "pd -midiindev 12". This number must be the midi device
number plus one! 

Depending on your setup you should experiment a bit. Let ttrk run, start pd
with different midiindev's and open the "Help->Test audio and Midi" patch
to see, if the ttrk messages reach PD. 

Here I use /dev/midi11 with PD and /dev/midi11 is a link I made to /dev/snd/midiC1D1:

$ ls -l /dev/midi11
lrwxrwxrwx    1 root     root           17 Sep 10 20:11 /dev/midi11 -> 
/dev/snd/midiC1D1

That way it works.
-- 
                                                 __    __
 Frank Barknecht       ____ ______   ____ __ trip\ \  / /wire ______
                      / __// __  /__/ __// // __  \ \/ /  __ \\  ___\   
                     / /  / ____/  / /  / // ____// /\ \\  ___\\____ \  
                    /_/  /_____/  /_/  /_//_____// /  \ \\_____\\_____\
                                                /_/    \_\ 

_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to