|
|
1.1 root 1:
2: Getting (Linux) ALSA midi support to work with Hatari
3: =====================================================
4:
5: If you don't have a real MIDI sequencer, use a software synthetizer.
6: For links to software referenced in this text, see end of the text.
7: Most of the distros should have in their repositories packages at
8: least for some of them though.
9:
10: There are also some notes about midi networking.
11:
12:
13: Making MIDI soft-synthetizer to work with ALSA
14: -----------------------------------------------
15:
16: Make Timidity into an ALSA output device with:
17: timidity -Os -iA
18: (-O: output=alsa, -i: interface=alsa)
19:
20: To make it use less CPU and be more responsive, use:
21: timidity -Os -iA -B2,8 -EFreverb=0 -EFchorus=0
22: (-B: 2,8=set small buffers, -EFx=0: disable effects)
23:
24: Make vkeybd (virtual midi keyboard app) into an ALSA input device with:
25: vkeybd
26:
27: View the resulting (software) ALSA input and output devices:
28: aconnect -i -o
29:
30: Then connect the vkeybd input to timidity output with:
31: kaconnect
32: or if you don't have this UI program, just use 'aconnect' directly:
33: aconnect <sender port> <receiver port>
34:
35: Now you can use the virtual midi keyboard for testing the sound
36: synthesis.
37:
38:
39: Finally You can test how well midi files are played.
40: Check which ALSA port Timidity provides:
41: aplaymidi -l
42:
43: And use that port for playing a midi file:
44: aplaymidi -p <port, e.g. 129:0> test.mid
45: (or use 'pmidi')
46:
47: Note: Remember that you need to re-connect the (virtual) device
48: ports each time you restart them.
49:
50:
51: Using FluidSynth instead of Timidity
52: ------------------------------------
53:
54: Instead of Timidity, you also use other soft-synthetizers,
55: like FluidSynth:
56: fluidsynth --audio-driver=alsa --midi-driver=alsa_seq soundfont.sf2
57:
58: You could play a bit with other options to get more performance,
59: sound volume etc:
60: --reverb=no --chorus=no -o synth.polyphony=16 --gain=0.6
61:
62: And if you don't like the FluidSynth shell, use:
63: --no-shell --server
64:
65: FYI: Current (v1.0.7a) FluidSynth has buffer overruns, but they
66: will be fixed in the next release (hopefully coming soon).
67:
68:
69: Making it all to work with Hatari
70: ---------------------------------
71:
72: Hatari requires midi hardware devices to work, it doesn't support
73: ALSA directly. To get the software synth ALSA devices to appear
74: as HW midi devices, run following as *root*:
75: modprobe snd-virmidi
76:
77: When you you list your ALSA output devices with:
78: aconnect -o
79: You should see in addition to Timidity also 4 virtual hardware
80: devices.
81:
82: Then connect (either with aconnect or kaconnect) the first virtual
83: HW port to the same Timidity port where you connected the virtual
84: midi keyboard.
85:
86: Now check which number your new virtual midi card got from ALSA:
87: cat /proc/asound/cards
88:
89: And give to Hatari the corresponding ALSA midi device. In my case
90: VirMidi was Card 1 and as the port used above was first one, I give
91: Hatari the following midi device:
92: hatari --midi /dev/snd/midiC1D0
93:
94: Note: I also needed --nosound option because Hatari wanted exclusive
95: access to the PCM (sound) device and Timidity was already connected
96: to it. This may not be the case if you've compiled Hatari with another
97: / newer SDL_mixer library versions.
98:
99:
100: Sending the midi data over network
101: ----------------------------------
102:
103: If you direct the data to stdout, you can use e.g. ssh to pipe
104: it over network:
105: hatari --midi /dev/stdout --log /dev/stderr |\
106: ssh [email protected] "cat>/dev/snd/midiC1D0"
107:
108: Note that logging is re-directed to stderr so that it doesn't
109: mess the midi output.
110:
111: Same can be done with socat so that the connections are bi-directional.
112: Once Hatari supports midi input, you can use socat like this to do
113: midi-networking between (emulated) Ataris:
114: @remote.site:
115: socat PIPE:redirect.pipe TCP4-LISTEN:www
116: hatari --midi redirect.pipe --log stderr
117: @local.site:
118: socat PIPE:redirect.pipe TCP4:remote.site:www
119: hatari --midi redirect.pipe --log stderr
120:
121:
122: Links
123: -----
124:
125: Software:
126:
127: Vkeybd:
128: http://alsa.opensrc.org/Vkeybd
129:
130: Patch (ALSA connecting) utilities:
131: http://alsa.opensrc.org/AlsaMidiPatchbays
132:
133: FluidSynth:
134: http://www.iiwu.org/fluidsynth/
135:
136: Soundfonts:
137: http://alsa.opensrc.org/SoundFontHandling
138:
139: List of some soft-synthetizers:
140: http://alsa.opensrc.org/SoftSynths
141:
142: socat:
143: http://www.dest-unreach.org/socat/
144:
145: MidiMaze:
146: http://en.wikipedia.org/wiki/MIDI_Maze
147:
148:
149: Overviews:
150:
151: ALSA midi overview:
152: http://alsa.opensrc.org/AlsaMidiOverview
153:
154: Virtual midi hardware setup:
155: http://www.tldp.org/HOWTO/MIDI-HOWTO-10.html
156:
157: Timidity Howto:
158: http://lau.linuxaudio.org/TiMidity-howto.html
159:
160: Midi with ALSA (old):
161: http://www.linuxfocus.org/English/September2002/article259.shtml
162:
163: Midi on Linux:
164: http://www.linuxjournal.com/article/7773
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.