- work in progress! (20/06/2020)
Introduction
If there is an external MIDI keyboard and the soundcard does not have a MIDI synthesizer to convert MIDI requests (e.g. “Start playing a B flat using a piano sound moderately loudly”) into sounds, then a ‘soft’ MIDI synthesizer is required. Timidity is one such soft-synth; fluidsynth is another.
Once the ability to service incoming MIDI requests has been added to the system then it is possible to allow human beings to easily issue such requests with a MIDI keyboard.
Using a sequencer applications facilitates changing the instrument, recording sequences, editing them, etc. Rosegarden is one such sequencer.
-
Installing software
- Install software as follows:
apt-get -y install timidity freepats fluidsynth fluid-soundfont-gm rosegarden lilypond playmidi pmidi sfarkxtc
(Rosegarden will complain if Lilypond is not installed. Playmidi is only to be installed because it contains example .mid files which can be used to test timidity. Pmidi is only installed because it can read a .mid file and send MIDI events to a MIDI synthesizer, such as the Timidity soft-synth.)
Installing soundfonts
- Get some SF2 or SFARK files from the internet.
- Convert any SFARK files to SF2 (there used to be an online service for doing this but; search on google)
-
Using a MIDI synthesizer
- Connect the MIDI keyboard; on my MIDI keyboard it is the ‘MIDI in’ fork of the MIDI cable which must be connected to it!
- Verify that timidity can find its sound files and communicate with the sound hardware by running:
timidity -B2,8 -Os -EFreverb=0 /usr/share/doc/playmidi/examples/jazz.mid.gz
- Run a MIDI synthesizer. This can be done either by running Timidy in server mode:
timidity -iA -B2,8 -Os -EFreverb=0 &
or by running Fluidsynth with one of the SF2 files:
fluidsynth -a alsa <sf2-file>
- Use the following commands to verify that the soft synth provided by Timidity or fluidsynth and the MIDI keyboard are both seen by the OS, as in this example:
user$ pmidi -l Port Client name Port name 14:0 Midi Through Midi Through Port-0 20:0 E-MU XMidi1X1 E-MU XMidi1X1 MIDI 1 128:0 FLUID Synth (2723) Synth input port (2723:0) user$
- Use the following commands to plumb the MIDI keyboard directly to the MIDI soft-synth:
user$ aconnect <keyboard-MIDI-port> <softsynth-MIDI-port>
which, in the above example would be:user$ aconnect 20:0 128:0
- Play the keyboard! Piano sounds should be heard. It may be that the volume controls need turning up!
- Unplumb the just made connection with the command:
user$ aconnect -x
- Kill the midi synthesizer process.
Using Rosegarden as a MIDI sequencer
- Run the command:
user$ rosegarden &
- Configure Rosegarden as follows:
- From the ‘Studio‘ menu, select ‘Manage MIDI devices‘. In the ‘Play devices’ section of the window, delete unconnected devices.
- If using Timidity, which provides many different instruments, then from the same screen, select ‘General MIDI device‘, click on ‘Import‘ and then select the instrument definition table appropriate to the patch set in use by Timidity (for me this meant selecting GM.rgd) and at the ‘Import from Device …’ window, click ‘OK‘.
- In the ‘Record devices’ section of the same window, delete unconnected devices and then mark the remaining device as the ‘Current device‘.
- Close the ‘Manage MIDI Devices’ window by clicking ‘Close‘.
- From the ‘Tracks‘ menu, select ‘Set Instrument‘, then select ‘General MIDI Synth‘ and then select ‘General MIDI Synth #1‘.
- Note that these settings are not saveable (either from ‘Settings’, ‘Save settings’ or when songs are saved).
- Play they keyoard! Piano sounds should be heard.
- In the ‘Instrument Parameters’ section of the window, on the left, click the ‘Program‘ checkbox and verify that other instruments may be selected from the pull-down list and that the correct sounds are generated.
Using Musescore as a MIDI synthesizer and sequencer
- Run:
apt-get install musescore
- Run:
musescore &
- Go to Edit–>Preferences–>I/O and switch to Portaudio and set:
- API: ALSA
- MIDI input: <your MIDI keyboard>
(If this is not possible then on the same screen reset all prefences to default, restart musescore and try again.)
- Press ‘N’ to enter note taking mode and then press ‘a’ (for the note A) and check you hear something.
- You can add other instruments by pressing ‘I’.