Skip to content

MIDI input on Linux

Federico Bruni edited this page Jul 19, 2020 · 5 revisions

MIDI input allows to enter notes conveniently by using a MIDI instrument (usually a keyboard).

MIDI setup

This guide has been tested on a MIDI keyboard connected via USB. It was automatically recognized, as soon as plugged in, without having to install anything.
In order to hear the sound produced by the keyboard, you have to connect it to a synthesizer. This guide assumes you've already read MIDI playback on Linux and set up a synthesizer. We'll use aconnect (ALSA sequencer connection manager) to see all the audio input and output devices, find their IDs and connect them. When we first run it, we see:

$ aconnect -l
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'LPK25' [type=kernel,card=1]
    0 'LPK25 MIDI 1    '
client 129: 'FLUID Synth (qsynth)' [type=user,pid=8877]
    0 'Synth input port (qsynth:0)'

LPK25 is the name of the keyboard and its ID is 20:0. The synthesizer is FLUID Synth, identified by 129:0. So we can connect them using this command:

aconnect 20:0 129:0

Now playing the keyboard will produce sounds.

Clear the connection and the playback will stop:

aconnect -x

More information on Ted's Linux MIDI Guide.

Frescobaldi setup

Frescobaldi does not detect automatically the available MIDI input devices. You have to set it up in the Preferences, under MIDI Settings»MIDI Ports»Input port.

Usage

Open Tools»MIDI»MIDI Input.

Click on Start capturing, move the cursor to the line where you want to enter the music and play the MIDI instrument. Pitches will start popping up, without durations. You can add durations manually right after playing a note or later.

If you're not happy about the notes you've entered, you can overwrite them. Move the cursor to the left of the first note you want to correct, then select Re-pitch mode and start playing. The notes will be replaced by the new ones.

NOTE: If the cursor is on a new empty line and Re-pitch mode is checked, you might think that MIDI input is not working. No pitch is entered because there's no pitch to fix. Uncheck Re-pitch before entering notes in a new line.

By default pitches are entered in absolute mode. Select Relative mode to switch to relative mode.

The way alterations (black keys of the MIDI keyboard) are interpreted depends on the selected Key signature and the favorite accidentals choice (flat or sharp). For example, if D major (2 sharps) tonality is selected, then F-sharp and C-sharp will always be interpreted as sharps; all the other accidentals will be interpreted as either flat or sharp (user's decision).

By default, only single notes are entered, even if you play two or more notes at once. Select Chord mode to be able to enter chords.