|C*A P S||
the C* Audio Plugin Suite
Version 0.9.21 · February 2014
CAPS is a collection of audio plugins comprising virtual guitar amplification and a small range of essential classic effects, signal processors and generators of diverse and occasionally exotic nature.
The plugins aim to satisfy the highest demands in sound quality with maximal computational efficiency and zero latency*.
As a LADSPA[ladspa]wp library, CAPS is concerned with audio manipulation only and does not offer any sort of user interface. Thus, the software is in principle not bound to a particular operating system or architecture. However, most compatible host applications will be found on Linux systems.
Some features of CAPS are designed to make use of hardware-accelerated vector-4 arithmetic. The code can be compiled to run without hardware acceleration, but the resulting binary must be expected to be notably slower than equivalent code explicitly designed for scalar arithmetic would be.
CAPS for Electric Guitar
To produce a workable digital audio stream from an electric guitar, it is vital that the instrument is connected through a high-quality high-impedance input device.
The simplest recommended virtual amplification setup consists of
The Noisegate plugin may be of help too and is best placed at the very start of the processing chain.
Computational load is subject to changing with some parameter choices. For example, it will scale about linearly with the oversampling ratio where that is adjustable. In some cases, CPU load will also vary slightly with the character of the signal processed.
Oversampled plugins have a latency roughly equivalent to the size of the oversampling filters divided by the oversampling ratio. For example, 4x oversampling with 32-tap filters results in a latency of 8 samples.
All other plugins have a latency of zero unless noted otherwise.
The CAPS plugins can be run – and should sound roughly the same, except where noted – at any sample rate up to 192 kHz. The recommended range of operation however is at 44.1 or 48 kHz.
To prevent 'zipper' noise, some control inputs are smoothened by sweeping internal parameters. The duration of this sweep will vary with the audio system setup. For realtime use in most host applications it is equal to the audio processing block size (the 'frames per period' in jackd[jackd] terms). As a consequence, control adjustments recorded with a sequencer can result in subtle sound differences when played back with a different block size.
All plugins are extensively tested to verify that no denormal numberswp are produced. Naturally, these tests cannot exhaust all possible plugin parameter combinations. While regarded as unlikely, it is not impossible that an unfortunate combination of parameters or circumstances may still give rise to denormals.
#define LADSPA_PORT_GROUP 16
in the LADSPA_PortDescriptor array to denote ports which start a logical group.
Where applicable, unit designations are appended to control labels in parentheses following a single space character, for example "gain (dB)". Host applications might consider stripping the unit from the control's label and attaching it to the representation of its value, e.g. "gain: -6 dB".
CAPS Version Query
Regrettably, any part or feature of CAPS may change in new releases, sometimes even change drastically or be removed entirely, for the greater good of readily realisable improvements. In particular, it would be unwise to expect port ordering and naming to be consistent between releases.
Since version 0.9, applications relying on a particular release can query:
void * h = dlopen ("/path/to/caps.so", RTLD_LAZY); /* assuming h is valid */ const short * caps = (const short *) dlsym (h, "CAPS_version"); if (caps) printf ("found caps version %hd.%hd.%hd\n", caps, caps, caps);
Host applications are encouraged to use this information to form a persistent plugin identifier, should one be needed.
If you think you have found a bug in CAPS, or if you want to make a related or unrelated remark or inquiry please write to firstname.lastname@example.org.
Please do not send patches without asking first. By submitting a patch, you claim sole authorship and agree that your submission becomes mine to use in any way I see fit, in exchange for no obligation on my part except attribution in the CAPS documentation.
Attenuating hum and noise
This effect plugin attenuates the signal when it is deemed to be background noise.
The gate opens when the signal's instantaneous amplitude exceeds the opening threshold. The time it takes to reach maximum volume can be set with the attack control. As soon as the signal's RMS power level drops below the closing threshold, the gate closes. It takes a fixed time of 20 ms to reach the full attenuation of 60 dB.
To cope with powerline hum as often present in signals from electric guitars, a notch filter can be activated by selecting a non-zero mains frequency. The filter will prevent this frequency from contributing to the signal power measurement. This allows a lower closing threshold setting without mains hum keeping the gate open unduly. The default mains setting is 50 Hz.
Compressor and saturating limiter
Frequency response, default settings, fs=48 kHz
This compressor has been designed to create natural-sounding sustain for the electric guitar without sacrificing its brightly percussive character. However, if you can live with its idiosyncratic nature, it appears to apply well to a variety of other sound sources, and with CompressX2 a stereo version is available as well.
To be able produce strong compression and still maintain a natural sound, the design catches power spikes (as they often occur in the attack phase of musical sounds) with a soft saturation circuit, converting the extra energy into additional harmonic content and enforcing a strict limit on the output level. Saturating operation is the default setting of the mode control. Three anti-aliasing options are available, 2x oversampling with 32-tap filters and 4x with 64 and 128 taps.
The measure control select which indicator of loudness to base calculations on: peak – instantaneous amplitude – measurement allows the unit to react very quickly, while rms – root mean square power – is of a gentler kind.
Compression amount is controlled through the strength knob, from 0 effectively disabling the effect, up to a maximum ratio of 16:1. The attack and release controls map higher values to slower reactions.
Stereo compressor and saturating limiter
This stereo version of Compress applies uniform compression to both channels in proportion to their combined power.
Classic amplifier tone stack emulation
This emulation of the tone stack of a traditional Fender-design instrument amplifier has been devised and implemented by David T. Yeh[yeh06], with subsequent expansion to include more models by Tim Goetze.
Due to the nature of the original circuit, the bass, mid and treble controls are not operating independently as in a modern three-way equaliser.
All but the last model are using the procedural implementation with continuously updated direct form II filters and sample rate independency. Please note that the "DC 30" preset ignores certain differences in topology between the British and the Fender circuit.
The "5F6-A LT" model is using the lattice filter implementation mentioned in [yeh06], operating on simulation data precomputed for fs=44.1 kHz.
Idealised guitar amplification
Frequency response with default settings
Output for 250 Hz sine wave input, squash=0
Spectrum of the processed sine wave
Tracing the circuit stages of an idealised [resp. idolised] tube amplifier, this plugin aims to present a recreation of those features of traditional guitar amplification electronics that have proved musically useful, and to provide them with the most musical rather than the most authentic ranges of adjustment and character. CabinetIV provides matching recreations of loudspeaker cabinets.
The main components are – roughly in order, though some interconnections exist – a configurable lowcut input filter, a ToneStack circuit of the procedural variant, a saturating 'preamp' stage with adjustable gain and variable distortion asymmetry followed by the bright filter, compression characteristics determined by the attack and squash controls and finally a 'power amp' stage with the amount of saturation depending on both gain and power settings. In addition, the circuit contains additional filters which aren't configurable at runtime.
Sound quality and computational load can be balanced with the over control affording a choice of 2x or 4x oversampling with 32-tap filters, or 8x with 64 taps. Lower quality settings will sound slightly grittier and less transparent, and at high gain aliasing may become audible.
Idealised loudspeaker cabinet
Sample impulse response
Spectrum at fs=44.1 kHz
This plugin applies an acoustic instrument body modeling technique[bank07] to recreate the linear frequency response of an electric guitar amplifier's speaker cabinet. Nonlinear effects[yeh08][zol09] are not emulated; missing as well is the interplay of electrical circuit and loudspeaker.
A selection of several hundred frequency response approximations of recordings from classic cabinets was narrowed down to a handful of idealised tones. As with AmpVTS, which provides a matching recreation of traditional guitar amplification, the design and selection process has been ruled by musicality over fidelity.
The filter banks implemented are 64 2nd order IIR and one 128-tap FIR in parallel. Their parameter presets are shared between the 44.1 and 48 kHz sample rates, the higher rate implying that timbre brightens up. Higher sample rates produce the same tones by rate conversion, up to 192 kHz.
Despite the complexity, computational load is very modest thanks to vector arithmetic if a hardware implementation is available – if not, however, the load will be easily an order of magnitude higher and possibly found to be prohibitive.
Versatile plate reverb
Impulse response mixed to mono
This reverb processor is an adaptation of the design discussed in [dat97a]. Tuned for a soft attack and smooth ambience, it consists of a network of twelve delay lines of varying length. At its heart, two of these are modulated very subtly, in a chorus-like fashion.
The bandwidth control reduces high-frequency content before it enters the 'reverb tank' while damping controls how quickly the reverberating tail darkens.
Versatile plate reverb, stereo inputs
This version of the Plate reverberator comes with stereo inputs.
Various static nonlinearities, 8x oversampled
Output for 250 Hz sine wave input at 24 dB gain and bias 0.3
Spectrum of the above
Please note that this plugin embodies a very basic building block of audio DSP, not an elaborate effect that will be pleasing to hear right away. To turn saturation into a musically useful effect it is usually combined with some sort of filtering and dynamics modulation.
The mode control chooses from a selection of clipping functions of varying character. The "clip" preset results in what is usually called a limiter. "rectify" is a full-wave rectification function.
Even-order harmonics can be added with the bias setting. Towards the maximum, sound will start to get scratchy and eventually starve away.
The plugin is 8x oversampled with 64-tap polyphase filters, effectively suppressing aliasing noise for most musical applications. Changes to the bias control induce short-lived energy at DC in the output. In order to reduce the computational load incurred when evaluating transcendental functions at eight times the nominal sample rate, these are approximated roughly, using Chebyshev polynomials whose coefficients depend on the amplitude's floating point representation exponent.
Not an exciter
Harmonic synthesis for mixed 100 and 150 Hz sine input, note the appearance of the fundamental at 50 Hz
This effect plugin is useful when more bass register definition or more treble presence is called for and generic equalisation does not work without also emphasising noise or raising the signal's total level. A common application is refreshing of material that has been subjected to low-fidelity analog transmission.
Bass and treble portions of the signal are isolated using two 24 dB/octave Linkwitz-Riley crossover networks[lr76] to ensure a flat frequency response at zero effect intensity (controlled through the .gain settings). After compression, a polynomial waveshaper synthesises the first three overtones of the bass register. This enhances the perception of the fundamental frequency, being the difference tone of these harmonics, supported by the generation of additional overtones through intermodulation distortion. Treble band processing applies analog-style saturation with only marginal antialiasing measures. Synthesised harmonic content is shaped through bandpass and highpass filters and mixed back into the source sum out of the crossover.
A stereo version is available as SpiceX2.
Not an exciter either
A standard mono chorus with optional feedback. The parameter range suits subtle effects as well as all-out flanging.
Modifying the delay time t when feedback is active will cause audible 'zipper' noise.
This take on the classic effect features two modulation choices, traditional sine-based periodicity or smoothened fractal oscillation.
Very high resonance settings can cause self-oscillation peaking in excess of 0 dB.
Self-modulating resonant filter
A filter whose cutoff can be modulated by both The cutoff frequency can be modulated by both the input signal envelope and a fractal low-frequency oscillator. The default settings provide an automatic wah effect.
The total extent of cutoff modulation is set through the range parameter. The shape of the modulation is mixed from the LFO and the envelope according to the lfo/env balance.
The LFO speed is controlled by the rate parameter; the shape of its oscillation through x/z (waveform samples for the Lorenz attractor are shown with the Fractal plugin).
Stereo delay with chromatic resonances
A stereo delay with resonant filters and fractally modulated panning.
The delay times are set through the bpm control and the divider adjustment. Triplet and sixteenth settings create a dotted rhythm. With every beat, the filter resonance frequencies are retuned to random steps on an equal-tempered chromatic scale, to the reference set through the tune control.
A classic octave-band constant-Q second-order filter design, basically a direct digital translation of an analog original. There's also a stereo version (Eq10X2).
Frequency bands centered above Nyquist are automatically disabled.
Stereo 10-band equaliser
The controls of this stereo version of Eq apply to both channels.
4-band parametric equaliser
a.f=150 a.Q=.9 a.gain=4 b.Q=.5 b.gain=-24 c.f=1.2k c.Q=1 c.gain=-12 d.gain=24
Four adjustable biquad filters in series, in a vector arithmetic implementation. The default setup is an identity filter with a mode configuration of lowshelve, band, band, hishelve, all at zero gain.
The Q control value maps non-linearly to actual filter Q: a zero control value results in filter Q of ½, a value of 0.3 corresponds to a Butterworth-equivalent Q of ½√2, and the maximum control setting of 1 results in a filter Q of 50.
Parallelisation of the serial filter organisation causes the output to lag by three samples.
Control response is smoothened by crossfading between two filter banks.
Stereo image synthesis
Left and right output channels at maximum width
In addition to providing a basic panorama control, a perception of stereo width is created using complementary filters on the two output channels.
The output always sums to a flat frequency response.
The design of this plugin owes to the Orban 245F Stereo Synthesizer[orban93].
Stereo image width reduction
This plugin reduces the width of a stereophonic signal. Its primary use is for preventing fatigue from listening to 'creatively panned' music on headphones.
Mid/side processing tends to sound more transparent for moderate strength settings. However, it will more strongly attenuate signals that are panned to the far sides of the stereo image (rarely encountered in contemporary music production anymore but quite common, for example, on early Beatles recordings or others from that time).
Sine wave generator
The old friend, indispensable for testing and tuning.
Mostly white pseudonoise, mixed and filtered from the output of two Dattorro multibit generators[dat02].
Audio stream from deterministic chaos
lorenz, only x (y similar)
lorenz, only z
lorenz, default parameters
roessler, only x (y similar)
roessler, only z
roessler, default parameters
This plugin turns the oscillating state of a fractal attractor into an audio stream. The result is something that most would without much hesitation classify as noise.
The Rössler system[roessler76] is similar but contains only one non-linearity.
The x, y and z controls set the amplitude of the respective variables of the attractor state in the output audio signal.
The attractor state variables are scaled and translated to stay mostly within the [-1,1] range and not contain a DC offset. Nevertheless, due to the unpredictable nature of the systems, peak limits cannot be guaranteed. In addition, some energy near DC may be produced; therefore a configurable high-pass filter is part of the circuit. It can be turned off by setting the hp parameter to zero.
The output signal varies with the sample rate.
Spectrum of default click
A sample-accurate metronome. Two simplistic modal synthesis models are available for the click: box is a small wooden box struck with a soft wooden mallet, stick a scratchy stick hit. In addition, there's also a very synthetic beep, and finally dirac, a very nasty single-sample pulse of 0 dB amplitude and little immediate musical use.
All click sounds are synthesised once when the plugin is loaded and then played back from memory.
Chief Executive Oscillator
The Chief Executive Oscillator forever calls for more profit.
Sound data created with the flite[flite] application.
CAPS comes with no guarantees, in particular no guarantee of fitness for a particular purpose.
The library is available here in source code, under the terms of the
GNU Public License,
Many parts of CAPS are available for alternative licensing, please feel free to inquire.
To build from source code, a modern UNIX environment with the GNU C++ compiler[gcc] is required.
$ tar xfj caps_0.9.21.tar.bz2 $ cd caps-0.9.21 $ ./configure.py $ make $ sudo make install
On compatible Linux systems, configure.py enables the use of SSE instructions to provide hardware acceleration for vector arithmetic.OSX builds are configured to contain both 32- and 64-bit code. Prior to updating an installation, it is a good idea to issue
$ sudo make uninstall
in the directory containing the source to the previous installation.
0.9.21 * Eq10 Q increased * AmpVTS bright/compression/gain mappings adjusted * AutoFilter reverted to 0.9.1 version with adjusted parameters 0.9.20 * ToneStack ports rearranged (following "control before audio" convention) * ToneStack LT model selection fixed 0.9.19 * Noisegate partially rewritten, defaults adjusted * Noisegate bug causing spurious gain fluctuations in closed state eliminated * AmpVTS compression controls adjusted * influence of total gain on compression in AmpVTS reduced * documentation polish 0.9.18 * restored ToneStack presets to present the full list * AmpVTS 'bright' filter given slight resonance * AmpVTS compression control range widened 0.9.17 * multiple inclusion header guards changed to comply with ISO/IEC 9899:2011 (at the insistence of Markus Elfring) * PlateX2 fixed to read correct port for damping parameter (reported by James Morris) * uninstall removes rdf * DSP::FIR4f::set_kernel size overflow in default parameter fixed (reported and isolated by Ricardo Crudo) * AmpVTS "lowcut" filter changed from 2- to 1-pole * "HK 20" tonestack renamed to "AK 20" * AmpVTS lowcut mapping changed, default lowered * AmpVTS highpass 1 cutoff raised * lowpass filter added to Noisegate's opening peak detector * Noisegate not NoiseGate * Click normal addition limited to idle loop * NoiseGate logic loop bug fixed, hysteresis added * documentation polish 0.9.16 * NoiseGate simplified, sped up, gain lowpassed, click bug eliminated * Sin smoothened, defaults updated * PhaserII defaults updated * Fractal defaults updated * documentation polish 0.9.15 * no-vector-arithmetic compilation fixed 0.9.14 * AutoFilter x/y parameter eliminated * Fractal hp changed to be configurable, attractors recalibrated * DSP::Lorenz instantly initialises to useful state * documentation polish 0.9.13 * Eq4p softens drastic parameter changes by crossfading static filters * Eq4p employing single v4f filter, slightly quicker * Eq4p 'off' filter mode * documentation and interface polish 0.9.12 * non-SSE compilation fixed 0.9.11 * DSP::Roessler instantly initialises to useful state * Logarithmic port bounds and values fixed to reflect actual intent, affecting Spice, AutoFilter and ChorusI * clicking automatic gain fade on activate() eliminated in Saturate * Dirac merged into Click * Lorenz and Roessler merged into Fractal * JVRev removed * running plugins for zero frames returns without touching state * CabinetII and III removed * PhaserII sine LFO and LFO choice port added * PhaserII fractal modulation extensively revised * ChorusI rate lower bound slightly increased * ChorusI delay line length adjusted to accommodate full t+width range * all Chorus and Phaser plugins removed save for ChorusI and PhaserII * major documentation revision * Eq4p parametric equaliser plugin * RBJ shelving filter prototype implementation fixed * "2x2" stereo plugin label postfix changed to "X2" * Eq renamed Eq10 * SIMD implementation updates * DSP::RBJ coefficient calculation rearranged * Click bpm range changed, default lowered substantially 0.9.10 * DSP::RMS protected against negative sum of squares * documentation updates 0.9.9 * OSX compilation configuration refinements 0.9.8 * Spice enabled by default, Spice2x2 added * AmpVTS default oversampling ratio changed to 4x * JVRev refinements * Cabinet gain upper limit reinstated to 24 dB * AutoFilter modulation slightly adjusted * more *ChorusII modulation smoothness * 1st-order IIR lp set_f fix part 2 * 1st-order IIR lp set_f fix part 1 * 1st order low-pass for AutoFilter modulation LFO * DelayTapA removed * README updated * Click 'stick' sound brightened * moved processor_specific_denormal_measures() to activate(), speedup 0.9.7 * ChorusI is back * AutoFilter modulation range and default parameter updates 0.9.6 * Click fixed to compile by older g++ versions 0.9.5 * AmpVTS model port moved, renamed to the more apt 'tonestack' * documentation refinements * appreciable AmpVTS speedup by going back to sample_t for accumulator * NoiseRatio attack time control * sample rate dependencies in NoiseGate removed, time constants revised * Tonestacks reordered * Plugin::over_fs * AmpVTS model setting fixed to follow the correct input * CabinetIII resurrected * AmpVTS 'ratio' port renamed to 'over' * more filters for AutoFilter, ladder stage gain control * AutoFilter oversampling * AmpVTS bias in poweramp, dcblock before output * AutoFilter envelope calculation fixed for fs > 153.6 kHz * peak/rms selection for Compress * AmpVTS tuning 0.9.4 * AmpVTS bright mapping revised * Compress hi-pass removed * Compress saturation changed from tanh to atan * beep wave for Click * selectable oversampling ratio for Compress in saturating mode * fixed Compress to apply gain before saturation * replaced sample_func_t with the more apt yield_func_t * minor cosmetics * caps-doc is a separate package * selectable wave for Click, parfiltmodel added * further smoothened ChorusII modulation * selectable oversampling ratio for Amp * moved some compress setup calls from Amp's run() to activate() * rdf target prerequisite for dist * Eq Q fixed, flat response at 0 gain 0.9.3 * Smoother modulation for ChorusII * AmpVTS filters retuned * correction for ToneStack gain in AmpVTS * ToneStack models reordered, 'wookie', 'porky', 'HK 20', 'nihon ace' models added * Amp 'bias' now a filtered function of output power, control removed * division operation in 1st-order hipass setup replaced by multiplication * Saturate gain = 0 dB in 'bypass' mode * Saturate 'rectify' mode * AmpVTS, Plate control mapping adjusted 0.9.2 * included dsp/polynomials.cc in the tarball
References and Acknowledgements
I would like to thank David T. Yeh for the ToneStack contribution and related discussion, and express my gratitude to Sampo Savolainen, Klaus Tenner, Fons Adriaensen, Pete Leigh, Paul Davis, Paul Winkler, Ricardo Crudo, Damon Chaplin, Jonathan Liles, James Morris and Niclas Wretström for bug reports, fixes or related discussion, and to:
"Direct Design of Parallel Second-Order Filters for Instrument Body Modeling",
Jon Dattorro, "Effect Design Part III: Oscillators: Sinusoidal and Pseudonoise",
Jon Dattorro, "Effect Design Part I: Reverberator and Other Filters",
Jon Dattorro, "Effect Design Part II: Delay-Line Modulation and Chorus",
"flite: a small simple speech synthesizer",
Richard Stallman and contributors,
Thomas Williams, Colin Kelley and many others,
Steve Hollasch, "IEEE Standard 754 Floating Point Numbers", 2005
Paul Davis and contributors,
Richard W.E. Furse, Paul Barton-Davis, Stefan Westerfeld,
Edward N. Lorenz, "Deterministic Nonperiodic Flow",
Siegfried Linkwitz, "Active Crossover Networks for Noncoincident Drivers",
John W. Eaton and contributors,
Guido van Rossum and collaborators,
"Cookbook formulae for audio EQ biquad filter coefficients",
O.E. Rössler, "An Equation for Continuous Chaos",
Sean Eron Anderson, "Bit Twiddling Hacks",
Laurence W. Nagel and D.O. Pederson,
"SPICE (Simulation Program with Integrated Circuit Emphasis)",
Perry R. Cook and Gary P. Scavone,
Steve W. Harris,
D.T. Yeh and J.O. Smith,
"Discretization of the '59 Fender Bassman Tone Stack",
D.T. Yeh, B. Bank, and M. Karjalainen,
"Nonlinear modeling of a guitar loudspeaker cabinet",