(posted to both lists because although it is strictly speaking a vm (possible) bug) there may be midi-aware readers not on that list)
I’m hooking up ALSA MIDI on the Pi for Scratch. The basic work was actually done a year ago by Sugiura-san but I missed reading about it due to travel back last summer. It mostly works but the instrument selection is off-by-one and it appears to be due to vm bug that looks to have been around a very long time.
In the image we use 1-128 for the MIDI general instrument list - so Tubular Bells is 15 - and subtract one before passing to the plugin in the time-honoured fashion. Unfortunately the tubular bells sound more like a xylophone. And ‘seashore’ sounds like a telephone.
It turns out that in sqUnixMIDIALSA.inc the code which - so far as I can tell - deals with the instrument index being set actually *adds* 1 to the byte value we pass in! I can’t think of any reason that would sensible but since all I know of ALSA MIDI stuff for unix has been read recently from a bunch of truly awful webpages masquerading as documentation, whaddaino? This code snippet -
case 192: /* program change */
{
int instrument= arg1 + 1;
snd_seq_ev_set_pgmchange(ev, ch, instrument);
}
break;
in Cog/platforms/unix/plugins/MIDIPlugin/sqUnixMIDIALSA.inc seems to have been there as long as the file has existed. Certainly in my ancient dusty archives back in 3.8 days there was no code at all for unix MIDI, so the history on the svn server seems to be correct.
I’ll compile a new vm with the +1 whacked out and see what happens but any solid info would be welcomed.
tim
--
tim Rowledge;
[hidden email];
http://www.rowledge.org/timA paperless office has about as likely as a paperless bathroom.