Date created: Sunday, November 26, 2023 4:48:11 PM. Last modified: Sunday, November 26, 2023 5:37:45 PM
MIDI Debugging
Debugging
# Check the USB to MIDI device is detected as connected:
$ dmesg -T
[So Nov 26 16:20:34 2023] usb 5-1.4: new full-speed USB device number 43 using xhci_hcd
[So Nov 26 16:20:34 2023] usb 5-1.4: New USB device found, idVendor=0582, idProduct=0122, bcdDevice= 1.00
[So Nov 26 16:20:34 2023] usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[So Nov 26 16:20:34 2023] usb 5-1.4: Product: Roland Digital Piano
[So Nov 26 16:20:34 2023] usb 5-1.4: Manufacturer: Roland
# Check the if the MIDI device is recognised
$ amidi -l
Dir Device Name
IO hw:3,0,0 Roland Digital Piano MIDI 1
# Install fluidsynth and a SongFont
$ sudo apt-get install fluidsynth --no-install-recommends
$ wget https://keymusician01.s3.amazonaws.com/FluidR3_GM.zip
$ unzip FluidR3_GM.zip
# Play an existing MIDI file using the SongFont
$ fluidsynth FluidR3_GM.sf2 armeniansong.mid
# Use the MIDI device to play notes using the SongFont
# "-o midi.autoconnect=1" is required to connnect to the MIDI device.
# -q 1 is option to increase the gain, otherwise the device might be too quite to hear
# -d shows us the key presses are detected (just in case we can't hear anything)
#
$ fluidsynth -o midi.autoconnect=1 -q 1 -a pulseaudio -d FluidR3_GM.sf2 FluidSynth runtime version 2.2.5 Copyright (C) 2000-2022 Peter Hanappe and others. Distributed under the LGPL license. SoundFont(R) is a registered trademark of Creative Technology Ltd. fluidsynth: Connection of Midi Through Port-0 succeeded fluidsynth: Connection of Roland Digital Piano MIDI 1 succeeded
fluidsynth: Using PulseAudio driver Type 'help' for help topics. fluidsynth: warning: Failed to set thread to high priority fluidsynth: warning: Failed to set thread to high priority event_pre_noteon 0 33 43 event_post_noteon 0 33 43 event_pre_noteon 0 35 34 event_post_noteon 0 35 34
We can set synth.verbose to True to get more details key press information:
$ fluidsynth -o midi.autoconnect=1 -o synth.verbose=1 fluidsynth: prog 0 0 0 fluidsynth: prog 1 0 0 fluidsynth: prog 2 0 0 fluidsynth: prog 3 0 0 fluidsynth: prog 4 0 0 fluidsynth: prog 5 0 0 fluidsynth: prog 6 0 0 fluidsynth: prog 7 0 0 fluidsynth: prog 8 0 0 fluidsynth: prog 9 128 0 fluidsynth: prog 10 0 0 fluidsynth: prog 11 0 0 fluidsynth: prog 12 0 0 fluidsynth: prog 13 0 0 fluidsynth: prog 14 0 0 fluidsynth: prog 15 0 0 fluidsynth: Connection of Midi Through Port-0 succeeded fluidsynth: Connection of Roland Digital Piano MIDI 1 succeeded Type 'help' for help topics. fluidsynth: warning: Failed to set thread to high priority > fluidsynth: warning: Failed to set thread to high priority fluidsynth: noteon 0 48 87 00000 3.438 3.416 0.000 0 fluidsynth: noteoff 0 48 0 00000 3.586 1 fluidsynth: noteon 0 48 97 00001 3.705 3.682 0.000 1 fluidsynth: noteoff 0 48 0 00001 3.844 2
Here we can view the settings of fluidsynth:
$ fluidsynth -q Type 'help' for help topics.
# Enter "settings" to see all settings
> get audio.driver alsa > get midi.driver alsa_seq > get synth.sample-rate 44100.000 > get synth.gain 0.200 > get synth.default-soundfont /usr/share/sounds/sf3/default-GM.sf3
# ^ There is a default SongFont meaning we can start fluidsynth without specifying one
Fluidsynth now shows as an additionally connected MIDI device:
$ aconnect -l client 0: 'System' [type=Kernel] 0 'Timer ' 1 'Announce ' verbunden zu: 128:0 client 14: 'Midi Through' [type=Kernel] 0 'Midi Through Port-0' verbunden zu: 128:0 client 28: 'Roland Digital Piano' [type=Kernel,card=3] 0 'Roland Digital Piano MIDI 1' verbunden zu: 128:0 client 128: 'FLUID Synth (25480)' [type=User,pid=25480] 0 'Synth input port (25480:0)' verbunden von: 0:1, 14:0, 28:0
Fluidsynth
Run it:
$ fluidsynth -o midi.autoconnect=1 -g 1 -a pulseaudio -m alsa_seq -r 48000
Previous page: Power Metrics
Next page: Theory Links