From the JACK website:
JACK is system for handling real-time, low latency audio (and MIDI). It runs on GNU/Linux, Solaris, FreeBSD, OS X and Windows (and can be ported to other POSIX-conformant platforms). It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a "plugin"). JACK also has support for distributing audio processing across a network, both fast & reliable LANs as well as slower, less reliable WANs.
MuseScore has supported JACK MIDI output since version 0.9.6. JACK enables MIDI output from MuseScore to be routed nearly anywhere:
- to file, using
- recorded, using
- to any synthesizer or sample, be it
The final two attachments* contain different renderings of the first movement from Pictures at an Exhibition by Modest Mussorgsky, the default MuseScore scene. The first is sampled using the Salamander Grand Piano, and the second synthesized using the RhodeSpace1 preset from ZynAddSubFX. The audio was recorded with Timemachine in both cases.
*Due to forum limitations, after downloading rename the files from
- Jack2 built with DBus support (http://jackaudio.org/) *
- Patchage (http://drobilla.net/software/patchage/)
- LinuxSampler (http://www.linuxsampler.org/) **
- QSampler (http://qsampler.sourceforge.net/qsampler-index.html)
- ladish (http://ladish.org/)
- laditray (http://marcochapeau.org/software/laditools)
- jack-keyboard (http://jack-keyboard.sourceforge.net/)
* The benefits of a DBus-enabled JACK are enumerated at the Jack Dbus Packaging page. DBus support is configured with:
python2 waf configure --dbus.
** The last LinuxSampler release is dated 2009-10-16, to support the SFZ format, the latest LinuxSampler sources must be checked-out from SVN.
Start and Configure JACK
Assuming JACK is correctly installed, and the DBus session bus is correctly configured, JACK can be simply started with:
$ jack_control start --- start
Other useful commands include:
$ jack_control status --- status started
In fact, JACK can be configured completely through the use of
$ jack_control Usage: jack_control [command] [command] ... Commands: exit - exit jack dbus service (stops jack server if currently running) status - check whether jack server is started, return value is 0 if running and 1 otherwise start - start jack server if not currently started stop - stop jack server if currently started sm - switch master to currently selected driver dl - get list of available drivers dg - get currently selected driver ds <driver> - select driver dp - get parameters of currently selected driver dpd <param> - get long description for driver parameter dps <param> <value> - set driver parameter il - get list of available internals ip <name> - get parameters of given internal ipd <name> <param> - get long description for internal parameter ips <name> <param> <value> - set internal parameter iload <name> - load internal iunload <name> - unload internal ep - get engine parameters epd <param> - get long description for engine parameter eps <param> <value> - set engine parameter
jack_control queries the JACK DBus interface, if the JACK service is not already started, DBus will autostart the
/usr/bin/jackdbus auto as defined in
Start and Configure JACK (alternative with ladish/laditools)
laditray is started, it will appear in the system tray. Right-clicking on the status icon provides a menu that allows to stop, start and monitor JACK, as well as start some JACK related applications. For example, the
ladiconf application allows you configure all aspects of JACK.
|JACK stopped, laditray menu highlighting option to start JACK||JACK started, laditray menu highlighting option to configure JACK|
The following highlight using
ladiconf to configure JACK:
The first step is to download a useful sample library. Some useful libraries are
- FlameStudios Guitar Samples - GIG format - link
- Salamander Grand Piano -SFZ format - link
- Sonatina Symphony Orchestra - SFZ format - link
- Total Harmonic Distortion - link
QSampler will automatically start and communicate with LinuxSampler via the LSCP protocol. In this example, I'll show how to setup the Salamander Grand Piano:
Download and extract the sample library
mkdir -p /storage/samples/gigasamples/piano/salamander.grand.piano.v2 wget http://freepats.zenvoid.org/Piano/SalamanderGrandPianoV2_48khz24bit.tar.bz2 tar xvjf SalamanderGrandPianoV2_48khz24bit.tar.bz2
- Start QSampler
- Add a channel by right-clicking anywhere on the canvas, or by using
Edit->Add Channel (Ctrl+A).
Select the SFZ Sample Engine, JACK MIDI Input, JACK Audio Output, and the path to the Salamander Grand Piano SFZ file.
Correctly completed, QSampler with the loaded instrument, should appear as:
If ever you need more voices, as indicated by midi dropouts during playback, and the LinuxSampler error message
"EngineBase: ERROR, voice stealing didn't work out!", visit the Tuning tab of the Options window, via
View->Options F12. One rule of thumb is that the number of disk streams should always be greater than the number of voices.
Common LinuxSampler Issues
If LinuxSampler is unable to allocate enough locked memory, it might throw the following generic message:
- "sfz::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse sfz file."
To quickly verify if this is the case, compare the per-process maximum amount of locked memory to the current amount of memory LinuxSampler is using (all of LinuxSampler memory is locked). For example:
$ ulimit -l 800000 $ ps --no-headers -o rss -C linuxsampler 704032
To increase the maximum amount of locked memory, edit
/etc/security/limits.conf. In the following example, any process launched by a member of the audio group can lock approximately 781M of memory:
@audio - memlock 800000
Don't forget to ensure that your user is part of the
Any MIDI keyboard should be accessible to jack. I use the archaic Roland PC-200 MKII keyboard with a generic VEIWCONN MIDI->USB adapter purchased from ebay. While the keyboard is exposed to jack via input=hw:3, the specific port varies per computer and depends on the amount of input devices.
JACK MIDI input support is targeted for MuseScore version 2.0
To enable JACK MIDI output from MuseScore, open the
"I/O" tab of the MuseScore preferences -
Edit->Preferences... and select
"Use JACK MIDI output". The default settings are perfectly acceptable.
Create JACK Connection via Patchage
While each individual component is started, they all have to be linked together as a coherent system, both MIDI and Audio from input to output. The concept is similar to creating connections by plugging wires in a physical patch bay.
When Patchage is first started, the initial state of the system should be similar to:
The first step is to connect the left and right outputs of LinuxSampler to the playback channels of the system. Do this by left-clicking on the "0" output of LinuxSampler (equivalent to the left channel), holding and dragging to hover above "playback_1" of JACK's system output, and release. Repeat for the the right channel,
Follow the same procedure to link the MIDI output from MuseScore,
"mscore-midi-1" to the input MIDI channel of LinuxSampler,
midi_in_0. For most pieces, only the first MuseScore MIDI output channel will used, and any other channels such as
"mscore-midi-2" can be ignored.
The connection graph after all the connections have been made should appear similar to:
Now, playback from MuseScore should be routed to the LinuxSampler synthesizer and output from JACK via a speaker system.