Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Home Recording With Linux: Edward Diehl

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Home Recording

with Linux
Edward Diehl
Overview
● Linux professional audio has become quite mature and
powerful and is developing rapidly.
● There are many excellent open source (and a few
closed/commercial) applications available.
● Studio hardware is being replaced by software, greatly
reducing costs (especially if you use free software...)
● Many professional audio interfaces are supported (though
not as many as one might like).
● There is a fairly long learning curve required to use a lot of
the software, however (not entirely a Linux-specific issue).

My “wbar” launcher wih many audio applications


What can you do? A lot.
Free Software Native Non-Free
● Edit/modify sound files: Audacity, mhwaveedit
● Multitrack recording (to hard disk), mixing, mastering with Digital Audio
Workstations (DAW): Ardour2/3, Qtractor, Rosegarden, Muse,
ecasound/NAMA (command line!), Mixbus
● MIDI sequencing: Ardour3, Rosegarden, OOMidi, Muse, Seq24, Hydrogen,
LMMS, Sunvox, Renoise
● Play virtual instruments/synthesizers with a midi keyboard: Linuxsampler,
Yoshimi, Aeolus, Bristol, Phasex, Pianoteq, Aspect, Discovery
● Write musical scores (+playback): Musescore, Denemo, Frescobaldi,
Lilypond, Impro-visor, Rosegarden, GuitarPro
● Play guitar with amp emulation and effects processing: Guitarix, Rakarrak
● Algorithmic music composition: Csound, Supercollider, Pure Data
● Lots of other stuff: tuners, loopers, arpeggiators, DJ software (Mixxx), radio
station software (Rivendell), Jamin mastering tool, many effects plugins...
● Can run some Windows music software via wine/wine-asio
Digital Audio
Analog Sound Digital Sound
Pulse Code

Modulation (PCM)

● Sound is digitized by sampling (measuring) the analog wave form at some


frequency, a process called Pulse Code Modulation (PCM).
● Common sampling frequencies are 44.1kHz (CD audio), 48kHz (DVD audio)
and multiples (88.2, 96, 192 kHz).
● For playback digitized sound is sent through filters which restores frequency
content up to ½ the sampling frequency, e.g. 44.1kHz works up to 22.05 kHz.
The human hearing range is 20-20kHz.
● The sampled pulse heights are stored with various resolutions (“sample
depths”), e.g. 16 bit (CD audio), 24 bit, 32 bit floating point. Humans are
sensitive to dynamic ranges up to ~20bits.
● There are many formats for sound files which are either exact (e.g. wav, flac)
or lossy (compressed by removing “inaudible content”, e.g. mp3, ogg, AAC)
MIDI: Musical Instrument
Digital Interface
● MIDI is a system for interconnecting musical devices and
storing musical data.
● MIDI has only information about notes being played, not actual
sound. MIDI messages describe:
● Which note is playing (“middle C”)
● Start and stop times of a note
● Volume of note, called “velocity” which has values between [0..127]
● Lots of other information possible, messages, control information...
● To make sound MIDI information must be sent to hardware or
software which generates the sound based on the MIDI data.
● Nearly all electronic keyboards will transmit/receive MIDI via USB or
special MIDI cables.
● MIDI data is easily edited, manipulated (e.g. transposed), and
compact.
● Composing/recording is done with midi “sequencers”.
MIDI

Standard MIDI cable

Simple MIDI setup:


Qtractor “Pianoroll” midi editor Midi piano “controller” 
Computer  software synthesizer 
headphones.

MIDI data print out


Audio Interfaces
● Serious recording may require a better soundcard to provide more input/output channels (with
1/4” and/or XLR mic jacks), high quality AD/DA converters, MIDI connectivity, pre-amps,
hardware mixing, ...
● There are Linux drivers for a many cards, but far from all. Investigate capability carefully before
buying.
● ALSA provides drivers for PCI, USB cards. Check ALSA webpage for support.
● For USB there are several audio standards supported by Linux:
● USB1.1 = Excellent support, but only 2 channel recording possible (due to USB bandwidth limitations)
● USB2 = Standard supported (kernel ≥ 2.6.34) but not used by all USB2 cards!
● FFADO supports firewire. Check FFADO webpage for supported cards.
● Check also: http://apps.linuxaudio.org/wiki/current_audio_gear
● Also recommended: studio monitors, good headphones. microphones, $$$ ..

Focusrite Saffire Pro24 (firewire)

1/4”/XLR Preamp Output MIDI More 1/4”


inputs gain Volume Input/outputs
Linux Audio Distributions
● Any Linux distribution can be used for audio work, but
some configuration tweaking is recommended – see
http://wiki.linuxmusicians.com/doku.php?id=system_configuration
● I recommend using a dedicated linux audio distro:
optimizations already done & these provide lots of music
applications (several of which should be compiled from
development versions for newest features [firewire+linuxsampler])
– AVLinux (my favorite), Debian-based
– Ubuntu-based: Dreamlinux, TangoStudio, Ubuntu+kxstudio ppa or
Ubuntu studio. (straight Ubuntu not especially recommended)
– Arch or Gentoo + ProAudio overlay
– Fedora + CCRMA repositories
– Dyne-bolic, RemixOS, Musix, puredyne, PuppyStudio.
GNUGuitarINUX, 64Studio, Apodio ….
Linux Sound
● The Linux sound infrastructure is a bit complicated.
Linux ● The hardware drivers are supplied by ALSA (PCI,
sound
USB) or FFADO (firewire). It is possible to interact
layers
with ALSA directly, but then only one process can use
audio at a time.
● On top of the driver level several “sound”
servers/APIs are available to provide higher-level
access to sound functions – for sharing,
interconnecting audio devices, streaming audio, etc

● The JACK sound server is the best choice for professional audio. It provides:
● Works with any soundcard which has an ALSA or FFADO driver.
● Easily configured, low latency access to audio/midi hardware
● Interconnection of audio/midi applications – applications define input/output ports which
can be easily connected to each other.
● Methods for synchronizing audio applications (even over the network)
● Jack represent a unique strength for Linux audio.
● But, Jack may be confusing at first and may conflict with PulseAudio/other servers
which are trying to access the same hardware.
Command Line Audio
Just a sampling...
Alsa (lots of comands beginning with “a”)
– aplay: play sound files, list Alsa output devices
– arecord: record sound , list Alsa input devices
– amidi: send midi commands to Alsa midi devices
– alsamixer: mixer to configure Alsa soundcards
– aconnect:: create connection between Alsa apps.
– $HOME/.asoundrc: ALSA config file, optional, powerful, and arcane

Jack (lots of comands beginning with “jack”)


– jackd: start Jack sound daemon
– jack_lsp: list Jack ports
– jack_connect: connect Jack audio/midi ports
– aj2midid: create bridge between Jack/Alsa midi
– aj-snapshot save/restore all current Jack connections

Misc
– ecasound, sox, snd, sndfile-XXX: => other sound-related programs
Jack Sound Server
● Jack can be controlled by several GUI applications: QjackCtl, Cadence,
Patchage, ladish...
● To complicate matters Jack comes in 2 flavors, Jack1 and Jack2, which are
functionally equivalent. A given distro will use one or the other.
● Also, both Jack and Alsa can control MIDI. These can be used at the same
time and interconnected using the aj2midid program.
● Jack must be started before any music applications. The sample rate and
latency can be configured.
● Latency refers to the time delay in processing sound. Latencies above
~10ms are noticeable so for realtime music production (playing midi
keyboard, adding overdubs) it is desirable to have low latency. At low
latencies buffer over/under runs may occur (“xruns”) resulting in audio
glitches. A lot of time can be spent optimizing to avoid xruns...
● Many people suggest removing PulseAudio because it often interferes with
Jack. But there is a Pulse-to-Jack bridge which can also be used.
● Lets look how to configure Jack with QJackCtl
QJackCtl
● QjackCtl is used to stop/start Jack, monitor
Xruns, and make audio/midi connections
between applications. Device setup

Start/Stop Jack Server Xruns

Open audio/midi Jack synchronization


Connection panel
Save/restore setup

Choose sample rate and other parameters.


Latency = (Frames/period)*(period/buffer)
(sample rate)
QJackCtl setup for MIDI Piano
QjackCtl Audio Tab: Connect Pianoteq
Output to system out (speakers)
Setup: Connect midi Drag mouse to make connections
Keyboard to my
Firewire interface and
Play using the program
Pianoteq (c.f. Slide 6)

QjackCtl (Jack) Midi Tab: Connect


firewire (keyboard)
To Pianoteq midi input.

Pianoteq: Nonfree Piano


Emulation program
Audio Plugins
● Plugins provide additional audio processing such as
adding reverberations, equalization, … others provide
virtual instruments played via midi.
● Plugins may be added to DAW tracks or run in
standalone “hosts” (Jackrack, LV2Rack, CalfRack, Carla,
Festige). Support varies by program.
● Linux supports several plugin standards:
● Ladspa – oldest, no native GUI (generated by host)
● DSSI – For virtual instruments, now deprecated
● LV2 – Newest, supports GUI, for both effects and instruments
● Linux VST – native Linux version of Windows plugin standard.
Certain licensing headaches apply.
● Windows VSTs – Many Windows VSTs work with
Wine+FST/festige or dssi_vst.
Plugin Exmples
a few random selections from hundreds available...
IR – Impulse Response Reverb (LV2)
TAP Chorus/Flanger (Ladspa)

LinuxDSP Equalizer (LV2-Nonfree)

Invada Compressor (LV2)

Calf Monosynth (LV2 instrument)


Audacity
● Audacity is a very capable audio file editor support multitrack
editing/recording. Jack support is modest, so use standalone.
● Has builtin plugins + LADSPA support
● Is a good choice for podcasts, simple music editing, phono to CD
conversion (good noise reduction plugin).
● Good website and several books provide excellent documentation

● Audacity with a stereo


music file loaded.
● One region is highlighted

(by selecting with a mouse)


● Can apply an effect to

the highlighted region


using the “Effect” menu.
● Can cut and paste waveform

to edit audio.

Ardour
Ardour is an excellent, full-featured DAW, more capable (but far more complicated) than Audacity.
● Do multitrack recording, mixing, mastering. Supports Ladspa, LV2, LinuxVST, Windows VST plugins.
Effects can also be added by using Jack to connect tracks to external software or hardware.
● 3 flavors: Ardour2 – stable, audio-only, Ardour3: development version adding midi support,
Mixbus: Non-free version of Ardour2, with built-in high quality plugins from Harrison Consoles.
● Can do movie soundtracks when used with xjado (Jack used to synchronize audio/video)
● Nice tutorial: http://en.flossmanuals.net/ardour

Plugin

Ardour3
Supports Midi track
Audio
And midi
Recording,
Unlimited
Tracks, Audio track
Many plugins
GuitarIx & Rakarrack
● Guitarix & Rakarrack are 2 different programs for amp emulation
and guitar effects processing.
● In each you can build a “rack” of amps and effects and create a
wide variety of sounds.
● Can be used for live play with a guitar or as “inserts” in Ardour/other
DAWs to do effects on pre-recorded guitar.
Guitarix Rakarrack
Jack Connections with Guitarix & Ardour
● Setup: Record 2 guitar tracks in Ardour– one track has effects from Guitarix, one is “dry”.
● Jack connections become much more complicated. QjackCtl can store complicated
routing in it “Session” panel.

QjackCtl Jack Audio connections


Routing is somewhat complicated
Ardour with “wet” and
“dry” guitar tracks
Make some Sounds:
LinuxSampler & Yoshimi
● Linuxsampler plays samples – prerecorded notes from real instruments.
Supports sound formats: Gigasampler, SoundFont, and SFZ. Free and
non-free samples are available in these formats.
● Yoshimi is a capable synth with a wide sound range, and highly
configurable. Based on another synth, ZynAddSubFX, but with better
Jack support.
Hydrogen Drum Machine
● Hydrogen a sequencer for drum sounds (or any
sound you load into it). It also can be triggered
by external midi input from another program or
midi keyboard.
LMMS: Linux Multimedia Studio
● LMMS is an “all in one” music creation program with song editor, beat editor,
piano-roll sequencer, mixer, effects, similar to “Fruity-loops” on Windows.
Resources
● Documentation is perhaps not Linux's strong suit so it can be frustrating
getting started. Much can be learned forums, blogs, email lists.
● Most distros/applications have websites (some with help forums)
● Youtube can be helpful see especially http://filmsbykris.com/wordpress/
● Recommended websites
● Good forum: http://www.linuxmusicians.com/
● Linux audio email lists: http://linuxaudio.org/
● Good blogs:
– http://linuxhomerecording.blogspot.com
– http://wootangent.net/
● Compendium of linux sound software: http://linux-sound.org/
● Dave Phillip's excellent Linux Journal articles on linux audio:
http://www.linuxjournal.com/users/dave-phillips
● Fedora Musicians Guide (mostly applies to any distro)
http://docs.fedoraproject.org/en-US/Fedora/14/html/Musicians_Guide/index.html
Conclusions
● Linux is a highly capable music production platform with a wide
variety of software available.
● It offers usual Linux strengths of great
configurability/customizablity some great free software but also
the typical weaknesses of modest documentation, and little
commercial support.
● The Jack Audio Server is a particular strength of Linux Audio
since it permits easy interconnections of audio applications (it is
the “pipe” of audio). You can easily connect hardware, synths,
DAWs, effects...
● Linux audio community is small but enthusiastic and it is
possible in interact directly with developers.
● Happy recording!...

You might also like