{"id":13573719,"url":"https://github.com/bmc0/dsp","last_synced_at":"2025-10-22T06:31:59.856Z","repository":{"id":48449086,"uuid":"11652859","full_name":"bmc0/dsp","owner":"bmc0","description":"An audio processing program with an interactive mode.","archived":false,"fork":false,"pushed_at":"2024-10-19T06:02:40.000Z","size":1042,"stargazers_count":221,"open_issues_count":7,"forks_count":31,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-19T09:58:24.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmc0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-25T05:43:35.000Z","updated_at":"2024-10-16T12:03:11.000Z","dependencies_parsed_at":"2024-06-07T03:45:00.963Z","dependency_job_id":"9ea1f992-c529-47a1-8698-5bf739e73342","html_url":"https://github.com/bmc0/dsp","commit_stats":{"total_commits":375,"total_committers":4,"mean_commits":93.75,"dds":0.008000000000000007,"last_synced_commit":"58a9d0c1f99f2d4c7fc51b6dbe563447ec60120f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc0%2Fdsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc0%2Fdsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc0%2Fdsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc0%2Fdsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmc0","download_url":"https://codeload.github.com/bmc0/dsp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247179757,"owners_count":20897095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:40.191Z","updated_at":"2025-10-22T06:31:59.849Z","avatar_url":"https://github.com/bmc0.png","language":"C","readme":"### About\n\ndsp is an audio processing program with an interactive mode.\n\n### Building\n\n#### Dependencies\n\n* GNU Make\n* pkg-config\n\n#### Optional dependencies\n\n* fftw3: For `resample`, `fir`, `fir_p`, and `hilbert` effects.\n* zita-convolver: For the `zita_convolver` effect.\n* libsndfile: For sndfile input/output support (recommended).\n* ffmpeg (libavcodec, libavformat, and libavutil): For ffmpeg input support.\n* alsa-lib: For alsa input/output support.\n* libao: For ao output support.\n* libmad: For mp3 input support (disabled by default).\n* libpulse-simple: For PulseAudio input/ouput support.\n* LADSPA: For the LADSPA frontend and the `ladspa_host` effect.\n* libltdl (libtool): For the `ladspa_host` effect.\n\n#### Build\n\n\t$ make\n\nRun `./configure [options]` manually if you want to build with non-default\noptions. Run `./configure --help` to see all available options.\n\n#### Install\n\n\t# make install\n\n### Synopsis\n\n\tdsp [options] path ... [effect [args]] ...\n\n### Options\n\n#### Global options\n\nFlag        | Description\n----------- | --------------------------------------------------------------------------\n`-h`        | Show help text.\n`-b frames` | Block size (must be given before the first input).\n`-i`        | Force interactive mode.\n`-I`        | Disable interactive mode.\n`-q`        | Disable progress display.\n`-s`        | Silent mode.\n`-v`        | Verbose mode.\n`-d`        | Force dithering.\n`-D`        | Disable dithering.\n`-E`        | Don't drain effects chain before rebuilding.\n`-p`        | Plot effects chain magnitude response instead of processing audio.\n`-P`        | Same as `-p`, but also plot phase response.\n`-V`        | Verbose progress display.\n`-S`        | Use \"sequence\" input combining mode.\n\n#### Input/output options\n\nFlag              | Description\n----------------- | -----------------------------\n`-o`              | Output.\n`-t type`         | Type.\n`-e encoding`     | Encoding.\n`-B/L/N`          | Big/little/native endian.\n`-r frequency[k]` | Sample rate.\n`-c channels`     | Number of channels.\n`-R ratio`        | Buffer ratio.\n`-n`              | Equivalent to `-t null null`.\n\n### Inputs and Outputs\n\n#### Supported input/output types\n\nType    | Modes | Encodings\n------- | ----- | -------------------------------------------------------------------------------------\nnull    | rw    | sample_t\nsgen    | r     | sample_t\nsndfile | r     | autodetected\nwav     | rw    | s16 u8 s24 s32 float double mu-law a-law ima_adpcm ms_adpcm gsm6.10 nms_adpcm_16 nms_adpcm_24 nms_adpcm_32 g721_32 mpeg2.3\naiff    | rw    | s16 s8 u8 s24 s32 float double mu-law a-law ima_adpcm gsm6.10 dwvw_12 dwvw_16 dwvw_24\nau      | rw    | s16 s8 s24 s32 float double mu-law a-law g721_32 g723_24 g723_40\nraw     | rw    | s16 s8 u8 s24 s32 float double mu-law a-law gsm6.10 vox_adpcm nms_adpcm_16 nms_adpcm_24 nms_adpcm_32 dwvw_12 dwvw_16 dwvw_24\npaf     | rw    | s16 s8 s24\nsvx     | rw    | s16 s8\nnist    | rw    | s16 s8 s24 s32 mu-law a-law\nvoc     | rw    | s16 u8 mu-law a-law\nircam   | rw    | s16 s32 float mu-law a-law\nw64     | rw    | s16 u8 s24 s32 float double mu-law a-law ima_adpcm ms_adpcm gsm6.10\nmat4    | rw    | s16 s32 float double\nmat5    | rw    | s16 u8 s32 float double\npvf     | rw    | s16 s8 s32\nxi      | rw    | dpcm_8 dpcm_16\nhtk     | rw    | s16\nsds     | rw    | s16 s8 s24\navr     | rw    | s16 s8 u8\nwavex   | rw    | s16 u8 s24 s32 float double mu-law a-law\nsd2     | rw    | s16 s8 s24 s32\nflac    | rw    | s16 s8 s24\ncaf     | rw    | s16 s8 s24 s32 float double mu-law a-law alac_16 alac_20 alac_24 alac_32\nwve     | rw    | a-law\nogg     | rw    | vorbis opus\nmpc2k   | rw    | s16\nrf64    | rw    | s16 u8 s24 s32 float double mu-law a-law\nsf/mpeg | rw    | mpeg1.1 mpeg1.2 mpeg2.3\nffmpeg  | r     | autodetected\nalsa    | rw    | s16 u8 s8 s24 s24_3 s32 float double\nao      | w     | s16 u8 s32\nmp3     | r     | mad_f\npcm     | rw    | s16 u8 s8 s24 s24_3 s32 float double\npulse   | rw    | s16 u8 s24 s24_3 s32 float\n\n#### Input combining modes\n\nIn concatenate mode (the default), the inputs are concatenated in the order\ngiven and sent to the output. All inputs must have the same sample rate and\nnumber of channels.\n\nIn sequence mode, the inputs are sent serially to the output like concatenate\nmode, but the inputs do not need to have the same sample rate or number of\nchannels. The effects chain and/or output will be rebuilt/reopened when\nrequired. Note that if the output is a file, the file will be truncated if it\nis reopened. This mode is most useful when the output is an audio device, but\ncan also be used to concatenate inputs with different sample rates and/or\nnumbers of channels into a single output file when used with the `resample`\nand/or `remix` effects.\n\n#### Signal generator\n\nThe `sgen` input type is a basic (for now, at least) signal generator that can\ngenerate impulses and exponential sine sweeps. The syntax for the `path`\nargument is as follows:\n\n\t[type[@channel_selector][:arg[=value]...]][/type...][+len[s|m|S]]\n\n`type` may be `sine` for sine sweeps or tones, or `delta` for a delta function\n(impulse). `sine` accepts the following arguments:\n\n* `freq=f0[k][-f1[k]]`\n\tFrequency. If `len` is set and `f1` is given, an exponential sine sweep\n\tis generated.\n\nThe arguments for `delta` are:\n\n* `offset=time[s|m|S]`\n\tOffset in seconds, miliseconds or samples.\n\nExample:\n\n\t$ dsp -t sgen -c 2 sine@0:freq=500-1k/sine@1:freq=300-800+2 gain -10\n\n### Effects\n\n#### Complete effects list\n\n* `lowpass_1 f0[k]`  \n\tFirst-order lowpass filter.\n* `highpass_1 f0[k]`  \n\tFirst-order highpass filter.\n* `allpass_1 f0[k]`  \n\tFirst-order allpass filter.\n* `lowshelf_1 f0[k] gain`  \n\tFirst-order lowshelf filter.\n* `highshelf_1 f0[k] gain`  \n\tFirst-order highshelf filter.\n* `lowpass_1p f0[k]`  \n\tSingle pole lowpass (EWMA) filter.\n* `lowpass f0[k] width[q|o|h|k]`  \n\tSecond-order lowpass filter.\n* `highpass f0[k] width[q|o|h|k]`  \n\tSecond-order highpass filter.\n* `bandpass_skirt f0[k] width[q|o|h|k]`  \n\tSecond-order bandpass filter with constant skirt gain.\n* `bandpass_peak f0[k] width[q|o|h|k]`  \n\tSecond-order bandpass filter with constant peak gain.\n* `notch f0[k] width[q|o|h|k]`  \n\tSecond-order notch filter.\n* `allpass f0[k] width[q|o|h|k]`  \n\tSecond-order allpass filter.\n* `eq f0[k] width[q|o|h|k] gain`  \n\tSecond-order peaking filter.\n* `lowshelf f0[k] width[q|s|d|o|h|k] gain`  \n\tSecond-order lowshelf filter.\n* `highshelf f0[k] width[q|s|d|o|h|k] gain`  \n\tSecond-order highshelf filter.\n* `lowpass_transform fz[k] width_z[q] fp[k] width_p[q]`  \n\tSecond-order lowpass transformation filter. Cancels the poles defined by\n\t`fz` and `width_z` and replaces them with new poles defined by `fp` and\n\t`width_p`. Gain is unity at DC.\n* `highpass_transform fz[k] width_z[q] fp[k] width_p[q]`  \n\tSecond-order highpass transformation filter. Also known as a Linkwitz\n\ttransform (see http://www.linkwitzlab.com/filters.htm#9). Same as\n\t`lowpass_transform` except the gain is unity at Fs/2.\n* `linkwitz_transform fz[k] width_z[q] fp[k] width_p[q]`  \n\tAlias for `highpass_transform`.\n* `deemph`  \n\tCompact Disc de-emphasis filter.\n* `biquad b0 b1 b2 a0 a1 a2`  \n\tBiquad filter.\n* `gain gain_dB`  \n\tGain adjustment in decibels.\n* `mult multiplier`  \n\tMultiplies each sample by `multiplier`.\n* `add value`  \n\tApplies a DC shift.\n* `crossfeed f0[k] separation`  \n\tSimple crossfeed for headphones. Very similar to Linkwitz/Meier/CMoy/bs2b\n\tcrossfeed.\n* `matrix4 [options] [surround_level]`  \n\t2-to-4 channel (2 front and 2 surround) active matrix upmixer designed for\n\tplain (i.e. unencoded) stereo material.\n\n\tThe intended speaker configuration is fronts at ±30° and surrounds between\n\t±60° and ±120°. The surround speakers must be calibrated correctly in\n\tlevel and frequency response for best results. The surrounds should be\n\tdelayed by about 10-25ms (acoustically) relative to the fronts. No\n\tfrequency contouring is done internally, so applying low pass and/or\n\tshelving filters to the surround outputs is recommended:\n\n\t```\n\tmatrix4 surround_delay=15m -6 :2,3 lowpass_1 10k :\n\t```\n\n\tThe settings shown above (-6dB surround level, 15ms delay, and 10kHz\n\trolloff) are a good starting point, but may be adjusted to taste. The\n\tdefault `surround_level` is -6dB. Applying the `decorrelate` effect to the\n\tsurround outputs (optionally with the `-m` flag) seems to further improve\n\tthe spatial impression (note: adjust `surround_delay` to compensate for\n\tthe `decorrelate` effect's group delay).\n\n\tThe front outputs replace the original input channels and the surround\n\toutputs are appended to the end of the channel list.\n\n\tOptions are given as a comma-separated list. Recognized options are:\n\n\t* `show_status`  \n\t\tShow a status line (slightly broken currently, but still useful for\n\t\tdebugging).\n\t* `dir_boost[=simple|band|combined|none]`  \n\t\tDirectional boost method for the front channels. The default is\n\t\t`simple`, which affects all frequencies equally. The `band` and\n\t\t`combined` methods only apply to `matrix4_mb`. `band` simply makes each\n\t\tband independent. This minimizes pumping of the uncorrelated component\n\t\toutside of a given band, but can cause audible timbre changes to the\n\t\tcorrelated component in some cases. `combined` computes weighted\n\t\taverages of the `simple` and `band` methods based on the status of the\n\t\tevent detection algorithm.\n\t* `no_dir_boost`  \n\t\tAlias for `dir_boost=none`.\n\t* `signal`  \n\t\tToggle the effect when `effect.signal()` is called.\n\t* `linear_phase` (`matrix4_mb` only)  \n\t\tApply an FIR filter to correct the phase distortion caused by the IIR\n\t\tfilter bank. Has no effect with `matrix4`. Requires the `fir` effect.\n\t* `surround_delay=delay[s|m|S]`  \n\t\tSurround output delay. Default is zero.\n\t* `filter_type=filter[:stop_dB[:stop_dB]]` (`matrix4_mb` only)  \n\t\tType of filter used for low pass sections of the filter bank. `filter`\n\t\tmay be `butterworth`, `chebyshev1`, `chebyshev2`, or `elliptic`\n\t\t(default).\n\n\t\tThe optional `stop_dB` parameter(s) set the stopband attenuation in\n\t\tdecibels for the Chebyshev and elliptic filters. Only the first\n\t\tparameter is used for `chebyshev1` and `chebyshev2`. For `elliptic`,\n\t\tthe first parameter applies to the lowpass and the second to the\n\t\thighpass. If only one parameter is given, it applies to both stopbands.\n\t\tDefault values are 25 for `chebyshev1` and `chebyshev2`, and 35:50 for\n\t\t`elliptic`.\n\n* `matrix4_mb [options] [surround_level]`  \n\tLike the `matrix4` effect, but divides the input into eleven individually\n\tsteered bands in order to improve separation of concurrent sound sources.\n\tSee the `matrix4` effect description for more information.\n* `remix selector|. ...`  \n\tSelect and mix input channels into output channels. Each selector argument\n\tspecifies the input channels to be mixed to produce an output channel. `.`\n\tselects no input channels. For example, `remix 0,1 2,3` mixes input\n\tchannels 0 and 1 into output channel 0, and input channels 2 and 3 into\n\toutput channel 1.  `remix -` mixes all input channels into a single output\n\tchannel. The active channel selector is used as an input channel mask for\n\tthe selector arguments.\n* `st2ms`\n\tConvert stereo to mid/side.\n* `ms2st`\n\tConvert mid/side to stereo.\n* `delay [-f [order]] delay[s|m|S]`  \n\tDelay line. The unit for the delay argument depends on the suffix used:\n\t`s` is seconds (the default), `m` is milliseconds, and `S` is samples. If\n\t`delay` is negative, a positive delay is applied to all channels which are\n\t**not** selected (except when plotting—an actual negative delay is\n\tpossible in that case).\n\n\tBy default, the delay is rounded to whole samples. The `-f` option enables\n\tfractional delay using Thiran allpass interpolation. The `order` argument\n\tsets the allpass filter order and may be any integer from 1 through 50. The\n\tdefault value is 5.\n* `resample [bandwidth] fs[k]`  \n\tSinc resampler. Ignores the channel selector.\n* `fir [input_options] [file:][~/]filter_path|coefs:list[/list...]`  \n\tNon-partitioned 64-bit direct or FFT convolution. Latency is zero for\n\tfilters up to 16 taps. For longer filters, the latency is equal to the\n\t`fft_len` reported in verbose mode. Each `list` is a comma-separated list\n\tof coefficients for one filter channel. Missing values are filled with\n\tzeros.\n\n\tThe `input_options` are useful mostly when loading raw (headerless) input\n\tfiles and are as follows:\n\n\tFlag              | Description\n\t----------------- | -----------------------------\n\t`-t type`         | Type.\n\t`-e encoding`     | Encoding.\n\t`-B/L/N`          | Big/little/native endian.\n\t`-r frequency[k]` | Sample rate.\n\t`-c channels`     | Number of channels.\n\n\tBy default, the sample rate of the filter must match that of the effect.\n\tMismatches may be ignored by setting the sample rate to \"any\".\n\n* `fir_p [input_options] [max_part_len] [file:][~/]filter_path|coefs:list[/list...]`  \n\tZero-latency non-uniform partitioned 64-bit direct/FFT convolution. Usually\n\ta bit slower than the `zita_convolver` effect except for very long filters\n\ton some hardware. `max_part_len` must be a power of 2 and has a default\n\tvalue of 16384. Each `list` is a comma-separated list of coefficients for\n\tone filter channel. Missing values are filled with zeros.\n\n\tSee the `fir` effect description an explanation of the `input_options`.\n* `zita_convolver [input_options] [min_part_len [max_part_len]] [file:][~/]filter_path|coefs:list[/list...]`  \n\tPartitioned 32-bit FFT convolution using the zita-convolver library.\n\tLatency is equal to `min_part_len` (64 samples by default).\n\t`{min,max}_part_len` must be powers of 2 between 64 and 8192. Each `list`\n\tis a comma-separated list of coefficients for one filter channel. Missing\n\tvalues are filled with zeros.\n\n\tSee the `fir` effect description an explanation of the `input_options`.\n* `hilbert [-pz] [-a angle] taps`  \n\tSimple FIR approximation of a Hilbert transform. The number of taps must be\n\todd. Bandwidth is controlled by the number of taps. If `-p` is given, the\n\t`fir_p` convolution engine is used instead of the default `fir` engine.\n\tSimilarly, if `-z` is given, `zita_convolver` is used (if available).\n\tThe `-a` option sets the phase shift in degrees. The default is -90°.\n* `decorrelate [-m] [-s seed] [stages]`  \n\tAllpass decorrelator as described in \"Frequency-Dependent Schroeder\n\tAllpass Filters\" by Sebastian J. Schlecht (doi:10.3390/app10010187).\n\tIf `-m` is given, the same filter parameters are used for all input\n\tchannels. The default number of stages is 5, which results in an\n\taverage group delay of about 9.5ms at high frequencies. The `-s` option\n\tsets the random seed for filter parameter generation.\n* `noise level[b]`  \n\tAdd TPDF noise. The `level` argument specifies the peak level of the noise\n\tin dBFS if no suffix is given, or the effective precision in bits if the\n\t`b` suffix is given.\n* `dither [shape] [[quantize_bits] bits]`  \n\tApply dither with optional noise shaping. The `shape` argument determines\n\tthe type of dither and the noise shaping filter (if any):\n\n\t`shape`    | Description\n\t---------- | ----------------------\n\t`flat`     | Flat TPDF with no feedback (default).\n\t`sloped`   | Flat TPDF with feedback. First-order highpass response.\n\t`sloped2`  | Sloped TPDF with feedback. Stronger HF emphasis than `sloped`.\n\t`lipshitz` | 5-tap E-weighted curve from [1]. Notches around 4k and 12k.\n\t`wan3`     | 3-tap F-weighted curve from [2]. Notch around 4k.\n\t`wan9`     | 9-tap F-weighted curve from [2]. Notches around 3.5k and 12k.\n\n\tThe `bits` argument sets the dither level in bits. The `quantize_bits`\n\targument sets the number of levels to quantize to. The default setting for\n\tboth is `auto`. If `bits` is not `auto`, dither is applied at the specified\n\tbit depth regardless of the output sample format. `bits` may be any number.\n\t`quantize_bits` must be an integer between 2 and 32. If `quantize_bits` is\n\tnot given, it is set to the same value as `bits` (rounded to the nearest\n\tinteger).\n\n\t**Note:** Currently, setting `bits` to `auto` disables dither if the effect\n\tis loaded via `watch` or used in `ladspa_dsp`.\n\n\t[1] S. P. Lipshitz, J. Vanderkooy, and R. A. Wannamaker,\n\t\"Minimally Audible Noise Shaping,\" J. AES, vol. 39, no. 11,\n\tNovember 1991  \n\t[2] R. A. Wannamaker, \"Psychoacoustically Optimal Noise Shaping,\"\n\tJ. AES, vol. 40, no. 7/8, July 1992\n\n* `ladspa_host [~/]module_path plugin_label [control ...]`  \n\tApply a LADSPA plugin. Supports any number of input/output ports (with\n\tthe exception of zero output ports). If a plugin has one or zero input\n\tports, it will be instantiated multiple times to handle multi-channel\n\tinput.\n\t\n\tControls which are not explicitly set or are set to `-` will use default\n\tvalues (if available).\n\t\n\tThe `LADSPA_PATH` environment variable can be used to set the search path\n\tfor plugins.\n* `stats [ref_level]`  \n\tDisplay the DC offset, minimum, maximum, peak level (dBFS), RMS level\n\t(dBFS), crest factor (dB), peak count, peak sample, number of samples, and\n\tlength (s) for each channel. If `ref_level` is given, peak and RMS levels\n\trelative to `ref_level` will be shown as well (dBr).\n* `watch [-e] [~/]path`  \n\tLoad effects from a file into a sub-chain and reload if the file is\n\tmodified. Other than the automatic reload, the behavior is similar to\n\tsourcing a file using the `@` directive (see \"Effects Files\"). Some\n\trestrictions apply to automatic reload:\n\n\t* The new sub-chain must have the same output sample rate and number of\n\t  channels as the previous sub-chain.\n\t* The new sub-chain must not require larger buffers than the previous\n\t  sub-chain.\n\n\tIf these conditions are not met, the new sub-chain will not be applied and\n\tan error message will be printed.\n\n\tCurrently, this effect polls for file modifications once per second.\n\tSupport `inotify` events my be added in the future. Ideally, file\n\tmodifications should be atomic (i.e. by writing to a temporary file, then\n\t`rename(3)`-ing it over top of the original file). If this is not possible,\n\tthe `-e` flag may be given, which enforces an end-of-file marker in order\n\tto detect partially-written files. This marker, `#EOF#`, must be placed at\n\tthe beginning of a line and may only be followed by whitespace characters.\n\n#### Selector syntax\n\nExample    | Description\n---------- | --------------------------\n`\u003cempty\u003e`  | all\n`-`        | all\n`2-`       | 2 to n\n`-4`       | 0 through 4\n`1,3`      | 1 and 3\n`1-4,7,9-` | 1 through 4, 7, and 9 to n\n\n**Note:** There is no difference between `1,3` and `3,1`. Order is not\npreserved.\n\n#### Filter width\n\nThe following suffixes are supported:\n\nSuffix | Description\n------ | ------------------------------\n`q`    | Q-factor (default).\n`s`    | Slope (shelving filters only).\n`d`    | Slope in dB/octave (shelving filters only).\n`o`    | Bandwidth in octaves.\n`h`    | Bandwidth in Hz.\n`k`    | Bandwidth in kHz.\n\n**Note:** The `d` width suffix also changes the definition of `f0` from center\nfrequency to corner frequency (like Room EQ Wizard and the Behringer DCX2496).\n\nAdditionally, a macro is provided for constructing arbitrary-order Butterworth\nfilters from cascaded second-order sections: `bw\u003corder\u003e[.n]`, where `\u003corder\u003e` is\nthe filter order and `n` is an index corresponding to a particular pair of\npoles. The Q-factors are always in ascending order. For example,\n\n\tlowpass 1k bw6.0 lowpass 1k bw6.1 lowpass 1k bw6.2\n\ncreates a 6th-order Butterworth lowpass filter. Odd-order filters require an\nadditional first-order section:\n\n\tlowpass_1 1k lowpass 1k bw5.0 lowpass 1k bw5.1\n\n#### File paths\n\nOn the command line, relative paths are relative to `$PWD`. Within an effects\nfile, relative paths are relative to the directory containing said effects\nfile. A `~/` prefix will be expanded to the contents of `$HOME`. The following\nsubstitutions are supported anywhere within a file path:\n\nSequence | Substitution\n-------- | ------------------\n`%r`     | Sample rate in Hz\n`%k`     | Sample rate in kHz\n`%c`     | Number of channels\n`%%`     | Literal `%`\n\n#### Channel selectors and masks\n\nA colon (`:`) followed by a selector (see \"Selector syntax\") specifies the\ninput channels for effects that follow. For example,\n\n\t:0,2 eq 1k 1.0 -6\n\nwill apply an `eq` effect to channels 0 and 2. If an effect changes the total\nnumber of channels, the last channel selector given is parsed again. Additional\nchannels are not added unless the selector includes an unbounded range.\n\nChannel numbers refer to the channels in the active channel mask, which is a\nproperty of the containing block. Blocks may be created using braces\n(`{ ... }`) or by sourcing a file (see \"Effects files\"). The channel mask is\nderived from the active channel selector at creation. For example,\n\n\t:1,3 { :0 gain -6 :1 gain +6 }\n\ncreates a block with the mask `1,3`. Within the block, `:0` selects the first\nchannel in the mask (channel 1), and `:1` selects the second channel in the\nmask (channel 3). Channel selectors have block scope.\n\nChannels are automatically added or removed from the active channel mask if an\neffect changes the total number of channels. Additional channels are always\nappended to the end of the channel list.\n\n#### Effects files\n\nFiles may be sourced using the `@` directive: `@[~/]path/to/file`. See \"File\npaths\" for more information about how paths are interpreted. Note that sourcing\na file implicitly creates a block (see \"Channel selectors and masks\"). Within a\nfile, lines in which the first non-whitespace character is `#` are ignored. A\nbackslash (`\\`) may be used to escape whitespace, `#`, or `\\`. Example:\n\n\tgain -4.0\n\t# This is a comment\n\tlowshelf 90 1s +4 eq 3k 1.5 -3\n\n#### Other directives\n\nAn exclamation mark (`!`) allows initialization failure of the effect that\nfollows.\n\n#### FFTW wisdom\n\nEffects utilizing FFTW3 can optionally load and save wisdom. For `dsp`, set\n`$DSP_FFTW_WISDOM_PATH`. `ladspa_dsp` uses `$LADSPA_DSP_FFTW_WISDOM_PATH`\ninstead. If a path is set, FFTW plans are created with the FFTW_MEASURE flag.\nAccumulated wisdom is written on exit.\n\n### Examples\n\nRead `file.flac`, apply a bass boost, and write to alsa device `hw:2`:\n\n\tdsp file.flac -ot alsa -e s24_3 hw:2 lowshelf 60 0.5 +4\n\nPlot the magnitude vs frequency response of an effects chain:\n\n\tdsp -pn [effect [args]] ... | gnuplot\n\nImplement an LR4 crossover at 2.2KHz, where output channels 0 and 1 are the\nleft and right tweeters, and channels 2 and 3 are the left and right woofers,\nrespectively:\n\n\tdsp stereo_file.flac -ot alsa -e s32 hw:3 remix 0 1 0 1\n\t  :0,1 highpass 2.2k 0.7071 highpass 2.2k 0.7071 :\n\t  :2,3 lowpass 2.2k 0.7071 lowpass 2.2k 0.7071 :\n\nApply effects from a file:\n\n\tdsp file.flac @eq.txt\n\n### LADSPA frontend\n\n#### Configuration\n\n`ladspa_dsp` looks for configuration files in the following directories:\n\n* `$XDG_CONFIG_HOME/ladspa_dsp`\n* `$HOME/.config/ladspa_dsp` (if `$XDG_CONFIG_HOME` is not set)\n* `/etc/ladspa_dsp`\n\nTo override the default directories, set the `LADSPA_DSP_CONFIG_PATH`\nenvironment variable to the desired path(s) (colon-separated).\n\nEach file that is named either `config` or `config_\u003cname\u003e` (where `\u003cname\u003e` is\nany string) is loaded as a separate plugin. The plugin label is either\n`ladspa_dsp` (for `config`) or `ladspa_dsp:\u003cname\u003e` (for `config_\u003cname\u003e`).\n\nConfiguration files are a simple key-value format. Leading whitespace is\nignored. The valid keys are:\n\n* `input_channels`  \n\tNumber of input channels. Default value is `1`. May be left unset unless\n\tyou want individual control over each channel.\n* `output_channels`  \n\tNumber of output channels. Default value is `1`. This parameter is not\n\tcurrently set automatically because the number of LADSPA ports must be\n\tknown before the effects chain is built. Initialization will fail if it\n\tdoes not match the effects chain.\n* `LC_NUMERIC`  \n\tSet `LC_NUMERIC` to the given value while building the effects chain.\n\tDefault value is `C`, which gives consistent number parsing behavior\n\tregardless of the system locale and LADSPA host behavior. Setting this to\n\tan empty value uses the default system locale. The special value `none`\n\tleaves `LC_NUMERIC` up to the LADSPA host (not generally recommended).\n* `effects_chain`  \n\tString to build the effects chain. The format is the same as an effects\n\tfile, but only a single line is interpreted.\n\nExample configuration:\n\n\t# This is a comment\n\tinput_channels=1\n\toutput_channels=1\n\tLC_NUMERIC=C\n\teffects_chain=gain -3 lowshelf 100 1s +3 @/path/to/eq_file\n\nRelative file paths in the `effects_chain` line are relative to the\ndirectory in which the configuration file resides.\n\nThe loglevel can be set to `VERBOSE`, `NORMAL`, or `SILENT` through the\n`LADSPA_DSP_LOGLEVEL` environment variable.\n\n#### Usage example: Route alsa audio through ladspa_dsp\n\nPut this in `~/.asoundrc`:\n\n\tpcm.dsp {\n\t\ttype plug\n\t\tslave {\n\t\t\tformat FLOAT\n\t\t\trate unchanged\n\t\t\tchannels unchanged\n\t\t\tpcm {\n\t\t\t\ttype ladspa\n\t\t\t\tpath \"/usr/lib/ladspa\"\n\t\t\t\tplayback_plugins [{\n\t\t\t\t\tlabel \"ladspa_dsp\"\n\t\t\t\t}]\n\t\t\t\tslave.pcm {\n\t\t\t\t\ttype plug\n\t\t\t\t\tslave {\n\t\t\t\t\t\tpcm \"\u003chw_device\u003e\"\n\t\t\t\t\t\trate unchanged\n\t\t\t\t\t\tchannels unchanged\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\nReplace `\u003chw_device\u003e` with the preferred output device (`hw:0`, for example).\n\nIf you need individual control over each channel, you need to set the number\nof (output) channels:\n\n\tpcm.dsp {\n\t\ttype plug\n\t\tslave {\n\t\t\tformat FLOAT\n\t\t\trate unchanged\n\t\t\tpcm {\n\t\t\t\ttype ladspa\n\t\t\t\tchannels \u003cchannels\u003e\n\t\t\t\tpath \"/usr/lib/ladspa\"\n\t\t\t\tplayback_plugins [{\n\t\t\t\t\tlabel \"ladspa_dsp\"\n\t\t\t\t}]\n\t\t\t\tslave.pcm {\n\t\t\t\t\ttype plug\n\t\t\t\t\tslave {\n\t\t\t\t\t\tpcm \"\u003chw_device\u003e\"\n\t\t\t\t\t\trate unchanged\n\t\t\t\t\t\tchannels unchanged\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\nTo make `dsp` the default device, append this to `~/.asoundrc`:\n\n\tpcm.!default {\n\t\ttype copy\n\t\tslave.pcm \"dsp\"\n\t}\n\n#### Usage example: Route pulseaudio audio through ladspa_dsp (tested with Ubuntu 18.04; contributed by shaffenmeister)\n\n1. Prepare .asoundrc as stated above.\n2. Determine pulseaudio master sink using `pacmd list sinks`. Use attribute\n   `name` of the pulseaudio sink you plan to use\n   (e.g. `alsa_output.pci-0000_00_14.2.analog-stereo`).\n3. Execute `analyseplugin \u003cpath to LADSPA plugin\u003e/ladspa_dsp.so` to determine\n   plugin name and label.\n4. Run `pacmd load-module module-ladspa-sink sink_name=ladspa_out\n   sink_master=\u003cmaster_sink\u003e plugin=\u003cplugin name\u003e label=\u003cplugin label\u003e`.\n5. Select new LADSPA sink as system sink (Ubuntu 18.04 Desktop:\n   Settings \u003e Sound \u003e Output \u003e LADSPA_Plugin `\u003cplugin label\u003e` on\n   `\u003cmaster sink\u003e`).\n\nExample:\n\n\tpacmd list sinks\n\tanalyseplugin /usr/local/lib/ladspa/ladspa_dsp.so\n\tpacmd load-module module-ladspa-sink sink_name=ladspa_out sink_master=alsa_output.pci-0000_00_14.2.analog-stereo plugin=ladspa_dsp label=ladspa_dsp\n\n##### Load LADSPA plugin as system default\n\nTo load the LADSPA module at system startup for all users include settings in `/etc/pulse/default.pa`:\n\n\t.ifexists module-ladspa-sink.so\n\t.nofail\n\tload-module module-ladspa-sink sink_name=ladspa_out sink_master=\u003cmaster_sink\u003e plugin=\u003cplugin name\u003e label=\u003cplugin label\u003e\n\t.fail\n\t.endif\n\n##### Load LADSPA plugin as user default\n\nTo load the LADSPA module at user login include settings in\n`~/.config/pulse/default.pa`:\n\n\t#!/usr/bin/pulseaudio -nF\n\t.include /etc/pulse/default.pa\n\t.ifexists module-ladspa-sink.so\n\t.nofail\n\tload-module module-ladspa-sink sink_name=ladspa_out sink_master=\u003cmaster_sink\u003e plugin=\u003cplugin name\u003e label=\u003cplugin label\u003e\n\t.fail\n\t.endif\n\n**Note:** The resample effect cannot be used with the LADSPA frontend.\n\n### Bugs\n\n* No support for metadata.\n* Some effects do not support plotting.\n* When plotting an effects chain containing the `noise` effect, a different\n  random sequence is generated for each output channel regardless of whether the\n  noise should be correlated between outputs. Summing correlated noise works\n  correctly.\n\n### License\n\nThis software is released under the ISC license.\n","funding_links":[],"categories":["C","Music"],"sub_categories":["Programming"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc0%2Fdsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmc0%2Fdsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc0%2Fdsp/lists"}