[chuck-users] sending midi program change
pack-chucklist at rattus.net
Fri Jan 5 08:18:34 EST 2007
On Fri, Jan 05, 2007 at 01:13:24PM +0100, Kassen wrote:
> Bruce Murphy;
> Definately! I should have searched, I hadn't realised we can use hex either.
> Oh well, we'll call it a learning experience :-)
I generally use it out of habit and then very occasionally get surprised
when it doesn't work. Fortunately, practically all languages thes days
are written by people with C backgrounds, so this is included by
default. Octal parsing is more intermittent :)
> I see you had/have the same question I had;
> "// not sure what dance is required to make this only send two bytes."
> One of the things that occured to me is that we could pad the message with
> some of those undefined system-realtime ones. Those are a single byte and
> will be ignored at the receiving end. That doesn't stop us from wasting
> bandwith but at least it will make us conform to the spec and prevent the
> receiving end from trying to extract meaning from the third byte.
I can't remember what I found when I looked through the ChucK MIDI
source code, but I'm sure I did. I'm not near the laptop with my
development ChucK build on it right now, but when I am next I'll check
to make sure it isn't something obvious.
Ah yes, so the underlying functions send an arbitrary length vector, but
the polymorphic functions actually exposed to ChucK take the midi
message and stuff all three bytes directly into the message without
checking. This is where it would be nice to have something that knew
what message was what.
Sysex should be whatever is passed in, I guess. The nice thing about
doing something like this is that it would give you the capabilities we
want without requiring any existing ChucK code to be modified.
My favoured solution  would be to have the midi message sending
function know exactly how long the different types of messages should be
and automatically send just that number of bytes from the message thing,
unless overridden by a specific parameter.
More interestingly, perhaps, the midi functions have polymorphic
versions which take a number of bytes (1,2 or 3) and just send those. That
would provide an immediate solution to make my own midi library work
So, what do people think about that change to MidiOut::send() in
midiio_rtmidi.c ? Unless I hear some loud screaming, I'll write and
submit the patch tonight.
Speaking of which, where is my stom patch?
Packrat (Wombat Implementor;COSO;Badgerphonic;Biokino Artist)
Nihil illegitemi carbovndvm
More information about the chuck-users