| The ComposeMe page, about sound
infrastracture and music applications in GNU/Linux. |
| Paragraphs
in this page are: Overview Sound Servers Software Synths and frontends Infrastracture proposal A permanent solution Music Applications - Links |
Overview Professional use of Linux in music is at its infant stage. However, the infrastracture exists, more users get interested on music issues in Linux and the tools get better and better constantly. This page attempts to explain and simplify the procedure of how to setup a GNU/Linux box for professional music-score-sound production. Kernel modules and Sound Servers are pretty standard and widely used. In the contrary, Software Synths, Frontends and Music Applications are many and only a portion of them will be mentioned here. Sound Servers Software Synths and frontends Kernel Modules Sound cards are hardware devices and require drivers in order to be available to the OS or the Apps. It's the kernel's task to load the appropriate drivers. If the drivers are compiled externally (outside the kernel) they are called "loadable modules" and can be loaded, unloaded, changed, recompiled, reloaded etc.etc. without the need of restarting the kernel. OSS. The Open Sound System is generic in all Unix-Compatible Operating Systems. It is not completely free, but no restrictions apply to the simple user. A wide variety of sound cards (and their internal devices like dsp, midi etc.) exists. Alsa. The Advanced Linux Sound Architecture, a newer project, has taken over OSS in the new 2.6 kernels, still providing backward compatibility for all applications that use OSS. In reality, it's the device names and not the OSS modules that these applications "see". Alsa is constantly growing, but exists only for the Linux kernel. Hardware midi, sequencer, dsp capture & playback and mixer subsystems are fully supported. Sound Servers The kernel modules, although sufficient are not adequate. If an application talks to the device itself, another application would report that device occupied. That's where the Sound Servers come. Their role is to provide realtime mixing of the sound events, thus being able to service more than one program at a time. So, multiple applications talk to a sound server, which in its turn talks to the device through the kernel. Furthermore, Sound Servers act as an abstract "layer", so that applications do not have to support every device for every architecture. An application that can talk to the Arts sound server can work in my Alsa-supporting Linux as well as my friend's OSS-supporting FreeBSD. Arts. The Analog Realtime Synthesizer is a very popular Sound Server in Unix Compatible OSes. It usually is a part of the KDE suite, widely used by media reproduction applications and can itself be connected to a variety of devices/servers. EsounD. The Enlightened Sound Daemon is another popular Sound Server. It comes as standard in the Gnome package. It is not in great development nowdays but nevertheless is a standard used by many programs. ESD has network capabilities. "In addition to accepting client connections from the local machine, ESD can be configured to accept client connections from remote hosts which authenticate successfully". Jack. The Jack Audio Connection Kit was designed from scratch for professional work. The project focuses on synchronous execution of all clients, and low latency operation. Jack clients can run as standalone applications as well as Jack internal plugins. Sound servers can be saparated from the suites that include them. The Gnome Desktop and apps can use Arts without difficulties. The playback of a sound file is only a portion of a Sound Server's power. Sound Servers can also record, provide full duplex capabilities (recording while playing), support and control physical midi connection to/from external musical instruments and respond to an application's instructions in realtime. This "realtime" ability, enhanced by the superior processing power, memory, and storage capability of a computer over a dedicated musical instrument, has led to the design of programs that act as "Software Synthesizers". Software synthesizers act as hardware synthesizers would, with the exception that they are only programs. Stored samples are processed by the CPU and then passed on to the Sound Server. The software synth handles tone timbre and sound effect issues and responds to the actual Midi commands that would be used if the connection was actually hardware. Software Synths Arts. ...again ... Yes, the Analog realtime Synthesizer acts as a Soft Synth too. Waveforms, oscilators filters and effects can be loaded as modules in order to reproduce a musical piece. Timidity. A software synth, usually included in most GNU/Linux Distros. Timidity can be called from a command line or a program like kmid, can connect to a variety of Sound Servers and can also act as a Midi server for Alsa. FluidSynth. A Jack dependent software synth. Like Timidity, FluidSynth is a command line program. FluidSynth is capable of creating multiple software devices, each with a different sound bank. Music applications can then see these devices separately as if they were different synthesizers. It supports reverb and chorus effects, 96kHz sample rate and great polyphony. Software synths do not just load one sound. They can load a sound bank (or sound font) containing a variety of sound samples. Some may have their own standard, others may follow General Midi. Many of them follow wide sampling standards and are compatible to samples that MS Windows synths can use. Software synths have advantages and disadvantages compaired to hardware synths. They can have as much polyphony as the processor can handle and be forever expandable and updated, but on the other hand, a certain lag measured in miliseconds is audible in simple non-professional sound cards. That's why software synths on a standard home computer are better used for creating ambient sounds. Frontends Qjackctl. A Jack frontend. Can start, stop. check status of the jack daemon, show how much cpu is used, accept many parameters and finally save the configuration to a command line in ~/.jackdrc so that jack dependent applicationscan start the daemonif they do not find it running. I used the frontend to experiment with Jack and when I found a good configuration, looked in ~/.jackdrc and now use the command line itself without the frontend. Qsynth. A Fluidsynth frontend. Very useful tool. In fact I use it all the time to manage Fluidsynth. It can start-stop multiple synths, change sound samples and assign separate effects for every synth. Infrastracture proposal Let's now do a step-by step launch of sound servers soft synths etc. We will base Jack on alsa and everything else on Jack. 1) We stop the sound servers that use Alsa, like Arts or EsounD. (we go to the control centers and disable sound) 2) We call jackd: jackd -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0 -D stands for full duplex -C is the capturing alsa device -P is the playback alsa device. 3) We call the control centers and configure e.g. Arts to use the Jack server and NOT Alsa. This way, every Sound Server is above the Jack Sound Server which is above the Alsa Module. 4) We configure applications like XMMS to use Jack or Arts. 5) We call Qsynth (that uses Fluidsynth) and load a "sound font 2" type sound bank. Careful though, there is a possibility that a sound bank does not produce sound, but other banks will. I will investigate this issue. 6) We call timidity to play a midi file, including the "-Oj" option and it works. This way, timidity uses Jack. Alsa would report as occupied. 7) We run MusE, create a midi part, go to the Midi setup menu and find that the sound bank can be seen and used. If we import a midi file replacing everything and set up the devices correctly, Jack will redirect all midi data to Fluidsynth. A permanent solution Linux - as all Unix and Unix compatible operating systems - has a really neat habit: Fix once, work for ever. Once we know how to solve a situation, we can easily add a permanant solution, either globally with administrative (root) privileges or just for a user or group of users. There are two cases that involve the combination of sound servers in relation to the kernel modules. Case 1: Jack is to be started only when certain applications need it. 1) ~/.jackrc must exist. Mind the -T option, which will instruct jackd to exit when all clients have closed the connection. 2) A /usr/local/bin/jackstart executable script wouldn't hurt either. If jackstart is called from the command line, do not forget the "&" symbol at the end of the command in order to put jackd in the backround. Eitherwise, the terminal will not be freed for other commands. 3) Launch Kde Control Center -> Sound & Multimedia -> Sound System -> General tab: Check the Auto-Suspend option and give it a convenient time period to disconnect Arts from Alsa. I usually choose 5 secs. Select a relevant option for EsounD if it is preferred. There are certain applications that can use Jack but do not know how to start it. Then, we have to start jack ourselves. It would be best to put the simple playing applications to use Arts and the professional editting-processing ones to use Jack. Case 2: Jack is to be permanent above Alsa and all Sound Servers - Synths rely on it. 1) Add this to ~/.bash_profile (user solution) or /etc/profile (global solution): if [[ -z "$(ps -u $USER | grep jackd)" ]] then jackd --silent -d alsa -r 48000 -p 1024 -n 2 -D -C hw:0,0 -P hw:0,0 & else echo Jack Server for user $USER already running. fi In this way, every time a user logs in, the script will check whether there is a jackd running for the user and if not it will launch. But further logins will not start other daemons for the same user, as one is enough. 2) Kde Control Center -> Sound & Multimedia -> Sound System -> Hardware tab: Choose Jack Audio Connection Kit (or Autodetect) but NOT Alsa. It wouldn't hurt to put Arts in auto suspend mode. The second solution may produce noise. A sound server above kernel modules is enough already. Imagine now one sound server above another sound server above the modules. The most frequent "bugs" are that although all the applications may work, Kde Desktop operation sounds will be heard distorted. Music Applications - Links Kernel modules OSS ALSA Sound servers Arts EsounD Jack Interfaces-Plugins LADSPA DSSI Software synths Timidity FluidSynth Pure Data Desktop midi-audio recording systems-sequencers Rosegarden Muse Lmms All three have score, key-edit (pianoroll) and grid edit (event editor) capabilities. Music score-typesetters Noteedit Lilypond Lilypond is a command line music typesetter capable of exporting image, midi, pdf, postscript and Tex formats of a score made with a single text editor.. Various frontends Qjackctl Qsynth Denemo Denemo is a frontend to Lilypond. It provides a graphics interface to the command line program. Sound editors Audacity Kwave Music projects The Mutopia Project Musipedia That's it. More issues to come. Experimenting with the Jack Audio Server can not be avoided. Happy Music production to all. |