Ubuntu – Save as MIDI when playing from VMPK & QSynth

midi

I have set up VMPK and QSynth along with JACK. It works and I can hear the tunes.

But what I want is to have the played tunes saved automatically as a MIDI file.

I found this question here: MIDI to VMPK to QSynth

There is an answer to that question which shows how to save as WAV file. That did not work for me. The file is created but seems an empty file.

Can anyone suggest me how to save MIDI and/or WAV from either VMPK or QSynth. Thank you.

Best Answer

arecordmidi

First I got vmpk working with fluidsynth on the CLI or qsynth through ALSA as shown at: Virtual MIDI Piano Keyboard setup

Now, after doing that setup to hear the keyboard presses, I also run the following on another terminal:

arecordmidi --port 129:0 out.mid

where 129:0 is the vmpk output port found with aconnect -l just as was used for the fluidsynth setup on the other linked answer.

Once arecordmidi starts running, it immediately starts recording vmpk MIDI input to out.mid, until I do Ctrl+C to kill it. I can still hear the sounds at the same time from fluidsynth as before to know what I'm playing.

LMMS

LMMS was so incredibly easy to use for this purpose! After one hour of playing with I was able to record VMPK input through any of the synthesizer plugins it has (including e.g. ZynAddSubFX), and it can also record live while looping the other instruments!

All you have to to is launch vmpk, then on an instrument track (ZynAddSubFX in my case) I go:

  • gear symbol
  • MIDI
  • input
  • VMPK

This is also shown at: https://www.youtube.com/watch?v=NpeP2th08ak

Now I can already hear the Zyn sound coming from VMPK.

Then to record, there are two cryptic looking record buttons next to play on the corresponding Piano-Roll view:

enter image description here

The right one allows you to hear other instruments at the same time as you record your track.

Then there is a File > Export MIDI menu if you really want the MIDI.

But then I made the incredible discovery that LMMS also has its own virtual MIDI keyboard, with the default traditional ZSXDC bindings, so there isn't much point in using VMPK with it I think. When you click on the instrument, a keyboard for that instrument opens up, and then ZSXDC now play that instrument:

enter image description here

The only thing I could not find was how to change octaves with a keyboard shortcut as I can in VMPK, I could only move it by changing that small white square on top of the keyboard (the "base note"?) with my mouse: https://www.lmms.io/forum/viewtopic.php?p=63072

Ardour 5

This is another method I almost got working. And it is likely to be a much more realistic use case, as it allows you to play back the backing track while recording, and see live where your MIDI notes are landing.

First you have to get VMPK to feed into Ardour 5. As mentioned at: https://discourse.ardour.org/t/vmpk-not-showing-in-midi-routing-grid/103387 Ardour 6 will have its own built-in keyboard so that won't be needed anymore. But on 5 you need to do the following.

Set MIDI System to "ALSA sequencer" instead of the default "ALSA Raw devices". This can be done on a running project under:

  • Window
  • Audio/MIDI setup

or when starting to run a new session.

"Audio System" should also be set to ALSA of course as that is what we are using.

enter image description here

Once that is done:

  • create a new MIDI track in ardour
  • start running vmpk

and then go under:

  • Window
  • MIDI Connection

you will see something like:

enter image description here

The key thing is that there is a "Hardware" tab. This is vmpk!

So now, you just have to click on the area where there is a green dot on the screenshot to create that connection (the dot is not present when you first open the window).

Once that is done, I can now hear and see soundwaves moving on Ardour when I touch vmpk keys!

So then just start recording in Ardour as you would for any other audio:

  • hit record symbol on the MIDI track we created and where we will record to
  • hit round red recording symbol on top (shift + r)
  • start playing (space)

and as it plays, it will record vmpk keys and show them live in ardour, something like this:

enter image description here

so you se that my random notes were registered!

Now the only thing I haven't managed is to export the MIDI track! Not that it matters much I guess, since once inside Ardour, we generally have more desirable output options like .ogg, but still.

Tested on Ubuntu 20.04, I can't believe I'm wasting my life doing this stuff! :-)