|C*A P S||
the C* Audio Plugin Suite
Version 0.9.26 · October 2018
CAPS is a collection of audio plugins comprising basic virtual guitar amplification and a small range of classic effects, signal processors and generators of mostly elementary and occasionally exotic nature.
The plugins aim to combine the highest sound quality with computational efficiency and zero latency*.
Being a LADSPA[ladspa]wp library, CAPS is concerned with audio manipulation only and does not offer any sort of user interface. Thus, it 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 (as usually present on contemporary x86-compatible hardware). The code can be compiled to run without hardware acceleration (most ARM platforms do not offer this feature), but the resulting binary must be expected to be slower than equivalent code explicitly designed for scalar arithmetic.
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-impedance input device. Most USB audio interfaces do not fall into this category, regardless of their being sold specifically as "guitar interfaces".
Connecting an electric guitar with passive pickups to a low-impedance input will limit the resonance of the pickups and cut high-frequency content. The result is a muddy tone with little definition that is unfit for further processing.
The simplest recommended virtual amplification setup consists of
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 theoretical latency of zero; however, the oversampling filters exhibit pre-ringing leading into a peak-to-peak latency roughly equivalent to the size of the filter kernel size divided by the oversampling ratio. For example, 4x oversampling with 32-tap filters results in a peak delay of 8 samples.
All other plugins have a latency of zero unless noted otherwise.
The recommended range of operation is 44.1 or 48 kHz. Some plugins may not operate as expected, or not operate at all, at different sample rates.
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. It is not impossible that an unfortunate combination of parameters and signal 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 email@example.com.
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 originally been designed to create more vocal-like sustain for the electric guitar without sacrificing its brightly percussive character. However, 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 the power spikes that frequently occur in the attack phase of musical sounds with a soft saturation circuit, enforcing a strict limit on the output level and converting any extra energy into additional harmonic content. Saturating operation is the default setting of the mode control. Two anti-aliasing options are available, 2x oversampling with 32-tap filters and 4x with 64 taps.
The measure control selects 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.
The amount of compression is controlled through the strength knob, from 0 effectively disabling compression (without touching the saturating/limiting capability though), up to a maximum ratio of 16:1. The attack and release controls map higher values to slower reaction.
The current gain reduction is written to the plugin's state output.
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 models are using the procedural implementation with continuously updated direct form II filters and sample rate independency. Please note that the "DC 30" model ignores certain differences in topology between the British and the American circuits.
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, a saturating 'preamp' stage with adjustable gain and variable distortion asymmetry followed by the bright filter, extra compression controlled by the attack and squash parameters and finally a 'power amp' stage with the amount of saturation depending on both gain and power settings.
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.
Simplistic loudspeaker cabinet emulation
A loudspeaker cabinet emulation far less demanding than the recommended CabinetIV. Implemented as two sets of 31st-order IIR filters precomputed (using Prony's method) for fs of 44.1 and 48 kHz.
The appropriate filter set is selected at runtime. The alt switch allows the selection of the same filter model for the alternative sample rate; at 48 kHz the alternative will sound slightly darker, at 44.1 slightly brighter. At other sample rates, the plugin will not sound very much like a guitar speaker cabinet.
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 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
Mixed 100 and 150 Hz sine wave input, lo.gain = 0
Harmonic synthesis for mixed 100 and 150 Hz sine input at default lo.gain, 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, further 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.
High gain settings can easily produce unpleasant booming and scratching sounds for loud input signals. Use with care.
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.
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 input signal envelope and a fractal low-frequency oscillator. The default settings provide an automatic wah effect. The filter output is routed through a soft saturation effect, an emulation of the behaviour of similar analog hardware.
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 is controlled by the rate and shape parameters (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.
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 shelving 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 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. High-Q resonance may cause the filter to oscillate audibly regardless of the gain setting.
Parallelisation of the serial filter organisation causes the output to lag by three samples.
Control response is smoothened by crossfading between two filter banks, but it's not as smooth as that provided by EqFA4p.
4-band parametric eq
24 dB gain at 120 Hz with minimum bandwidth
Four Mitra-Regalia peaking equaliser filters in series; a vector arithmetic re-implementation of Fons Adriaensens "Parametric1" equaliser[fafil] with minor differences.
Parallelisation of the serial filter organisation causes the output to lag by three samples.
The bw control sets the bandwidth of a single filter, lower values corresponding to increasing resonance.
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. Through the div parameter, additional clicks for eighth, eighth-triplet, and sixteenth notes can be generated.
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,
Please feel free to inquire in case you'd prefer a different licensing agreement.
To build from source code, a modern UNIX environment with the GNU C++ compiler[gcc] is required.
$ tar xfj caps_0.9.26.tar.bz2 $ cd caps-0.9.26 $ ./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.26 * documentation updates * DDDelay removed, needs more work 0.9.25 * potential gcc overoptimisation resulting in NaN in Kaiser window setup eliminated (fix contributed by Jean Pierre Cimalando) * updated to reflect changes to the div() and pow10f() functions in libc * tonestack coefficient update reverted to original Yeh implementation * Compress default measurement mode switched to RMS, attack range doubled * Compress power and gain filter cutoff lowered to lessen intermodulation distortion * Plate defaults changed * volume control added to Spice hi and lo circuits, max gain reduced on both * Wider output channels swapped * AutoFilter rate lowered * Scape parameters cleaned up and remapped, tune control removed * Noisegate hysteresis increased to 180 ms * dc-30 tonestack R3 20k -> 10k * Eq10 Q changed to render optimally flat response at all zero band gain settings * div port added to Click * new plugin DDDelay 0.9.24 * documentation updates including switch to 48k for all spectra * "twin" and "stanford" tonestack models swap places * ChorusI feedback changed to interpolation, softens zipper noise on t changes * use vestigial FPTruncateMode only on pre-SSE2 hardware * 4x128 oversampling option removed from Compress plugins * state port displaying current gain reduction on Compress plugins * _latency port for parallel Eq * Saturate fade-in bug eliminated * Noisegate hysteresis interval lengthened * Click sounds "stick" brightened and "beep" shortened * run_adding() removed, reducing binary size by 30 % and compile time similarly * JVRev tail modified, low-passed * all ports reordered to consistent ctrl i/o audio i/o order * Eq4p crossfade reimplemented as equal-power squared cosine, smoother now * EqFA4p added * non-SSE v4f_shuffle surrogate fixed (fixes Eq4p on ARM, reported by Jens Dreske) * dropped 44.1 kHz ToneStackLT * OnePole header renamed IIR1, filters renamed LP1 and HP1 * BiQuad header and filter renamed IIR2, SIMD *4f filters renamed *v4 * CabinetIII (less demanding loudspeaker emulation resurrected again) * ChorusI port ranges and defaults adjusted * Compress parameter mappings and defaults adjusted 0.9.23 * ChorusI hp filter denormal protection added 0.9.22 * ChorusI blend behaviour changed * ChorusI parameters adjusted * ChorusI hp filter before delay added * AutoFilter parameters adjusted * AutoFilter 'range' port becomes 'depth' 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
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, Jens Dreske, Jean Pierre Cimalando, Damon Chaplin, Jonathan Liles, James Morris, Felipe Sateler, 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",