[linux-audio-user] HOWTO use Miditrackers with Softsynths [was: midi loopback or somesuch]

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-user] HOWTO use Miditrackers with Softsynths [was: midi loopback or somesuch]
From: Frank Barknecht (barknech_AT_ph-cip.uni-koeln.de)
Date: Sun Feb 17 2002 - 14:48:18 EET


jordan muscott hat gesagt: // jordan muscott wrote:

> Just wondering, anyone got any suggestions for piping the midi output
> from a sequencer like ttrk ( or shaketracker if i could actually get it
> to build) to the input of SpiralSynth?

I don't know SpiralSynth, but supposed it can read from raw midi devices
like /dev/midiXX, here's my Miditracker-to-PD HOWTO for configuring
this under ALSA 0.9, which is in part a post to alsa-user from some time
ago using PD as softsynth, updated to Shaketracker's specific needs,
here we go:

>#>#> PART 1: virtual midi card with ttrk and PD <#<#<

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 an '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

>#>#> PART 2: Shaketracker and the ALSA sequencer interface <#<#<

Achieving above results with Shaketracker is a bit tricky. Shaketracker
uses the OSS sequencer interface, that's emulated by ALSA only partly. I
could not get the aconnect-trick to work, but I found another solution.
For that you need Takashi Iwai's aseqview, which is included in many
distributions or available at http//members.tripod.de/iwai/alsa.html

We'll need a feature, described by Takashi as:

  "Another feature of ASeqView is redirection of events. ASeqView
  can output the received events to subscription ports with some
  modification like channel mute or pitch change. Since this works as
  a real-time filter client, such modifications can be applied also in
  real-time without complexity."

We don't need the data changes, but the redirection. How to use
this? First you need to configure a virtual midi card as above.
Find a suitable midi device with aconnect. Say you want to use
/dev/snd/midiC1D1 (or /dev/midi11) as above for the softsynth. Then you
first need to start aseqview in a mode, that redirects incoming midi
events to /dev/snd/midiC1D1 i.e. ALSA client 73:0 in the example above:

$ aseqview -d 73:0 &

Then you can start Shaketracker and select "Viewer Port 0" in the User
Devices Section. That one is the port created by asqeview. "aconnect -li"
shows it as:

client 128: 'MIDI Viewer' [type=user]
    0 'Viewer Port 0 '
        Connecting To: 73:0

Aseqview will now magically route all events it receives to port 73:0,
which is /dev/snd/midiC1D1 in our setup and which can be used in PD
or SSM, if it has this option. With aseqview usage of aconnect is not
necessary anymore, because asequview creates the necessary connections
internally by itself. It might be useful to write a little shellscript
that starts aseqview everytime before you start shaketracker, like this:

#!/bin/sh
# Script: shaketracker-start
aseqview -d 73:0 &
# sleep 2 seconds to let aseqview create ports:
sleep 2
shaketracker

Hope this helps and bye,

-- 
                                                 __    __
 Frank Barknecht       ____ ______   ____ __ trip\ \  / /wire ______
                      / __// __  /__/ __// // __  \ \/ /  __ \\  ___\	
                     / /  / ____/  / /  / // ____// /\ \\  ___\\____ \	
                    /_/  /_____/  /_/  /_//_____// /  \ \\_____\\_____\
                                                /_/    \_\ 


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sun Feb 17 2002 - 15:17:41 EET