DSP(1) General Commands Manual DSP(1)

dsp - an audio processing program with an interactive mode

dsp [options] path ... [!] [:channel_selector] [@[~/]effects_file] [effect [args ...]] ...

dsp is an audio processing program with an interactive mode.

Show help text.
Set buffer size (must be given before the first input).
Set codec maximum buffer ratio (must be given before the first input).
Force interactive mode.
Disable interactive mode.
Disable progress display.
Silent mode.
Verbose mode.
Force dithering.
Disable dithering.
Don't drain effects chain before rebuilding.
Plot effects chain instead of processing audio.
Enable verbose progress display.
Use `sequence' input combining mode.

Output.
Type.
Encoding.
Big/little/native endian.
Sample rate.
Number of channels.
Equivalent to
-t null null.

For a complete list of supported input/output types, run

$ dsp -h

In concatenate mode (the default), the inputs are concatenated in the order given and sent to the output. All inputs must have the same sample rate and number of channels.

In sequence mode, the inputs are sent serially to the output like concatenate mode, but the inputs do not need to have the same sample rate or number of channels. The effects chain and/or output will be rebuilt/reopened when required. Note that if the output is a file, the file will be truncated if it is reopened. This mode is most useful when the output is an audio device, but can also be used to concatenate inputs with different sample rates and/or numbers of channels into a single output file when used with the resample and/or remix effects.

The sgen input type is a basic (for now, at least) signal generator that can generate impulses and exponential sine sweeps. The syntax for the path argument is as follows:

[type[@channel_selector][:arg[=value]...]][/type...][+len[s|m|S]]

type may be `sine' for sine sweeps or tones, or `delta' for a delta function (impulse). `sine' accepts the following arguments:

Frequency. If len is set and f1 is given, an exponential sine sweep is generated.

The arguments for `delta' are:

Offset in seconds, miliseconds or samples.

Example:

$ dsp -t sgen -c 2 sine@0:freq=500-1k/sine@1:freq=300-800+2 gain -10

