[nzlug] Sound generation on Linux

Peter Butler peter.butler at 141.com
Sun Jun 10 02:17:59 NZST 2007


> Say I have a program like 'vkeybd'. This is supposedly a simple 
> 'virtual keyboard' that supports MIDI. It puts up the keyboard fine, 
> but no sounds happen when the keys are pressed. Other things like 
> games produce sounds, no problems. Obviously I'm missing a link 
> somewhere hence the request for some 'edjikation' on sound matters.
If it's a midi-only keyboard you need to connect it to a MIDI sound 
source to produce sound.  Sound sources can either be hardware (e.g. an 
external synth or sampler, connected to your computer with a MIDI cable) 
or software (a soft synth or soft sampler that runs on your computer).

The easiest way to get started is to use a soft synth or soft sampler.  
One of the easiest soft synths to get started with is ZynAddSubFX.  This 
comes with a built-in keyboard but you can also connect a virtual or 
real keyboard to control it.

To wire all this together, and to ensure all your sound applications 
play well together I find it easiest to use the Jack low-latency sound 
daemon (jackd).  You can also install qjackctl, which gives you a nice 
simple gui to control it.

A very basic step-by-step guide follows:

1. Install jackd, qjackctl and zynaddsubfx (if you are running debian or 
ubuntu these are available via apt-get or synaptic)
2. Run qjackctl and start the sound daemon (before you start the daemon 
you might have to configure it to use alsa for output)
3. Start your virtual keyboard
4. Start zynaddsubfx and configure it to use jack for output (it might 
automatically detect that jack is running and configure itself).
5. Use qjackctl to connect the outputs of your MIDI keyboard to the 
inputs on zynaddsubfx.  There is a MIDI config screen in qjackctl that 
allows you to do this using drag-and-drop.
6. Play music!

Once you have this basic setup it's possible to do all sorts of crazy 
stuff.  You can have as many soft synths or soft samplers running as you 
want (up to the capacity of your machine), and you can also run as many 
keyboards/MIDI inputs as you want.  My previous setup had MIDI drums and 
a MIDI keyboard connected to the machine with the drums wired up to a 
soft sampler and the keyboard connected to zynaddsubfx (for synth 
sounds).  This worked OK on a P4 with bugger all cache and 768MB RAM.

Here's an overview of a bunch of soft synths: 
http://www.linuxjournal.com/article/6320  I also use fluidsynth (with 
the qsynth front-end) for playing sampled sounds, this works well with 
jackd and is reasonably easy to use.  One fascinating piece of software 
that you should also check out is spiralsynthmodular, although I'd 
better warn you that you may spend whole days fiddling with this, it's 
very addictive.

Hope this helps

Cheers

Peter



More information about the NZLUG mailing list