Signal processing (effect) and generation (oscillators).
Singal is any sequence with double values.
To process signal use apply-effects
or apply-effects-raw
(operates on double-array
only) function.
Effect is signal filter, created by effect
multimethod. Effects can be composed with compose-effects
. Effect can be treated as function and can be called for given sample.
Each effect has it's own parametrization which should be passed during creation.
List of all available effects is under effects-list
value.
Each effect has its own parameters.
:rate
- sample rate (default 44100.0):cutoff
- cutoff frequency (default 2000.0)Biquad equalizer
:fc
- center frequency:gain
- gain:bw
- bandwidth (default: 1.0):fs
- sampling rate (defatult: 44100.0)Biquad highpass and lowpass shelf filters
:fc
- center frequency:gain
- gain:slope
- shelf slope (default 1.5):fs
- sampling rate (default 44100.0)Biquad lowpass, highpass and bandpass filters
:fc
- cutoff/center frequency:bw
- bandwidth (default 1.0):fs
- sampling rate (default 44100.0):high
- high frequency gain (10000Hz):mid
- mid frequency gain (1000Hz):low
- low frequency gain (100Hz):shelf-slope
- shelf slope for high frequency (default 1.5):peak-bw
- peak bandwidth for mid and low frequencies (default 1.0):rate
- sampling rate (default 44100.0):delay
- delay factor (default: 0.5):denom
(long, default 2.0)Modulate and demodulate signal using frequency
:quant
- quantization value (0.0 - if no quantization, default 10):omega
- carrier factor (default 0.014):phase
- deviation factor (default 0.00822)https://searchcode.com/file/18573523/cmt/src/lofi.cpp#
:rate
- sample rate (default 44100.0):freq
- cutoff frequency (default 1000.0):factor
- distortion factor (default 1.0)Fast overdrive
:drive
- drive (default 2.0):bits
- bit depth (default 2):fs
- decimator sample rate (default 4410.0):rate
- input sample rate (default 44100.0):bass
- bass gain (default 1.0):treble
- treble gain (default 1.0):gain
- gain (default 0.0):rate
- sample rate (default 44100.0):slope
- slope for both (default 0.4):bass-freq
- bass freq (default 250.0):treble-freq
- treble freq (default 4000.0):delay
- delay time in seconds (default 0.5):decay
- decay (amount echo in signal, default 0.5):rate
- sample rate (default 44100.0)Warning! Echo filter uses mutable array as a internal state, don't use the same filter in paraller processing.
:rate
- sample rate (default 44100.0):trigger
- boolean, trigger some action (default false
), set true when you reset filter every line:cutoff
- cutoff frequency (values 0-1, default 0.8):resonance
- resonance (values 0-1, default 0.8):env-mod
- envelope modulation (values 0-1, default 0.5):decay
- decay (values 0-1, default 1.0):gain
- gain output signal (default: 1.0)http://git.drobilla.net/cgit.cgi/omins.lv2.git/tree/src/slew_limiter.c
:rate
- sample rate:maxrise
- maximum change for rising signal (in terms of 1/rate steps, default 500):maxfall
- maximum change for falling singal (default 500):rate
- sample rate:speed
- effect rate:depth
:mix
:depth-mod
:feedback
Warning: internal state is kept in doubles array.
oscillator
creates function which generates signal value for given time.
To sample generated wave to signal, call oscillator->signal
with following parameters:
f
- oscillatorsamplerate
- sample rate (samples per second)seconds
- durationTo convert signal to oscillator (using interpolation) use signal->oscillator
passing signal and duration.
Add oscillators using oscillators-sum
.
Savitzky-Golay smoothing filter savgol-filter
.
You can save-signal
or load-signal
. Representation is 16 bit signed, big endian. Use Audacity or SoX to convert to/from audio files.
Signal processing (effect) and generation (oscillators). Singal is any sequence with double values. ## Signal processing To process signal use [[apply-effects]] or [[apply-effects-raw]] (operates on `double-array` only) function. Effect is signal filter, created by [[effect]] multimethod. Effects can be composed with [[compose-effects]]. Effect can be treated as function and can be called for given sample. Each effect has it's own parametrization which should be passed during creation. List of all available effects is under [[effects-list]] value. ### Effects parametrization Each effect has its own parameters. #### :simple-lowpass, :simple-highpass * `:rate` - sample rate (default 44100.0) * `:cutoff` - cutoff frequency (default 2000.0) #### :biquad-eq Biquad equalizer * `:fc` - center frequency * `:gain` - gain * `:bw` - bandwidth (default: 1.0) * `:fs` - sampling rate (defatult: 44100.0) #### :biquad-hs, :biquad-ls Biquad highpass and lowpass shelf filters * `:fc` - center frequency * `:gain` - gain * `:slope` - shelf slope (default 1.5) * `:fs` - sampling rate (default 44100.0) #### :biquad-lp, :biquad-hp, :biquad-bp Biquad lowpass, highpass and bandpass filters * `:fc` - cutoff/center frequency * `:bw` - bandwidth (default 1.0) * `:fs` - sampling rate (default 44100.0) #### :dj-eq * `:high` - high frequency gain (10000Hz) * `:mid` - mid frequency gain (1000Hz) * `:low` - low frequency gain (100Hz) * `:shelf-slope` - shelf slope for high frequency (default 1.5) * `:peak-bw` - peak bandwidth for mid and low frequencies (default 1.0) * `:rate` - sampling rate (default 44100.0) #### :phaser-allpass * `:delay` - delay factor (default: 0.5) #### :divider * `:denom` (long, default 2.0) #### :fm Modulate and demodulate signal using frequency * `:quant` - quantization value (0.0 - if no quantization, default 10) * `:omega` - carrier factor (default 0.014) * `:phase` - deviation factor (default 0.00822) #### :bandwidth-limit https://searchcode.com/file/18573523/cmt/src/lofi.cpp# * `:rate` - sample rate (default 44100.0) * `:freq` - cutoff frequency (default 1000.0) #### :distort * `:factor` - distortion factor (default 1.0) #### :foverdrive Fast overdrive * `:drive` - drive (default 2.0) #### :decimator * `:bits` - bit depth (default 2) * `:fs` - decimator sample rate (default 4410.0) * `:rate` - input sample rate (default 44100.0) #### :basstreble * `:bass` - bass gain (default 1.0) * `:treble` - treble gain (default 1.0) * `:gain` - gain (default 0.0) * `:rate` - sample rate (default 44100.0) * `:slope` - slope for both (default 0.4) * `:bass-freq` - bass freq (default 250.0) * `:treble-freq` - treble freq (default 4000.0) #### :echo * `:delay` - delay time in seconds (default 0.5) * `:decay` - decay (amount echo in signal, default 0.5) * `:rate` - sample rate (default 44100.0) _Warning! Echo filter uses mutable array as a internal state, don't use the same filter in paraller processing._ #### :vcf303 * `:rate` - sample rate (default 44100.0) * `:trigger` - boolean, trigger some action (default `false`), set true when you reset filter every line * `:cutoff` - cutoff frequency (values 0-1, default 0.8) * `:resonance` - resonance (values 0-1, default 0.8) * `:env-mod` - envelope modulation (values 0-1, default 0.5) * `:decay` - decay (values 0-1, default 1.0) * `:gain` - gain output signal (default: 1.0) #### :slew-limit http://git.drobilla.net/cgit.cgi/omins.lv2.git/tree/src/slew_limiter.c * `:rate` - sample rate * `:maxrise` - maximum change for rising signal (in terms of 1/rate steps, default 500) * `:maxfall` - maximum change for falling singal (default 500) #### :mda-thru-zero * `:rate` - sample rate * `:speed` - effect rate * `:depth` * `:mix` * `:depth-mod` * `:feedback` _Warning: internal state is kept in doubles array._ ## Oscillators [[oscillator]] creates function which generates signal value for given time. To sample generated wave to signal, call [[oscillator->signal]] with following parameters: * `f` - oscillator * `samplerate` - sample rate (samples per second) * `seconds` - duration To convert signal to oscillator (using interpolation) use [[signal->oscillator]] passing signal and duration. Add oscillators using [[oscillators-sum]]. ## Smoothing filter Savitzky-Golay smoothing filter [[savgol-filter]]. ## File operations You can [[save-signal]] or [[load-signal]]. Representation is 16 bit signed, big endian. Use Audacity or SoX to convert to/from audio files.
(apply-effects in effects)
(apply-effects in effects reset)
Apply effects to signal as any sequence.
If reset
is positive, reinit state each reset
number of samples.
Returns new signal.
Apply effects to signal as any sequence. If `reset` is positive, reinit state each `reset` number of samples. Returns new signal.
(apply-effects-raw in effects)
(apply-effects-raw in effects reset)
Apply effects to signal as double-array
.
If reset
is positive, reinit state each reset
number of samples.
Returns new signal as double-array
.
Apply effects to signal as `double-array`. If `reset` is positive, reinit state each `reset` number of samples. Returns new signal as `double-array`.
Create effect for given name (as keyword) and optional parameters.
List of all possible effects is under effects-list
.
Effect is a custom type which contains: name, sample (result of last call), effect function and current state.
Effect can be considered as function: call with sample to effect with next state or call without parameter to obtain latest result. Effects are also composable with compose-effects
.
Create effect for given name (as keyword) and optional parameters. List of all possible effects is under [[effects-list]]. Effect is a custom type which contains: name, sample (result of last call), effect function and current state. Effect can be considered as function: call with sample to effect with next state or call without parameter to obtain latest result. Effects are also composable with [[compose-effects]].
(effect-node effect-name f)
Create EffectsList
node from effect function and initial state.
Create `EffectsList` node from effect function and initial state.
(kernel-smoothing-filter kernel)
(kernel-smoothing-filter kernel length)
(kernel-smoothing-filter kernel length step)
Creates Nadaraya-Watson kernel-weighted average
Arguments:
gaussian
)Returns filtering function. See also savgol-filter
.
Creates Nadaraya-Watson kernel-weighted average Arguments: * kernel - [[kernel]] function (default `gaussian`) * length - length of the kernel (default: 5) * step - distance between consecutive samples (default: 1.0) Returns filtering function. See also [[savgol-filter]].
(load-signal filename)
Read signal from file
Expected representation is 16 bit signed, big endian file.
Read signal from file Expected representation is 16 bit signed, big endian file.
(moving-average-filter)
(moving-average-filter length)
Creates moving average filter.
Arguments:
Returns filtering function. See also savgol-filter
.
Creates moving average filter. Arguments: * length - length of the kernel (default: 5) Returns filtering function. See also [[savgol-filter]].
Create oscillator.
Parameters are:
oscillators
variable)Multimethod creates oscillator function accepting double
(as time) and returns double
from [-1.0 1.0] range.
To convert oscillator
to signal, call [[signal-from-oscillator]].
To add oscillators, call [[sum-oscillators]].
Create oscillator. Parameters are: * oscilator name (see `oscillators` variable) * frequency * amplitude * phase (0-1) Multimethod creates oscillator function accepting `double` (as time) and returns `double` from [-1.0 1.0] range. To convert `oscillator` to signal, call [[signal-from-oscillator]]. To add oscillators, call [[sum-oscillators]].
(oscillator->signal f samplerate seconds)
Create signal from oscillator.
Parameters are:
Returns sampled signal as double array.
Create signal from oscillator. Parameters are: * f - oscillator * samplerate - in Hz * seconds - duration Returns sampled signal as double array.
List of oscillator names used with oscillator
List of oscillator names used with [[oscillator]]
(oscillators-sum & fs)
Create oscillator which is sum of all oscillators.
Create oscillator which is sum of all oscillators.
(reset-effects e)
Resets effects state to initial one.
Resets effects state to initial one.
(save-signal sig filename)
Save signal to file.
Representation is: 16 bit signed, big endian file You can use Audacity/SOX utilities to convert files to audio.
Save signal to file. Representation is: 16 bit signed, big endian file You can use Audacity/SOX utilities to convert files to audio.
(savgol-filter)
(savgol-filter length)
(savgol-filter length order)
(savgol-filter length order derivative)
Creates Savitzky-Golay smoothing filter.
Arguments:
Returns filtering function which accepts collection of numbers and returns filtered signal.
Creates Savitzky-Golay smoothing filter. Arguments: * length - length of the kernel (default: 5) * order - polynomial order (default: 2) * derivative - signal derivative (default: 0) Returns filtering function which accepts collection of numbers and returns filtered signal.
(signal->oscillator sig seconds)
(signal->oscillator sig seconds interpolator)
Create oscillator from signal.
Parameters:
fastmath.interpolation
). Default: [[linear-smile]].Create oscillator from signal. Parameters: * sig - signal as sequence * seconds - duration * interpolator - interpolation (see [[fastmath.interpolation]]). Default: [[linear-smile]].
(single-pass e sample)
Process on sample using effects, returns EffectsList
with result and new effect states.
Process on sample using effects, returns `EffectsList` with result and new effect states.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close