Midi_cc - send midi control change message - Help!

I’ve manged easily to get the sound from the PC’s onboard synth (using coolsoft virtualmidisynth rather than the native microsoft wavetable) to pan left and right - experimenting with various loops.

I would like to change the sound from the default piano to something else - but I can’t seem to find the right CC messages going.

I was working with
midi_cc 0, 0
midi_cc 32 n

For select bank 1 followed by patch no. to no avail.

I think this may need a midi program change message midi_pc in Sonic Pi

Yes I think you may well be right! - Sam, possible to put this on the wish list?

Might be able to construct one using midi_raw?

here we are …

midi_raw 192, 104
sleep 2

included this at the start of a piece and can now set up GM midi instrument(s).
there appears to be some time required for the program change to take effect so I’ve just added an arbitrary delay for now with the sleep 2. More investigation needed, but works ok for now for what I’m doing.

here’s the usual list of instruments - at the end of the web page: https://www.noterepeat.com/articles/how-to/213-midi-basics-common-terms-explained

may be of interest … simple loop to play thru all the GM instruments on PC
recommend coolsoft’s virtual synth - much better sounds than microsoft’s effort - https://coolsoft.altervista.org/en/virtualmidisynth

simple loop to hear on PC midi instruments

note midi_all_notes_off used per loop to stop

some instruments (e.g. no. 16 drawbar organ) sounding forever

use …

pp= “virtualmidisynth__1”

if you’ve installed coolsoft’s virtual midi synth

pp= "microsoft_gs_wavetable_synth"
130.times do
midi_raw 192, q
sleep 1
print q; print q; print q; print "raw, raw, raw"
midi_note_on 56, port: pp
midi_note_off 56, port: pp
sleep 0.5
midi_note_on 58, port: pp
midi_note_off 58, port: pp
sleep 0.5
midi_note_on 60, port: pp
midi_note_off 60, port: pp
sleep 0.5
midi_note_on 62, port: pp
midi_note_off 62, port: pp
sleep 0.5
print “finished”

There IS a midi_pc command in the latest version of SP. I added it :slight_smile:
I have used it to choose gm instruments from SP. you simply use midi_pc 32. For example
Have a look at the documentation in SP.

midi_pc was included in v3.1 :slight_smile: (Thanks to @robin.newman)

Been away - yes that’s it - many thanks.

1 Like