Re: ALSA midi SBLive - sfxload?
Roy Pluschke said:
> On February 9, 2004 04:42 pm, Rick Macdonald wrote:
>> timidity is installed and works but I need true midi now.
>
> I don't understand the above statement. Timidity is/has true midi. To run
> timidity as a alsa synth start up timidity like this:
>
> timidity -Os -iA -B2,8 &
> Its best to have timidity suid root so that it can use the real time
> scheduler/clock or whatever it is called.
Yes, this works fine! So far I just tried "pmidi -p 128:0".
Now what I really need to do is get the test program working (code is
below), so I need to know an actual device name, but I can't get it
working.
I straced pmidi:
rickm@timshel:~/SRC$ strace -f pmidi -p 128:0 ~/Rainbow4.mid 2>&1 | grep
/dev
open("/dev/snd/seq", O_RDWR) = 3
and it seems that it uses /dev/snd/seq, but playmidi doesn't like this:
rickm@timshel:~/SRC$ playmidi -D /dev/snd/seq ~/Rainbow4.mid
Playmidi 2.4 Copyright (C) 1994-1997 Nathan I. Laredo, AWE32 by Takashi Iwai
playmidi: No playback device found.
However, telling playmidi to use "external midi" does work:
rickm@timshel:~/SRC$ strace -f playmidi -e ~/Rainbow4.mid 2>&1 |grep seq
open("/dev/sequencer", O_WRONLY) = 3
Requested buffer size 2048, fragment size 1024
ALSA pcm 'default' set buffer size 2048, period size 1024 bytes
But putting "-D /dev/sequencer" on the playmidi command line does _not_ work.
I've tried all these device names in the code below and none work. Any
idea how to get the test program to work? (I tried adding a sleep(3)
before the close in case it was cutting off the note, but it didn't help).
rickm@timshel:~/SRC$ playmidi --help
Playmidi 2.4 Copyright (C) 1994-1997 Nathan I. Laredo, AWE32 by Takashi Iwai
This is free software with ABSOLUTELY NO WARRANTY.
For details please see the file COPYING.
usage: playmidi [-options] file1 [file2 ...]
-v verbosity (additive)
-i x ignore channels set in bitmask x (hex)
-c x play only channels set in bitmask x (hex)
-x x exclude channel x from playable bitmask
-p [c,]x play program x on channel c (all if no c)
-V [c,]x play channel c with volume x (all if no c)
-t x skew tempo by x (float)
-d don't play any percussion
-P x play percussion on channel x
-e output to external midi
-D x output to midi device x
-f output to fm (sb patches)
-4 output to 4-op fm (opl/3 patches)
-a output to awe32 wave synth
-h x skip to header x in large archive
-g output to gravis ultrasound
-E x play channels in bitmask x external
-F x play channels in bitmask x on fm
-G x play channels in bitmask x on gus
-A x play channels in bitmask x on awe32
-z ignore channel of all events
-8 force 8-bit samples on GUS
-M enable MT-32 to GM translation mode
-I show list of all GM programs (see -p)
-R x set initial reverb to x (0-127)
-C x set initial chorus to x (0-127)
-r real-time playback graphics
I couldn't seem to get "amidi" to work either:
rickm@timshel:~$ amidi -p hw:128,0 -S "90 40 ef"
cannot open port "hw:128,0": No such device
rickm@timshel:~/SRC$ pmidi -l
Port Client name Port name
64:0 Rawmidi 0 - EMU10K1 MPU-401 (U EMU10K1 MPU-401 (UART)
65:0 Emu10k1 WaveTable Emu10k1 Port 0
65:1 Emu10k1 WaveTable Emu10k1 Port 1
65:2 Emu10k1 WaveTable Emu10k1 Port 2
65:3 Emu10k1 WaveTable Emu10k1 Port 3
128:0 Client-128 TiMidity port 0
128:1 Client-128 TiMidity port 1
rickm@timshel:~/SRC$ amidi -l
Device Name
hw:0,0 EMU10K1 MPU-401 (UART)
hw:0,1 Emu10k1 Synth MIDI (16 subdevices)
hw:0,2 Emu10k1 Synth MIDI (16 subdevices)
My midi test program:
//
// Programmer: Craig Stuart Sapp [craig@ccrma.stanford.edu]
// Creation Date: Mon Dec 21 18:00:42 PST 1998
// Last Modified: Mon Dec 21 18:00:42 PST 1998
// Filename: ...linuxmidi/output/method1.c
// Syntax: C
// $Smake: gcc -O -o devmidiout devmidiout.c && strip devmidiout
//
#include <linux/soundcard.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main(void) {
// char* device = "/dev/midi" ;
char* device = "/dev/sequencer" ;
unsigned char data[3] = {0x90, 60, 127};
// step 1: open the OSS device for writing
int fd = open(device, O_WRONLY, 0);
if (fd < 0) {
printf("Error: cannot open %s\n", device);
exit(1);
}
// step 2: write the MIDI information to the OSS device
write(fd, data, sizeof(data));
// step 3: (optional) close the OSS device
close(fd);
return 0;
}
...RickM...
Reply to: