Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidarchanjo/a760cfc6532f5b33403a4a40940f5cbc to your computer and use it in GitHub Desktop.
Save davidarchanjo/a760cfc6532f5b33403a4a40940f5cbc to your computer and use it in GitHub Desktop.
HOW TO SET UP A VIRTUAL PIANO TO DISPLAY PLAYED NOTES FROM A PHYSICAL KEYBOARD ON LINUX

HOW TO SET UP A VIRTUAL PIANO TO DISPLAY PLAYED NOTES FROM A PHYSICAL KEYBOARD ON LINUX

To display a virtual piano on Linux that shows played MIDI notes from a physical keyboard, you can use the following tools:

1. Connect the Keyboard to your Linux System:

Use a USB A-to-B cable (commonly referred to as a printer cable) to connect the USB host port on your keyboard to a USB port on your computer.

2. Install Required Packages:

  • Ensure that the alsa-utils package is installed, which includes the aconnect utility for managing ALSA (Advanced Linux Sound Architecture) MIDI connections. On Debian/Ubuntu-based systems:
sudo apt-get install alsa-utils

3. Verify that the Keyboard is Recognized:

  • After connecting the keyboard, verify that your system recognizes it as a MIDI device.
  • Open a terminal and run the following command to check if the MIDI device is detected:
    aconnect -i
    You should see your keyboard listed as a MIDI input device. For instance, the output would be something like this:
    client 0: 'System' [type=kernel]
      0 'Timer           '
      1 'Announce        '
    client 14: 'Midi Through' [type=kernel]
        0 'Midi Through Port-0'
    client 20: 'Digital Keyboard' [type=kernel,card=1]
        0 'Digital Keyboard MIDI 1'
    From this output, the MIDI device entry Digital Keyboard is the related entry to the connected keyboard.

4. Install Virtual MIDI Keyboard (VMPK):

The Virtual MIDI Piano Keyboard (VMPK) is a popular tool for displaying MIDI notes visually as you play them on a physical keyboard.

Install VMPK:

  • On Debian/Ubuntu-based systems:
sudo apt-get install vmpk

5. Connect Physical MIDI Keyboard to VMPK:

After installing VMPK, follow these steps:

  • Open VMPK: Launch the VMPK application.
  • Connect to the MIDI Device:
    1. Go to Edit -> MIDI Connections.
    2. In the connections window, make sure Enable MIDI Input checkbox is selected.
    3. In Input MIDI Connection, select your physical MIDI keyboard, for instance Digital Keyboard:0. This step ensures that the notes you play on your physical keyboard are recognized by VMPK.
    4. Click on the OK button to save the configuration.

6. Using JACK for Advanced Connections (Optional):

If you need more control over MIDI routing or have complex audio/MIDI setups, you can use JACK alongside QjackCtl for managing connections.

Install JACK and QjackCtl:

  • On Debian/Ubuntu-based systems:
sudo apt-get install jackd qjackctl

Steps to Connect:

  1. Start JACK: Open QjackCtl and click Start.
  2. Connect MIDI Devices:
    • Open the MIDI tab in QjackCtl's connections window.
    • Connect your physical MIDI keyboard to VMPK.

7. Visualize MIDI Notes:

As you play your physical keyboard, you should now see the notes being visualized on the virtual piano in VMPK.

Summary:

  • Install VMPK for a virtual piano display.
  • Use QjackCtl for more complex routing and connections, though it’s optional for simpler setups.
  • Ensure that your MIDI keyboard is properly connected and recognized.

This setup provides an intuitive way to visualize the MIDI notes you play, making it a useful tool for music practice, production, and learning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment