Low-Polyphony MIDI Equipment Debian Recording Workaround

Just bought your first old school MIDI synthesizer and can't get it to work right? Having trouble getting DOSBox or SCUMMVM to work the way you want? Perhaps we can help. Do you have some neat tips you just want to share with the world? Or maybe you just need help convincing your computer to work. Either way, use this forum for all tech support related needs that somehow relate to MIDI and/or PC Gaming.

Moderator: Quest Studios Archive moderators

Post Reply
jaffa225man
Quest Studios Veteran
Quest Studios Veteran
Posts: 169
Joined: Mon Jul 13, 2015 6:26 pm
Location: Chippewa Falls, Wisconsin

Low-Polyphony MIDI Equipment Debian Recording Workaround

Post by jaffa225man »

In other words, this is a method for avoiding dropped notes using Debian GNU/Linux for multi-track recording by keeping everything in-sync with JACK-transport.

First, it's a good idea to boot a low-latency kernel when dealing with music, so if you have a 64-bit (amd64-compatible) processor, I suggest running:

Code: Select all

su -c "apt-get install linux-image-rt-amd64"
(and entering your root password)
or:

Code: Select all

sudo apt-get install linux-image-rt-amd64
(and entering your user's password)

After either of those commands installs the new kernel, reboot to use it.

This method relies on synchronization using the JACK-transport between rosegarden (sequence playback) and ardour (audio capture).

Since I usually use audacious to setup my MIDI playlists, I needed a way to get that into rosegarden for it to orchestrate it.
In my particular case, I wanted the output from my audacious playlist modified by my patched qmidiroute.
Whatever your case, the trick is to capture the MIDI sequence that normally would've been output to your sound module, instead into a SMF (.mid) file recorded by arecordmidi.
I used aconnect to connect the virtual ports, like so (but modify for your specifics):

Code: Select all

aconnect 14:0 129:0
14:0 is "Midi Through" on my system, which is what I like to graphically set audacious to output MIDI to since that port never changes (File->Preferences->Plugins->Input->AMIDI-Plug->Preferences->(left side)ALSA Backend).
129:0 is qmidiroute's input port on my system.
You may not need to use aconnect at all, if you know your playback program's port and don't need to pipe MIDI around.

Next, begin capturing your playlist:

Code: Select all

arecordmidi -p 129:1 ~/Music/capture.mid
129:1 is qmidiroute's first output port, on my system.
To see which port your player (or qmidiroute) is outputing from, run this with the player already open:

Code: Select all

arecordmidi -l
As soon as possible, upon starting arecordmidi, begin playback in audacious or whatever program you have your playlist setup in.

When playback completes, press ctrl-c within the arecordmidi terminal session to stop it recording.

I find it best to open qjackctl now to setup the audio capture device's "Sample Rate" and to be sure its input (capture*) ports are available later on. Start the JACK server from it now too.

Now you're ready for the real fun.
Open rosegarden. Then File->Open and choose the capture.mid file you created.

Check the box for Edit->Preferences->(left side)General->Behavior->"Use JACK transport" and click "OK"
All of the selections in Edit->Preferences->(left side)MIDI->"MIDI Sync" should be "Off" too.

Also choose the output MIDI port your sound module is connected to in Studio->"Manage MIDI Devices" and click "Close"

Click the leftmost circle (Mute track) on each MIDI track (channel) you don't want output, to minimize polyphony. I muted every other track for my equipment. For most sequences that should be enough, but feel free to mute more or less.

Here's where you want to run ardour, but my experience lately assumes it won't just open & you would be encountering a long-standing glitch I've seen. What works for me is to change the Applications theme to HighContrast first.
So, run:

Code: Select all

su -c "apt-get install gnome-tweaks"
(and enter your root password)
or

Code: Select all

sudo apt-get install gnome-tweaks
(and enter your user's password)
Then open Tweaks->(left side)Appearance->(Themes)Applications and change "Adwaita (default)" to "HighContrast".
If you previously tried to open ardour and can't see it, it's still in the background and will continue to consume CPU cycles, so it should be killed:

Code: Select all

killall -r Ardour*
Now open ardour and it will be visible.

Begin a new session with "JACK" as the "Audio System".
Then right-click on the empty area of the track list, and create a stereo audio track, and then click "Add and Close"
Right-click your track name, and click "Inputs". Go to "Hardware" on the left side and click the L & R boxes that connect capture_1 to "L" (left) and capture_2 to "R" (right) on your track (or whichever capture ports are physically connected to your sound module's output ports)
Close the "Inputs" window.
Arm the track for recording by clicking the red circle right of the track's name, so that it becomes brighter.
Toggle record on the top toolbar too. Again, the circle becomes brighter red.

Also in the top toolbar, directly under the exclamation point and metronome, click "Int." to change it to "JACK" which enables external JACK sync.

It's a good idea, now, to be sure the newly synced JACK transport is at the beginning of the midi track and for ardour's recording, so in ardour, press the "Home" key on your computer keyboard.

When you press the play arrow on the top toolbar (or in rosegarden, or qjackctl), rosegarden's playback and ardour's recording will advance in sync.

When you finish this first playback & recording, stop it with the square in ardour's top toolbar.

Right-click the empty area under your track and create another stereo audio track to layer in the previously muted channels. Don't forget to disarm the record button (it becomes dimmer) on the track you first recorded, and brighten the record button on the new track. You'll also have to brighten the top record button again, since it disables when recording is stopped.

Next, I like to right-click the previously recorded track name and uncheck "Active" to avoid confusion and CPU usage. Also, set the "Inputs" for the new track to the same hardware inputs you used on the last track.

Swap which MIDI channels are muted in rosegarden. Also, it's a good idea to leave track 1 unmuted for both/all playbacks because that's where rosegarden loads all SysEx messages. To make that work, just remove all track 1's notes (after you have them recorded normally once) by double-clicking the track in rosegarden, clicking and dragging to highlight all notes there and pressing "Delete" on the computer keyboard. (Don't take the ctrl-a "Select All" shortcut because it selects SysEx too.)

Back in ardour, press the "Home" key on your computer keyboard to return the transport to the beginning.

Click the play arrow, again, in the ardour toolbar, or any other JACK-synced program.

When all the recordings are finished, right-click every recorded track and make sure "Active" is again checked.

On the toolbar, under the exclamation point and metronome, click "JACK" to change it back to the internal positional sync ("Int.").

I like to split the first recording into songs by positioning the mouse cursor over split points (between songs) and pressing "s" on the computer keyboard. This way, export points are easily repeatable.

When done splitting the songs up, click the pointer finger in the toolbar to change the mouse into "Grab Mode". Then right-click the region you want to export & click Select->"Set Range To Selected Regions". Then, again, right-click on the region and this time, click on "Export Range" at the bottom. The "File format" tab is for setting the format, filename, and location to export to. That's probably all that's necessary for this window, but otherwise on the "Channels" tab, "Master" is a good choice for export. There, too, you should see the number "2" next to "Channels:". Repeat this step for each region/song you want exported.

You're done! You should now have perfect recordings without polyphony issues!

I hope this works for others, and for me in the future. I came up with this method to capture some INTEGRA-7 recordings I was worried about dropping voices, but it should work for the MT-32 family, SoundCanvas family, the D-05, Yamaha MU family, or any MIDI device really.
Post Reply