It is still not quite clear what you mean, and I do not use Max/MSP. However, am I guessing right that you want an opcode that returns the currently set program (as a state) for a MIDI channel, rather than the MIDI message only when it is received ? For example, the following opcode, which is similar to midichn, would return the program number (1 to 128) for channel 'ichn' (defaults to 0 which means the channel on which the current note was activated), or zero for a score note: ipgm midipgm [ichn] Without a new opcode, you could store the preset number for each channel in a table: ; always use instr 2 for MIDI notes massign 0, 2 pgmassign 0, 0 ; table for storing preset numbers, with defaults set below ; table[0] is for score notes, table[1] is channel 1, etc. giPresetTbl ftgen 0, 0, 33, -2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16 ; instr 1 should be always on instr 1 nxtEvt: kst, kch, kd1, kd2 midiin if (kst != 0) then if (kst == 192) then tablew kd1 + 1, kch, giPresetTbl endif ; add any other MIDI event parsing here ; ... endif endin instr 2 ichn midichn ipreset table ichn, giPresetTbl ; generate sound output ; ... endin On Friday 09 June 2006 18:33, Dr. Richard Boulanger wrote: > here is the manpage for sfplay.... > > ar1, ar2 sfplay ivel, inotenum, xamp, xfreq, ipreindex [, iflag] [, > ioffset] > > so... i have loaded in a general midi soundfontbank and I want to > select from 127 preset instruments > using program change messages from a standard midi controller and > from a standard midi file > > but we do not currently have an opcode (such as in max/msp - pgmin) > that reads in program change messages > sent from a controller keyboard or midifile. > > as shown below, parsing with midiin does not work correctly because > when i test for the > program change status byte, it still passes data when other status > bytes are received from the midi input > > I have it working fine if I use ctlin, but standard midi files use > program change messages to change programs/patches/samples _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net