Connecting Sonic PI to Virtual Midi Piano Keyboard on Windows 10

Here are the datails of how I drive VMPK from SonicPi 3 on Windows 10.
(This assumes you have SonicPi-v3.0.2-BETA-3 or later, as I use the midi-pc command to select synths in the example program.)
Download and install loopMIDI from http://www.tobias-erichsen.de/software/loopmidi.html
Download and install VMPK from http://vmpk.sourceforge.net/#Download
Download the sample piece to test the setup. (Bach bwv537 Fantasia and Fugue in C minor) from here

Open loopMIDI, and if necessary create a virtual port using the + at the bottom. I used the name loopMIDI port
Open VMPK.
Select Midi Connections from the Edit Menu.
Select settings as in the image below
midi
Open Sonic Pi
load in the example file (note it specifies midi port and that the selected midi port is “loopmidi_port” the port created in loopMIDI, which should also be displayed in the list of midi ports in the Sonic Pi IO prefs as shown in the image below


Now you should be able to play the piece, and it should be rendered by the church organ synth in VMPK which uses fluid synth.
You may be interested in the routine I use to play midi notes named mplay. This takes a list of midi notes, and a corresponding list of note durations and plays them in pairs. It also checks if the list of notes contains a group of notes inside [ ] and if so plays them at the same time as a chord. It has a parameter to select the midi channel, and also the velocity (or volume) setting with a default value of 80.
I also use the midi_pc function which I added to SP 3.0.2 which enables you to send a program change command to VMPK and select which synth you want to use. In this example all channels use the same synth number 19 (counting from 0) of the available synths supported by VMPK. This is a church organ sound.

For trouble free operation, open the applications in the order specified. You should be able to see the byte throughput listed in loopMIDI if the midi info from Sonic Pi is reaching it.

2 Likes