Single-pole lowpass filter.
Single-pole highpass filter.
Double-pole lowpass filter.
Double-pole highpass filter.
Double-pole bandpass filter with constant skirt gain.
Double-pole bandpass filter with constant peak gain.
Double-pole notch filter.
Double-pole allpass filter.
Double-pole peaking filter.
Double-pole lowshelf filter.
Double-pole highshelf filter.
Linkwitz transform (see http://www.linkwitzlab.com/filters.htm#9).
Compact Disc de-emphasis filter.
Biquad filter.
Gain adjustment. Ignores the channel selector when the channel argument is given.
Multiplies each sample by multiplier. Ignores the channel selector when the channel argument is given.
Applies a DC shift. Ignores the channel selector when the channel argument is given.
Simple crossfeed for headphones. Very similar to Linkwitz/Meier/CMoy/bs2b crossfeed.
2-to-4 channel (2 front and 2 surround) active matrix upmixer designed for plain (i.e. unencoded) stereo material. The matrix coefficients and the main ideas behind the steering behavior come from David Griesinger's published works on matrix surround.

The intended speaker configuration is fronts at ±30° and surrounds between ±60° and ±120°. The surround speakers must be calibrated correctly in level and frequency response for best results. No frequency contouring or delay is done internally, so it is highly recommended to apply delay and lowpass_1 effects to the surround outputs:

matrix4 -6 :2,3 delay 15m lowpass_1 6k :
The settings shown above (-6dB surround level, 15ms delay, and 6kHz rolloff) are a good starting point, but may be adjusted to taste. The default surround_level is -6dB.

The front outputs replace the original input channels and the surround outputs are appended to the end of the channel list.

Options are given as a comma-separated list. Recognized options are:

Disable directional boost of front channels.
Show a status line (slightly broken currently, but still useful for debugging).
Toggle the effect when `effect.signal()' is called.
Select and mix input channels into output channels. Each channel selector specifies the input channels to be mixed to produce each output channel. `.' selects no input channels. For example,
remix 0,1 2,3
mixes input channels 0 and 1 into output channel 0, and input channels 2 and 3 into output channel 1.
remix -
mixes all input channels into a single output channel.
Convert stereo to mid/side.
Convert mid/side to stereo.
Delay line. The unit for the delay argument depends on the suffix used: `s' is seconds (the default), `m' is milliseconds, and `S' is samples.
Sinc resampler. Ignores the channel selector.
Non-partitioned 64-bit FFT convolution. Latency is equal to the length of the filter.
Non-uniform partitioned 64-bit FFT convolution. Runs slower than the zita_convolver effect, but potentially useful if you need more precision and/or lower latency. Latency is equal to min_part_len (16 samples by default). {min,max}_part_len must be powers of 2.
Simple FIR approximation of a Hilbert transform. The number of taps must be odd. Bandwidth is controlled by the number of taps.
Allpass decorrelator as described in ``Frequency-Dependent Schroeder Allpass Filters'' by Sebastian J. Schlecht (doi:10.3390/app10010187). Default number of stages is 5. The average group delay with the default settings is about 8.5ms at high frequencies.
Partitioned 32-bit FFT convolution using the zita-convolver library. Latency is equal to min_part_len (64 samples by default). {min,max}_part_len must be powers of 2 between 64 and 8192.
Add TPDF noise. The level argument specifies the peak level of the noise (dBFS).
Apply a LADSPA plugin. Supports any number of input/output ports (with the exception of zero output ports). Plugins with zero input ports will replace selected input channels with their output(s). If a plugin has one or zero input ports, it will be instantiated multiple times to handle multi-channel input.

Controls which are not explicitly set or are set to `-' will use default values (if available).

The `LADSPA_PATH' environment variable can be used to set the search path for plugins.

Display the DC offset, minimum, maximum, peak level (dBFS), RMS level (dBFS), crest factor (dB), peak count, peak sample, number of samples, and length (s) for each channel. If ref_level is given, peak and RMS levels relative to ref_level will be shown as well (dBr).

A `!' marks the effect that follows as `non-essential'. If an effect is marked non-essential and it fails to initialize, it will be skipped.

[[start][-[end]][,...]]

Example Description
<empty> all
- all
2- 2 to n
-4 0 through 4
1,3 1 and 3
1-4,7,9- 1 through 4, 7, and 9 to n

Suffix Description
q Q-factor (default).
s Slope (shelving filters only).
d Slope in dB/octave (shelving filters only).
o Bandwidth in octaves.
h Bandwidth in Hz.
k Bandwidth in kHz.

Note: The `d' width suffix also changes the definition of f0 from center frequency to corner frequency (like Room EQ Wizard and the Behringer DCX2496).

  • On the command line, relative paths are relative to `$PWD'.
  • Within an effects file, relative paths are relative to the directory containing said effects file.
  • The `~/' prefix will be expanded to the contents of `$HOME'.

  • Arguments are delimited by whitespace.
  • If the first non-whitespace character in a line is `#', the line is ignored.
  • The `\' character removes any special meaning of the next character.

Example:

gain -10
# This is a comment
eq 1k 1.0 +10.0 eq 3k 3.0 -4.0
lowshelf 90 0.7 +4.0

Effects files inherit a copy of the current channel selector. In other words, if an effects chain is this:

:2,4 @eq_file.txt eq 2k 1.0 -2.0

eq_file.txt will inherit the `2,4' selector, but any selector specified within eq_file.txt will not affect the `eq 2k 1.0 -2.0' effect that comes after it.

Read file.flac, apply a bass boost, and write to alsa device hw:2:

dsp file.flac -ot alsa -e s24_3 hw:2 lowshelf 60 0.5 +4.0

Plot amplitude vs frequency for a complex effects chain:

dsp -pn gain -1.5 lowshelf 60 0.7 +7.8 eq 50 2.0 -2.7 eq 100 2.0 -3.9
  eq 242 1.0 -3.8 eq 628 2.0 +2.1 eq 700 1.5 -1.0
  lowshelf 1420 0.68 -12.5 eq 2500 1.3 +3.0 eq 3000 8.0 -1.8
  eq 3500 2.5 +1.4 eq 6000 1.1 -3.4 eq 9000 1.8 -5.6
  highshelf 10000 0.7 -0.5 | gnuplot

Implement an LR4 crossover at 2.2KHz, where output channels 0 and 2 are the left and right woofers, and channels 1 and 3 are the left and right tweeters, respectively:

dsp stereo_file.flac -ot alsa -e s32 hw:3 remix 0 0 1 1 :0,2
  lowpass 2.2k 0.707 lowpass 2.2k 0.707 :1,3 highpass 2.2k 0.707
  highpass 2.2k 0.707 :

Apply effects from a file:

dsp file.flac @eq.txt

ladspa_dsp looks for configuration files in the following directories:

  • $XDG_CONFIG_HOME/ladspa_dsp
  • $HOME/.config/ladspa_dsp (if $XDG_CONFIG_HOME is not set)
  • /etc/ladspa_dsp

To override the default directories, set the `LADSPA_DSP_CONFIG_PATH' environment variable to the desired path(s) (colon-separated).

Each file that is named either config or config_<name> (where <name> is any string) is loaded as a separate plugin. The plugin label is either ladspa_dsp (for config) or ladspa_dsp:<name> (for config_<name>).

Configuration files are a simple key-value format. Leading whitespace is ignored. The valid keys are:

Number of input channels. Default value is 1. May be left unset unless you want individual control over each channel.
Number of output channels. Default value is 1. Initialization will fail if this value is set incorrectly.
Set `LC_NUMERIC' to the given value while building the effects chain. If the decimal separator defined by your system locale is something other than `.', you should set this to `C' (to use `.' as the decimal separator) or an empty value (to use the decimal separator defined by your locale).
String to build the effects chain. The format is the same as an effects file, but only a single line is interpreted.

Example configuration:

# This is a comment
input_channels=1
output_channels=1
LC_NUMERIC=C
effects_chain=gain -3.0 lowshelf 100 1.0s +3.0 @/path/to/eq_file

Relative file paths in the effects_chain line are relative to the directory in which the configuration file resides.

The loglevel can be set to `VERBOSE', `NORMAL', or `SILENT' through the `LADSPA_DSP_LOGLEVEL' environment variable.

Note: The resample effect cannot be used with the LADSPA frontend.

See https://github.com/bmc0/dsp/blob/master/README.md for usage examples.

No support for metadata.

Some effects do not support plotting.

This software is released under the ISC license.

dsp-1.9