[linux-audio-dev] MIDI reset?

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

Subject: [linux-audio-dev] MIDI reset?
From: Paul Winkler (slinkp_AT_ulster.net)
Date: pe marras 12 1999 - 11:46:49 EST


Hi,

I'm monkeying around with little python scripts that write to
/dev/midi
(I have a soundcard with a wavetable synth, and it's possible to
play it this way). (In fact, I have sometimes had some perverse fun
by doing cat "foo" > /dev/midi, where "foo" is anything -- a binary,
a soundfile, picture, core, etc...)

Trouble is, since I don't really know what I'm doing :), I
frequently get the soundcard "stuck"-- it won't respond to any more
midi commands, and
I can't even unload the driver (OSS-Linux 3.9.h-something-- running
"soundoff" just gives a bunch of "device or resource in use"
messages; likewise for trying to do rmmod by hand). This seems to
happen with a large number of note-ons without specific note-offs,
e.g. when doing fast percussion stuff.

I've tried writing a "reset" (first byte is 0xFF) to the soundcard,
but that doesn't seem to help. I'm not sure if anything is getting
through. The only solution at the moment is to reboot-- yuck.

Any ideas, anyone? I haven't used ALSA in a while -- is the midi
interface useable yet? Would ALSA have the same problem, or is it
more likely hardware?

BTW, here's an example of what I've been doing today-- trivial and
goofy, but fun:

import time
import whrandom
import struct

def drumbug(tempo, dur):
    s = 60.0 / tempo
    hits = dur / s
    possibles = range(0, 128)
    while hits > 0:
        note = whrandom.choice(possibles)
        vel = whrandom.choice(range(80, 128))
        ## print note, vel
        # I got using struct.pack this way from eric s. t.
        sys.stdout.write(struct.pack('BBB', 0x99, note, vel))
        sys.stdout.flush()
        time.sleep(s)
        hits = hits - 1

# end

-- PW

---------------- paul winkler ------------------
slinkP arts: music, sound, illustration, design, etc.
A member of ARMS:
www.reacharms.com - www.mp3.com/arms - www.amp3.com/arms
personal page: www.ulster.net/~abigoo


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

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:25 EST