404
-Page not found
-diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e69de29..0000000 diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index 439baf0..0000000 --- a/docs/404.html +++ /dev/null @@ -1,181 +0,0 @@ - - -
- - - - - - - -Page not found
-The Faust Project has started in 2002. It is actively developed by the GRAME-CNCM Research Department.
-Many persons are contributing to the Faust project, by providing code for the -compiler, architecture files, libraries, examples, documentation, scripts, bug -reports, ideas, etc. We would like in particular to thank:
-as well as our colleagues at GRAME:
-We would like also to thank for their financial support:
-A lot of libraries have been developed by the community. They can be used when developing DSP programs:
-/usr/share/faust
, or /usr/local/share/faust
foldersThey are presented in the following sections.
-20 years of research, teaching and creation in mixed music using Faust language.
-abclib library is released by the CICM / MUSIDANSE (Centre de Recherches Informatique et Création Musicale, Paris 8 University) and is the result of 20 years of research, teaching and creation in mixed music, expressed as a set of codes in Faust language. The main topics addressed are: spatial sound processing and synthesis using ambisonics, multi-channel sound processing, utility objects for mixed music.
-This repository contains libraries including some essential building blocks for the implementation of musical complex adaptive systems in Faust programming.
-It includes a set of time-domain algorithms, some of which are original, for the processing of low-level and high-level information as well as the processing of sound using standard and non-conventional techniques. It also includes functions for the realisation of networks with different topologies, linear and nonlinear mapping strategies to render positive and negative feedback relationships, and different kinds of energy-preserving techniques for the stability of self-oscillating systems.
-This library contains a set of functions representing domain-limited versions of all Faust primitives and math functions that can potentially generate INF or NaN values. The goal of the library is to be able to implement DSP networks that, structurally, are free from INF and NaN values. Hence, the resulting programs should be rock-solid during real-time performance and virtually immune to crashes regardless of how mercilessly a network is modulated or how unstable a recursive system is made.
-BitDSP is a set of Faust library functions aimed to help explore and research artistic possibilities of bit-based algorithms. BitDSP currently includes implementations of bit-based functions ranging from simple bit operations over classic delta-sigma modulations to more experimental approaches like cellular automata, recursive Boolean networks, and linear feedback shift registers.
-A detailed overview of the functionality is in the paper "Creative use of bit-stream DSP in Faust" presented at IFC 2020.
-Sustained Electro-Acoustic Music is a project inspired by Alvise Vidolin and Nicola Bernardini. The SEAM libraries have been developed for this project.
-Ambitools is an implementation of several Ambisonic tools with the FAUST language. The code is designed to be scalable and flexible, offering tools working at various Ambisonic order and compiled for various architectures. The implementation of the spherical harmonics for an efficient computation is detailed. See the Ambitools : Tools For Sound Field Synthesis With Higher Order Ambisonic - V1.0 paper.
-Tap a complicated expression to pull out specific outputs, without having to manually route those outputs, just like how named function parameters remove the need to manually route inputs.
-A Faust library implementing following highpass/lowpass filters using fi.svf
:
Feel free to contribute by forking this project and creating a pull request, or by mailing the library description here.
-Heres is a list of additional DSP resources.
-Dario Sanfilippo Live concatenative granular processing project
-Mykle Hansen Weather Organ project
-Jean-Louis Paquelin Granola monophonic granular live feed processor
-Mayank Sanganeria granulator.dsp project
-Henrik von Coler material on granulation
-basic granulator in Faust based on a delay line, with the granulator
function
spatial granulation in ambisonics in abc_2d_fx_grain_ui
and abc_2d_syn_grain_ui
functions
multichannel granulation in abc_multigrain_ui
function
In general, libraries are organised in a stacked manner: the base ones define functions or constants without any dependancies, and additional ones are gradually built on top of simpler ones, layer by layer. Dependency loops must be avoided as much as possible. The resources folder contains tools to build and visualise the libraries dependencies graphs.
-If you wish to add a function to any of these libraries or if you plan to add a new library, make sure that you observe the following conventions:
-//-----------------functionName--------------------
-// Description
-//
-// #### Usage
-//
-// ```
-// Usage Example
-// ```
-//
-// Where:
-//
-// * argument1: argument 1 description
-//-------------------------------------------------
-
-make doclib
. os.osc
) should be used when calling a function declared in another library (see the section on Library Import).Usage
line must show the input/output shape (the number of inputs and outputs) of the function, like gen: _
for a mono generator, _ : filter : _
for a mono effect, etc.clip(low, high, x) = min(max(x, low), high);
form where clip(-1, 1)
partially applied version can be used later on in different contexts, better than clip(x, low, high) = min(max(x, low), high);
version.stdfaust.lib
with its own environment (2 letters - see stdfaust.lib
).generateDoc
.declare
a name
and a version
.Its official prefix is 'qu'
(look at an existing library to follow the exact syntax).ma = library("maths.lib");
import library line, for each external library function used in the new library (for instance ma.foo
that would be used somewhre in the code).//############### libraryName ##################
-// Description
-//
-// * Section Name 1
-// * Section Name 2
-// * ...
-//
-// It should be used using the `[...]` environment:
-//
-// ```
-// [...] = library("libraryName");
-// process = [...].functionCall;
-// ```
-//
-// Another option is to import `stdfaust.lib` which already contains the `[...]`
-// environment:
-//
-// ```
-// import("stdfaust.lib");
-// process = [...].functionCall;
-// ```
-//##############################################
-
-//================= Section Name ===============
-// Description
-//==============================================
-
-In order to have a uniformized library system, we established the following conventions (that hopefully will be followed by others when making modifications to them).
-[WIP]
-JOS proposal: using terms used in the field of digital signal processing, as follows:
-impulse
: ...,0,1,0,...pulse
: ...,0,1,1,0,... or longerimpulse_train
pulse_train
gate
= pulse controlled externally (e.g., by NoteOn,NoteOff)trigger
= impulse controlled externally (gate - gate' > 0) == gate rising edge[/WIP]
-Strictly speaking, there are no lists in Faust. But list operations can be simulated (in part) using the parallel binary composition operation ,
and pattern matching.
Thus functions expecting a variable number of arguments can use this mechanism, like a foo
function that would be used this way: foo((a,b,c,d))
. See fi.iir and fi.fir examples.
faust2md
"standards" for each library: //###
for main title (library name - equivalent to #
in markdown), //===
for section declarations (equivalent to ##
in markdown) and //---
for function declarations (equivalent to ####
in markdown - see basics.lib
for an example).####
markdown title.basics.lib
). make help
to see all possible commands. If you plan to create a pull-request, do not commit the full generated code but only the modified .lib files.declare author "name";
, declare copyright "XXX";
and declare licence "YYY";
declarations.declare version "xx.yy.zz";
semantic version number to be raised each time a modification is done. The global version
number in version.lib
also has to be adapted according to the change. To prevent cross-references between libraries, we generalized the use of the library("")
system for function calls in all the libraries. This means that everytime a function declared in another library is called, the environment corresponding to this library needs to be called too. To make things easier, a stdfaust.lib
library was created and is imported by all the libraries:
aa = library("aanl.lib");
-sf = library("all.lib");
-an = library("analyzers.lib");
-ba = library("basics.lib");
-co = library("compressors.lib");
-de = library("delays.lib");
-dm = library("demos.lib");
-dx = library("dx7.lib");
-en = library("envelopes.lib");
-fd = library("fds.lib");
-fi = library("filters.lib");
-ho = library("hoa.lib");
-it = library("interpolators.lib");
-ma = library("maths.lib");
-mi = library("mi.lib");
-ef = library("misceffects.lib");
-os = library("oscillators.lib");
-no = library("noises.lib");
-pf = library("phaflangers.lib");
-pm = library("physmodels.lib");
-qu = library("quantizers.lib");
-rm = library("reducemaps.lib");
-re = library("reverbs.lib");
-ro = library("routes.lib");
-si = library("signals.lib");
-so = library("soundfiles.lib");
-sp = library("spats.lib");
-sy = library("synths.lib");
-ve = library("vaeffects.lib");
-vl = library("version.lib");
-wa = library("webaudio.lib");
-wd = library("wdmodels.lib");
-
-For example, if we wanted to use the smooth
function which is now declared in signals.lib
, we would do the following:
import("stdfaust.lib");
-
-process = si.smooth(0.999);
-
-This standard is only used within the libraries: nothing prevents coders to still import signals.lib
directly and call smooth
without ro.
, etc. It means symbols and function names defined within a library have to be unique to not collide with symbols of any other libraries.
"Demo" functions are placed in demos.lib
and have a built-in user interface (UI). Their name ends with the _demo
suffix. Each of these function have a .dsp
file associated to them in the /examples
folder.
Any function containing UI elements should be placed in this library and respect these standards.
-"Standard" functions are here to simplify the life of new (or not so new) Faust coders. They are declared in /libraries/doc/standardFunctions.md
and allow to point programmers to preferred functions to carry out a specific task. For example, there are many different types of lowpass filters declared in filters.lib
and only one of them is considered to be standard, etc.
Before preparing a pull-request, the new library must be carefully tested:
-all.lib
imports all libraries in a same namespace, so check functions names collisions using the following test program:import("all.lib");
-process = _;
-
-For GRAME maintainers:
-make pdf
target in the doc
folderfaust2atomsnippets
tool).A library for antialiased nonlinearities. Its official prefix is aa
.
This library provides aliasing-suppressed nonlinearities through first-order -and second-order approximations of continuous-time signals, functions, -and convolution based on antiderivatives. This technique is particularly -effective if combined with low-factor oversampling, for example, operating -at 96 kHz or 192 kHz sample-rate.
-The library contains trigonometric functions as well as other nonlinear -functions such as bounded and unbounded saturators.
-Due to their limited domains or ranges, some of these functions may not -suitable for audio nonlinear processing or waveshaping, although -they have been included for completeness. Some other functions, -for example, tan() and tanh(), are only available with first-order -antialiasing due to the complexity of the antiderivative of the -x * f(x) term, particularly because of the necessity of the dilogarithm -function, which requires special implementation.
-Future improvements to this library may include an adaptive -mechanism to set the ill-conditioned cases threshold to improve -performance in varying cases.
-Note that the antialiasing functions introduce a delay in the path, -respectively half and one-sample delay for first and second-order functions.
-Also note that due to division by differences, it is vital to use -double-precision or more to reduce errors.
-The environment identifier for this library is aa
. After importing
-the standard libraries in Faust, the functions below can be called as aa.function_name
.
(aa.)clip
Clipping function.
-(aa.)Rsqrt
Real-valued sqrt().
-(aa.)Rlog
Real-valued log().
-(aa.)Rtan
Real-valued tan().
-(aa.)Racos
Real-valued acos().
-(aa.)Rasin
Real-valued asin().
-(aa.)Racosh
Real-valued acosh()
-(aa.)Rcosh
Real-valued cosh().
-(aa.)Rsinh
Real-valued sinh().
-(aa.)Ratanh
Real-valued atanh().
-(aa.)ADAA1
Generalised first-order ADAA function.
-_ : ADAA1(EPS, f, F1) : _
-
-Where:
-EPS
: a threshold to handle ill-conditioned casesf
: a function that we want to process with ADAAF1
: f's first antiderivative(aa.)ADAA2
Generalised second-order ADAA function.
-_ : ADAA2(EPS, f, F1, F2) : _
-
-Where:
-EPS
: a threshold to handle ill-conditioned casesf
: a function that we want to process with ADAAF1
: f's first antiderivativeF2
: f's second antiderivativeThese antialiased saturators perform best with high-amplitude input -signals. If the input is only slightly saturated, hence producing -negligible aliasing, the trivial saturator may result in a better -overall output, as noise can be introduced by first and second ADAA -at low amplitudes.
-Once determining the lowest saturation level for which the antialiased -functions perform adequately, it might be sensible to cross-fade -between the trivial and the antialiased saturators according to the -amplitude profile of the input signal.
-(aa.)hardclip
First-order ADAA hard-clip.
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.hardclip : _
-
-(aa.)hardclip2
Second-order ADAA hard-clip.
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.hardclip2 : _
-
-(aa.)cubic1
First-order ADAA cubic saturator.
-The domain of this function is ℝ; its theoretical range is -[-2.0/3.0; 2.0/3.0].
-_ : aa.cubic1 : _
-
-(aa.)parabolic
First-order ADAA parabolic saturator.
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.parabolic : _
-
-(aa.)parabolic2
Second-order ADAA parabolic saturator.
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.parabolic : _
-
-(aa.)hyperbolic
First-order ADAA hyperbolic saturator.
-The domain of this function is ℝ; its theoretical range is ]-1.0; 1.0[.
-_ : aa.hyperbolic : _
-
-(aa.)hyperbolic2
Second-order ADAA hyperbolic saturator.
-The domain of this function is ℝ; its theoretical range is ]-1.0; 1.0[.
-_ : aa.hyperbolic2 : _
-
-(aa.)sinarctan
First-order ADAA sin(atan()) saturator.
-The domain of this function is ℝ; its theoretical range is ]-1.0; 1.0[.
-_ : aa.sinatan : _
-
-(aa.)sinarctan2
Second-order ADAA sin(atan()) saturator.
-The domain of this function is ℝ; its theoretical range is ]-1.0; 1.0[.
-_ : aa.sinarctan2 : _
-
-(aa.)tanh1
First-order ADAA tanh() saturator.
-The domain of this function is ℝ; its theoretical range is ]-1.0; 1.0[.
-_ : aa.tanh1 : _
-
-(aa.)arctan
First-order ADAA atan().
-The domain of this function is ℝ; its theoretical range is ]-π/2.0; π/2.0[.
-_ : aa.arctan : _
-
-(aa.)arctan2
Second-order ADAA atan().
-The domain of this function is ℝ; its theoretical range is ]-π/2.0; π/2.0[.
-_ : aa.arctan2 : _
-
-(aa.)asinh1
First-order ADAA asinh() saturator (unbounded).
-The domain of this function is ℝ; its theoretical range is ℝ.
-_ : aa.asinh1 : _
-
-(aa.)asinh2
Second-order ADAA asinh() saturator (unbounded).
-The domain of this function is ℝ; its theoretical range is ℝ.
-_ : aa.asinh2 : _
-
-These functions are reliable if input signals are within their domains.
-(aa.)cosine1
First-order ADAA cos().
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.cosine1 : _
-
-(aa.)cosine2
Second-order ADAA cos().
-The domain of this function is ℝ; its theoretical range is [-1.0; 1.0].
-_ : aa.cosine2 : _
-
-(aa.)arccos
First-order ADAA acos().
-The domain of this function is [-1.0; 1.0]; its theoretical range is -[π; 0.0].
-_ : aa.arccos : _
-
-(aa.)arccos2
Second-order ADAA acos().
-The domain of this function is [-1.0; 1.0]; its theoretical range is -[π; 0.0].
-Note that this function is not accurate for low-amplitude or low-frequency -input signals. In that case, the first-order ADAA arccos() can be used.
-_ : aa.arccos2 : _
-
-(aa.)acosh1
First-order ADAA acosh().
-The domain of this function is ℝ >= 1.0; its theoretical range is ℝ >= 0.0.
-_ : aa.acosh1 : _
-
-(aa.)acosh2
Second-order ADAA acosh().
-The domain of this function is ℝ >= 1.0; its theoretical range is ℝ >= 0.0.
-Note that this function is not accurate for low-frequency input signals. -In that case, the first-order ADAA acosh() can be used.
-_ : aa.acosh2 : _
-
-(aa.)sine
First-order ADAA sin().
-The domain of this function is ℝ; its theoretical range is ℝ.
-_ : aa.sine : _
-
-(aa.)sine2
Second-order ADAA sin().
-The domain of this function is ℝ; its theoretical range is ℝ.
-_ : aa.sine2 : _
-
-(aa.)arcsin
First-order ADAA asin().
-The domain of this function is [-1.0, 1.0]; its theoretical range is -[-π/2.0; π/2.0].
-_ : aa.arcsin : _
-
-(aa.)arcsin2
Second-order ADAA asin().
-The domain of this function is [-1.0, 1.0]; its theoretical range is -[-π/2.0; π/2.0].
-Note that this function is not accurate for low-frequency input signals. -In that case, the first-order ADAA asin() can be used.
-_ : aa.arcsin2 : _
-
-(aa.)tangent
First-order ADAA tan().
-The domain of this function is [-π/2.0; π/2.0]; its theoretical range is ℝ.
-_ : aa.tangent : _
-
-(aa.)atanh1
First-order ADAA atanh().
-The domain of this function is ]-1.0; 1.0[; its theoretical range is ℝ.
-_ : aa.atanh1 : _
-
-(aa.)atanh2
Second-order ADAA atanh().
-The domain of this function is ]-1.0; 1.0[; its theoretical range is ℝ.
-_ : aa.atanh2 : _
-
Welcome to the documentation for aanl.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-The purpose of this library is to give access to all the Faust standard libraries -from a single point.
Welcome to the documentation for all.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Analyzers library. Its official prefix is an
.
(an.)abs_envelope_rect
Absolute value average with moving-average algorithm.
-_ : abs_envelope_rect(period) : _
-
-Where:
-period
: sets the averaging frame in seconds(an.)abs_envelope_tau
Absolute value average with one-pole lowpass and tau response -(see filters.lib).
-_ : abs_envelope_tau(period) : _
-
-Where:
-period
: (time to decay by 1/e) sets the averaging frame in secs(an.)abs_envelope_t60
Absolute value average with one-pole lowpass and t60 response -(see filters.lib).
-_ : abs_envelope_t60(period) : _
-
-Where:
-period
: (time to decay by 60 dB) sets the averaging frame in secs(an.)abs_envelope_t19
Absolute value average with one-pole lowpass and t19 response -(see filters.lib).
-_ : abs_envelope_t19(period) : _
-
-Where:
-period
: (time to decay by 1/e^2.2) sets the averaging frame in secs(an.)amp_follower
Classic analog audio envelope follower with infinitely fast rise and -exponential decay. The amplitude envelope instantaneously follows -the absolute value going up, but then floats down exponentially.
-amp_follower
is a standard Faust function.
_ : amp_follower(rel) : _
-
-Where:
-rel
: release time = amplitude-envelope time-constant (sec) going down(an.)amp_follower_ud
Envelope follower with different up and down time-constants -(also called a "peak detector").
- _ : amp_follower_ud(att,rel) : _
-
-Where:
-att
: attack time = amplitude-envelope time constant (sec) going uprel
: release time = amplitude-envelope time constant (sec) going downWe assume rel >> att. Otherwise, consider rel ~ max(rel,att).
-For audio, att is normally faster (smaller) than rel (e.g., 0.001 and 0.01).
-Use amp_follower_ar
below to remove this restriction.
(an.)amp_follower_ar
Envelope follower with independent attack and release times. The
-release can be shorter than the attack (unlike in amp_follower_ud
-above).
_ : amp_follower_ar(att,rel) : _
-
-Where:
-att
: attack time = amplitude-envelope time constant (sec) going uprel
: release time = amplitude-envelope time constant (sec) going down(an.)ms_envelope_rect
Mean square with moving-average algorithm.
-_ : ms_envelope_rect(period) : _
-
-Where:
-period
: sets the averaging frame in secs(an.)ms_envelope_tau
Mean square average with one-pole lowpass and tau response -(see filters.lib).
-_ : ms_envelope_tau(period) : _
-
-Where:
-period
: (time to decay by 1/e) sets the averaging frame in secs(an.)ms_envelope_t60
Mean square with one-pole lowpass and t60 response -(see filters.lib).
-_ : ms_envelope_t60(period) : _
-
-Where:
-period
: (time to decay by 60 dB) sets the averaging frame in secs(an.)ms_envelope_t19
Mean square with one-pole lowpass and t19 response -(see filters.lib).
-_ : ms_envelope_t19(period) : _
-
-Where:
-period
: (time to decay by 1/e^2.2) sets the averaging frame in secs(an.)rms_envelope_rect
Root mean square with moving-average algorithm.
-_ : rms_envelope_rect(period) : _
-
-Where:
-period
: sets the averaging frame in secs(an.)rms_envelope_tau
Root mean square with one-pole lowpass and tau response -(see filters.lib).
-_ : rms_envelope_tau(period) : _
-
-Where:
-period
: (time to decay by 1/e) sets the averaging frame in secs(an.)rms_envelope_t60
Root mean square with one-pole lowpass and t60 response -(see filters.lib).
-_ : rms_envelope_t60(period) : _
-
-Where:
-period
: (time to decay by 60 dB) sets the averaging frame in secs(an.)rms_envelope_t19
Root mean square with one-pole lowpass and t19 response -(see filters.lib).
-_ : rms_envelope_t19(period) : _
-
-Where:
-period
: (time to decay by 1/e^2.2) sets the averaging frame in secs(an.)zcr
Zero-crossing rate (ZCR) with one-pole lowpass averaging based on the tau -constant. It outputs an index between 0 and 1 at a desired analysis frame. -The ZCR of a signal correlates with the noisiness [Gouyon et al. 2000] and -the spectral centroid [Herrera-Boyer et al. 2006] of a signal. -For sinusoidal signals, the ZCR can be multiplied by ma.SR/2 and used -as a frequency detector. For example, it can be deployed as a -computationally efficient adaptive mechanism for automatic Larsen -suppression.
-_ : zcr(tau) : _
-
-Where:
-tau
: (time to decay by e^-1) sets the averaging frame in seconds.(an.)pitchTracker
This function implements a pitch-tracking algorithm by means of -zero-crossing rate analysis and adaptive low-pass filtering. The design -is based on the algorithm described in this tutorial (section 2.2).
-_ : pitchTracker(N, tau) : _
-
-Where:
-N
: a constant numerical expression, sets the order of the low-pass filter, which
- determines the sensitivity of the algorithm for signals where partials are
- stronger than the fundamental frequency.tau
: response time in seconds based on exponentially-weighted averaging with tau time-constant. See https://ccrma.stanford.edu/~jos/st/Exponentials.html.(an.)spectralCentroid
This function implements a time-domain spectral centroid by means of RMS -measurements and adaptive crossover filtering. The weight difference of the -upper and lower spectral powers are used to recursively adjust the crossover -cutoff so that the system (minimally) oscillates around a balancing point.
-Unlike block processing techniques such as FFT, this algorithm provides -continuous measurements and fast response times. Furthermore, when providing -input signals that are spectrally sparse, the algorithm will output a -logarithmic measure of the centroid, which is perceptually desirable for -musical applications. For example, if the input signal is the combination -of three tones at 1000, 2000, and 4000 Hz, the centroid will be the middle -octave.
-_ : spectralCentroid(nonlinearity, tau) : _
-
-Where:
-nonlinearity
: a boolean to activate or deactivate nonlinear integration. The
- nonlinear function is useful to improve stability with very short response times
- such as .001 <= tau <= .005 , otherwise, the nonlinearity may reduce precision.tau
: response time in seconds based on exponentially-weighted averaging with tau time-constant. See https://ccrma.stanford.edu/~jos/st/Exponentials.html.Sanfilippo, D. (2021). Time-Domain Adaptive Algorithms for Low- and High-Level - Audio Information Processing. Computer Music Journal, 45(1), 24-38.
-process = os.osc(500) + os.osc(1000) + os.osc(2000) + os.osc(4000) + os.osc(8000) : an.spectralCentroid(1, .001);
Spectrum-analyzers split the input signal into a bank of parallel signals, one for
-each spectral band. They are related to the Mth-Octave Filter-Banks in filters.lib
.
-The documentation of this library contains more details about the implementation.
-The parameters are:
M
: number of band-slices per octave (>1)N
: total number of bands (>2)ftop
= upper bandlimit of the Mth-octave bands (<SR/2)In addition to the Mth-octave output signals, there is a highpass signal -containing frequencies from ftop to SR/2, and a "dc band" lowpass signal -containing frequencies from 0 (dc) up to the start of the Mth-octave bands. -Thus, the N output signals are:
-highpass(ftop), MthOctaveBands(M,N-2,ftop), dcBand(ftop*2^(-M*(N-1)))
-
-A Spectrum-Analyzer is defined here as any band-split whose bands span -the relevant spectrum, but whose band-signals do not -necessarily sum to the original signal, either exactly or to within an -allpass filtering. Spectrum analyzer outputs are normally at least nearly -"power complementary", i.e., the power spectra of the individual bands -sum to the original power spectrum (to within some negligible tolerance).
-Go to higher filter orders - see Regalia et al. or Vaidyanathan (cited -below) regarding the construction of more aggressive recursive -filter-banks using elliptic or Chebyshev prototype filters.
-(an.)mth_octave_analyzer
Octave analyzer.
-mth_octave_analyzer[N]
are standard Faust functions.
_ : mth_octave_analyzer(O,M,ftop,N) : par(i,N,_) // Oth-order Butterworth
-_ : mth_octave_analyzer6e(M,ftop,N) : par(i,N,_) // 6th-order elliptic
-
-Also for convenience:
-_ : mth_octave_analyzer3(M,ftop,N) : par(i,N,_) // 3d-order Butterworth
-_ : mth_octave_analyzer5(M,ftop,N) : par(i,N,_) // 5th-order Butterworth
-mth_octave_analyzer_default = mth_octave_analyzer6e;
-
-Where:
-O
: (odd) order of filter used to split each frequency band into twoM
: number of band-slices per octaveftop
: highest band-split crossover frequency (e.g., 20 kHz)N
: total number of bands (including dc and Nyquist)Spectral Level: display (in bargraphs) the average signal level in each spectral band.
-(an.)mth_octave_spectral_level6e
Spectral level display.
-_ : mth_octave_spectral_level6e(M,ftop,NBands,tau,dB_offset) : _
-
-Where:
-M
: bands per octaveftop
: lower edge frequency of top bandNBands
: number of passbands (including highpass and dc bands),tau
: spectral display averaging-time (time constant) in seconds,dB_offset
: constant dB offset in all band level meters.Also for convenience:
-mth_octave_spectral_level_default = mth_octave_spectral_level6e;
-spectral_level = mth_octave_spectral_level(2,10000,20);
-
-(an.)[third|half]_octave_[analyzer|filterbank]
A bunch of special cases based on the different analyzer functions described above:
-third_octave_analyzer(N) = mth_octave_analyzer_default(3,10000,N);
-third_octave_filterbank(N) = mth_octave_filterbank_default(3,10000,N);
-half_octave_analyzer(N) = mth_octave_analyzer_default(2,10000,N);
-half_octave_filterbank(N) = mth_octave_filterbank_default(2,10000,N);
-octave_filterbank(N) = mth_octave_filterbank_default(1,10000,N);
-octave_analyzer(N) = mth_octave_analyzer_default(1,10000,N);
-
-See mth_octave_spectral_level_demo
in demos.lib
.
These are similar to the Mth-octave analyzers above, except that the -band-split frequencies are passed explicitly as arguments.
-(an.)analyzer
Analyzer.
-_ : analyzer(O,freqs) : par(i,N,_) // No delay equalizer
-
-Where:
-O
: band-split filter order (ODD integer required for filterbank[i])freqs
: (fc1,fc2,...,fcNs) [in numerically ascending order], where
- Ns=N-1 is the number of octave band-splits
- (total number of bands N=Ns+1).If frequencies are listed explicitly as arguments, enclose them in parens:
-_ : analyzer(3,(fc1,fc2)) : _,_,_
-
-Sliding FFTs that compute a rectangularly windowed FFT each sample.
-(an.)goertzelOpt
Optimized Goertzel filter.
-_ : goertzelOpt(freq,n) : _
-
-Where:
-freq
: frequency to be analyzedn
: the Goertzel block size(an.)goertzelComp
Complex Goertzel filter.
-_ : goertzelComp(freq,n) : _
-
-Where:
-freq
: frequency to be analyzedn
: the Goertzel block size(an.)goertzel
Same as goertzelOpt
.
_ : goertzel(freq,n) : _
-
-Where:
-freq
: frequency to be analyzedn
: the Goertzel block size(an.)fft
Fast Fourier Transform (FFT).
-si.cbus(N) : fft(N) : si.cbus(N)
-
-Where:
-si.cbus(N)
is a bus of N complex signals, each specified by real and imaginary parts:
- (r0,i0), (r1,i1), (r2,i2), ...N
is the FFT size (must be a power of 2: 2,4,8,16,... known at compile time) fft(N)
performs a length N
FFT for complex signals (radix 2)FFTs of Real Signals:
-process = signal : an.rtocv(N) : an.fft(N);
-
-where an.rtocv
converts a real (scalar) signal to a complex vector signal having a zero imaginary part.
See an.rfft_analyzer_c
(in analyzers.lib
) and related functions for more detailed usage examples.
Use an.rfft_spectral_level(N,tau,dB_offset)
to display the power spectrum of a real signal.
See dm.fft_spectral_level_demo(N)
in demos.lib
for an example GUI driving an.rfft_spectral_level()
.
(an.)ifft
Inverse Fast Fourier Transform (IFFT).
-si.cbus(N) : ifft(N) : si.cbus(N)
-
-Where:
-Welcome to the documentation for analyzers.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of basic elements. Its official prefix is ba
.
(ba.)samp2sec
Converts a number of samples to a duration in seconds at the current sampling rate (see ma.SR
).
-samp2sec
is a standard Faust function.
samp2sec(n) : _
-
-Where:
-n
: number of samples(ba.)sec2samp
Converts a duration in seconds to a number of samples at the current sampling rate (see ma.SR
).
-samp2sec
is a standard Faust function.
sec2samp(d) : _
-
-Where:
-d
: duration in seconds(ba.)db2linear
dB-to-linear value converter. It can be used to convert an amplitude in dB to a linear gain ]0-N].
-db2linear
is a standard Faust function.
db2linear(l) : _
-
-Where:
-l
: amplitude in dB(ba.)linear2db
linea-to-dB value converter. It can be used to convert a linear gain ]0-N] to an amplitude in dB.
-linear2db
is a standard Faust function.
linear2db(g) : _
-
-Where:
-g
: a linear gain(ba.)lin2LogGain
Converts a linear gain (0-1) to a log gain (0-1).
-lin2LogGain(n) : _
-
-Where:
-n
: the linear gain(ba.)log2LinGain
Converts a log gain (0-1) to a linear gain (0-1).
-log2LinGain(n) : _
-
-Where:
-n
: the log gain(ba.)tau2pole
Returns a real pole giving exponential decay.
-Note that t60 (time to decay 60 dB) is ~6.91 time constants.
-tau2pole
is a standard Faust function.
_ : smooth(tau2pole(tau)) : _
-
-Where:
-tau
: time-constant in seconds(ba.)pole2tau
Returns the time-constant, in seconds, corresponding to the given real,
-positive pole in (0-1).
-pole2tau
is a standard Faust function.
pole2tau(pole) : _
-
-Where:
-pole
: the pole(ba.)midikey2hz
Converts a MIDI key number to a frequency in Hz (MIDI key 69 = A440).
-midikey2hz
is a standard Faust function.
midikey2hz(mk) : _
-
-Where:
-mk
: the MIDI key number(ba.)hz2midikey
Converts a frequency in Hz to a MIDI key number (MIDI key 69 = A440).
-hz2midikey
is a standard Faust function.
hz2midikey(freq) : _
-
-Where:
-freq
: frequency in Hz(ba.)semi2ratio
Converts semitones in a frequency multiplicative ratio.
-semi2ratio
is a standard Faust function.
semi2ratio(semi) : _
-
-Where:
-semi
: number of semitone(ba.)ratio2semi
Converts a frequency multiplicative ratio in semitones.
-ratio2semi
is a standard Faust function.
ratio2semi(ratio) : _
-
-Where:
-ratio
: frequency multiplicative ratio(ba.)cent2ratio
Converts cents in a frequency multiplicative ratio.
-cent2ratio(cent) : _
-
-Where:
-cent
: number of cents(ba.)ratio2cent
Converts a frequency multiplicative ratio in cents.
-ratio2cent(ratio) : _
-
-Where:
-ratio
: frequency multiplicative ratio(ba.)pianokey2hz
Converts a piano key number to a frequency in Hz (piano key 49 = A440).
-pianokey2hz(pk) : _
-
-Where:
-pk
: the piano key number(ba.)hz2pianokey
Converts a frequency in Hz to a piano key number (piano key 49 = A440).
-hz2pianokey(freq) : _
-
-Where:
-freq
: frequency in Hz(ba.)counter
Starts counting 0, 1, 2, 3..., and raise the current integer value -at each upfront of the trigger.
-counter(trig) : _
-
-Where:
-trig
: the trigger signal, each upfront will move the counter to the next integer(ba.)countdown
Starts counting down from n included to 0. While trig is 1 the output is n.
-The countdown starts with the transition of trig from 1 to 0. At the end
-of the countdown the output value will remain at 0 until the next trig.
-countdown
is a standard Faust function.
countdown(n,trig) : _
-
-Where:
-n
: the starting point of the countdowntrig
: the trigger signal (1: start at n
; 0: decrease until 0)(ba.)countup
Starts counting up from 0 to n included. While trig is 1 the output is 0.
-The countup starts with the transition of trig from 1 to 0. At the end
-of the countup the output value will remain at n until the next trig.
-countup
is a standard Faust function.
countup(n,trig) : _
-
-Where:
-n
: the maximum count valuetrig
: the trigger signal (1: start at 0; 0: increase until n
)(ba.)sweep
Counts from 0 to period-1
repeatedly, generating a
-sawtooth waveform, like os.lf_rawsaw
,
-starting at 1 when run
transitions from 0 to 1.
-Outputs zero while run
is 0.
sweep(period,run) : _
-
-(ba.)time
A simple timer that counts every samples from the beginning of the process.
-time
is a standard Faust function.
time : _
-
-(ba.)ramp
A linear ramp with a slope of '(+/-)1/n' samples to reach the next target value.
-_ : ramp(n) : _
-
-Where:
-n
: number of samples to increment/decrement the value by one(ba.)line
A ramp interpolator that generates a linear transition to reach a target value:
-_ : line(n) : _
-
-Where:
-n
: number of samples to reach the new target received at its input(ba.)tempo
Converts a tempo in BPM into a number of samples.
-tempo(t) : _
-
-Where:
-t
: tempo in BPM(ba.)period
Basic sawtooth wave of period p
.
period(p) : _
-
-Where:
-p
: period as a number of samples(ba.)spulse
Produces a single pulse of n samples when trig goes from 0 to 1.
-spulse(n,trig) : _
-
-Where:
-n
: pulse length as a number of samplestrig
: the trigger signal (1: start the pulse)(ba.)pulse
Pulses (like 10000) generated at period p
.
pulse(p) : _
-
-Where:
-p
: period as a number of samples(ba.)pulsen
Pulses (like 11110000) of length n
generated at period p
.
pulsen(n,p) : _
-
-Where:
-n
: pulse length as a number of samplesp
: period as a number of samples(ba.)cycle
Split nonzero input values into n
cycles.
_ : cycle(n) : si.bus(n)
-
-Where:
-n
: the number of cycles/output signals(ba.)beat
Pulses at tempo t
.
-beat
is a standard Faust function.
beat(t) : _
-
-Where:
-t
: tempo in BPM(ba.)pulse_countup
Starts counting up pulses. While trig is 1 the output is -counting up, while trig is 0 the counter is reset to 0.
-_ : pulse_countup(trig) : _
-
-Where:
-trig
: the trigger signal (1: start at next pulse; 0: reset to 0)(ba.)pulse_countdown
Starts counting down pulses. While trig is 1 the output is -counting down, while trig is 0 the counter is reset to 0.
-_ : pulse_countdown(trig) : _
-
-Where:
-trig
: the trigger signal (1: start at next pulse; 0: reset to 0)(ba.)pulse_countup_loop
Starts counting up pulses from 0 to n included. While trig is 1 the output is -counting up, while trig is 0 the counter is reset to 0. At the end -of the countup (n) the output value will be reset to 0.
-_ : pulse_countup_loop(n,trig) : _
-
-Where:
-n
: the highest number of the countup (included) before reset to 0trig
: the trigger signal (1: start at next pulse; 0: reset to 0)(ba.)pulse_countdown_loop
Starts counting down pulses from 0 to n included. While trig is 1 the output -is counting down, while trig is 0 the counter is reset to 0. At the end -of the countdown (n) the output value will be reset to 0.
-_ : pulse_countdown_loop(n,trig) : _
-
-Where:
-n
: the highest number of the countup (included) before reset to 0trig
: the trigger signal (1: start at next pulse; 0: reset to 0)(ba.)resetCtr
Function that lets through the mth impulse out of
-each consecutive group of n
impulses.
_ : resetCtr(n,m) : _
-
-Where:
-n
: the total number of impulses being splitm
: index of impulse to allow to be output(ba.)count
Count the number of elements of list l.
-count
is a standard Faust function.
count(l)
-count((10,20,30,40)) -> 4
-
-Where:
-l
: list of elements(ba.)take
Take an element from a list.
-take
is a standard Faust function.
take(P,l)
-take(3,(10,20,30,40)) -> 30
-
-Where:
-P
: position (int, known at compile time, P > 0)l
: list of elements(ba.)subseq
Extract a part of a list.
-subseq(l, P, N)
-subseq((10,20,30,40,50,60), 1, 3) -> (20,30,40)
-subseq((10,20,30,40,50,60), 4, 1) -> 50
-
-Where:
-l
: listP
: start point (int, known at compile time, 0: begin of list)N
: number of elements (int, known at compile time)Faust doesn't have proper lists. Lists are simulated with parallel -compositions and there is no empty list.
-The purpose of function tabulation is to speed up the computation of heavy functions over an interval, -so that the computation at runtime can be faster than directly using the function. -Two techniques are implemented:
-tabulate
computes the function in a table and read the points using interpolation. tabulateNd
is the N dimensions version of tabulate
tabulate_chebychev
uses Chebyshev polynomial approximation
process = line(50000, r0, r1) <: FX-tb,FX-ch : par(i, 2, maxerr)
-with {
- C = 0;
- FX = sin;
- NX = 50;
- CD = 3;
- r0 = 0;
- r1 = ma.PI;
- tb(x) = ba.tabulate(C, FX, NX*(CD+1), r0, r1, x).cub;
- ch(x) = ba.tabulate_chebychev(C, FX, NX, CD, r0, r1, x);
- maxerr = abs : max ~ _;
- line(n, x0, x1) = x0 + (ba.time%n)/n * (x1-x0);
-};
-
-(ba.)tabulate
Tabulate a 1D function over the range [r0, r1] for access via nearest-value, linear, cubic interpolation. -In other words, the uniformly tabulated function can be evaluated using interpolation of order 0 (none), 1 (linear), or 3 (cubic).
-tabulate(C, FX, S, r0, r1, x).(val|lin|cub) : _
-
-C
: whether to dynamically force the x
value to the range [r0, r1]: 1 forces the check, 0 deactivates it (constant numerical expression)FX
: unary function Y=F(X) with one output (scalar function of one variable) S
: size of the table in samples (constant numerical expression)r0
: minimum value of argument xr1
: maximum value of argument xtabulate(C, FX, S, r0, r1, x).val uses the value in the table closest to x
-
-tabulate(C, FX, S, r0, r1, x).lin evaluates at x using linear interpolation between the closest stored values
-
-tabulate(C, FX, S, r0, r1, x).cub evaluates at x using cubic interpolation between the closest stored values
-
-midikey2hz(mk) = ba.tabulate(1, ba.midikey2hz, 512, 0, 127, mk).lin;
-process = midikey2hz(ba.time), ba.midikey2hz(ba.time);
-
-(ba.)tabulate_chebychev
Tabulate a 1D function over the range [r0, r1] for access via Chebyshev polynomial approximation.
-In contrast to (ba.)tabulate
, which interpolates only between tabulated samples, (ba.)tabulate_chebychev
-stores coefficients of Chebyshev polynomials that are evaluated to provide better approximations in many cases.
-Two new arguments controlling this are NX, the number of segments into which [r0, r1] is divided, and CD,
-the maximum Chebyshev polynomial degree to use for each segment. A rdtable
of size NX*(CD+1) is internally used.
Note that processing r1
the last point in the interval is not safe. So either be sure the input stays in [r0, r1[
-or use C = 1
.
_ : tabulate_chebychev(C, FX, NX, CD, r0, r1) : _
-
-C
: whether to dynamically force the value to the range [r0, r1]: 1 forces the check, 0 deactivates it (constant numerical expression)FX
: unary function Y=F(X) with one output (scalar function of one variable)NX
: number of segments for uniformly partitioning [r0, r1] (constant numerical expression)CD
: maximum polynomial degree for each Chebyshev polynomial (constant numerical expression)r0
: minimum value of argument xr1
: maximum value of argument xmidikey2hz_chebychev(mk) = ba.tabulate_chebychev(1, ba.midikey2hz, 100, 4, 0, 127, mk);
-process = midikey2hz_chebychev(ba.time), ba.midikey2hz(ba.time);
-
-(ba.)tabulateNd
Tabulate an nD function for access via nearest-value or linear or cubic interpolation. In other words, the tabulated function can be evaluated using interpolation of order 0 (none), 1 (linear), or 3 (cubic).
-The table size and parameter range of each dimension can and must be separately specified. You can use it anywhere you have an expensive function with multiple parameters with known ranges. You could use it to build a wavetable synth, for example.
-The number of dimensions is deduced from the number of parameters you give, see below.
-Note that processing the last point in each interval is not safe. So either be sure the inputs stay in their respective ranges, or use C = 1
. Similarly for the first point when doing cubic interpolation.
tabulateNd(C, function, (parameters) ).(val|lin|cub) : _
-
-C
: whether to dynamically force the parameter values for each dimension to the ranges specified in parameters: 1 forces the check, 0 deactivates it (constant numerical expression)function
: the function we want to tabulate. Can have any number of inputs, but needs to have just one output.(parameters)
: sizes, ranges and read values. Note: these need to be in brackets, to make them one entity. If N is the number of dimensions, we need:
-S
: number of values to store for this dimension (constant numerical expression)r0
: minimum value of this dimensionr1
: maximum value of this dimensionx
: read value of this dimensionBy providing these parameters, you indirectly specify the number of dimensions; it's the number of parameters divided by 4.
-The user facing functions are:
-tabulateNd(C, function, S, parameters).val
-
-tabulateNd(C, function, S, parameters).lin
-
-tabulateNd(C, function, S, parameters).cub
-
-powSin(x,y) = sin(pow(x,y)); // The function we want to tabulate
-powSinTable(x,y) = ba.tabulateNd(1, powSin, (sizeX,sizeY, rx0,ry0, rx1,ry1, x,y) ).lin;
-sizeX = 512; // table size of the first parameter
-sizeY = 512; // table size of the second parameter
-rx0 = 2; // start of the range of the first parameter
-ry0 = 2; // start of the range of the second parameter
-rx1 = 10; // end of the range of the first parameter
-ry1 = 10; // end of the range of the second parameter
-x = hslider("x", rx0, rx0, rx1, 0.001):si.smoo;
-y = hslider("y", ry0, ry0, ry1, 0.001):si.smoo;
-process = powSinTable(x,y), powSin(x,y);
-
-The .val
function just outputs the closest stored value.
-The .lin
and .cub
functions interpolate in N dimensions.
To understand what it means to interpolate in N dimensions, here's a quick reminder on the general principle of 2D linear interpolation:
-Then, we perform linear interpolation in the x-direction between points A and B, and between points C and D. This gives us two new points E and F. Finally, we perform linear interpolation in the y-direction between points E and F to get our value.
-To implement this in Faust, we need N sequential groups of interpolators, where N is the number of dimensions.
-Each group feeds into the next, with the last "group" being a single interpolator, and the group before it containing one interpolator for each input of the group it's feeding.
Some examples:
-To understand which values we need to look up, let's consider the 2D linear example again. -The four values going into the first group represent the four closest points (A, B, C, D) mentioned above.
-1) The first interpolator gets:
-2) The second interpolator gets:
-The outputs of these two interpolators are points E and F. -In other words: the interpolated x values and, respectively, the following y values:
-The last interpolator takes these two values and interpolates them in the y dimension.
-To generalize for N dimensions and linear interpolation:
-The same principle applies to the cubic interpolation in nD. The only difference is that there would be 4^(n-1) parallel interpolators in the first group, compared to 2^(n-1) for linear interpolation.
-This is what the mixers
function does.
Besides the values, each interpolator also needs to know the weight of each value in it's output.
-Let's call this d
, like in ba.interpolate
. It is the same for each group of interpolators, since it correlates to a dimension.
-It's value is calculated the similarly to ba.interpolate
:
id
in ba.tabulate
)int
the float index to get the value we have stored that is closest to, but lower than the input value; the actual index for that dimension.
-Our d
is the difference between the float index and the actual index.The ids
function calculates the id
for each dimension and inside the mixer
function they get turned into d
s.
The elephant in the room is: how do we get these indexes? For that we need to know how the values are stored. -We use one big table to store everything.
-To understand the concept, let's look at the 2D example again, and then we'll extend it to 3d and the general nD case.
-Let's say we have a 2D table with dimensions A and B where: -A has 3 values between 0 and 5 and B has 4 values between 0 and 1. -The 1D array representation of this 2D table will have a size of 3 * 4 = 12.
-The values are stored in the following way:
-For the 3D example, let's extend the 2D example with an additional dimension C having 2 values between 0 and 2. -The total size will be 3 * 4 * 2 = 24.
-The values are stored like so:
-The last 12 values are the same as the first 12, but with C at 2.
-For the general n-dimensional case, we iterate through all dimensions, changing the values of the innermost dimension first, then moving towards the outer dimensions.
-To get the float read index (id
) corresponding to a particular dimension, we scale the function input value to be between 0 and 1, and multiply it by the size of that dimension minus one.
To understand how we get the readIndex
for .val
, let's work trough how we'd do it in our 2D linear example.
-For simplicity's sake, the ranges of the inputs to our function
are both 0 to 1.
-Say we wanted to read the value closest to x=0.5
and y=0
, so the id
of x
is 1
(the second value) and the id
of y
is 0 (first value). In this case, the read index is just the id
of x
, rounded to the nearest integer, just like in ba.tabulate
.
If we want to read the value belonging to x=0.5
and y=2/3
, things get more complicated. The id
for y
is now 2
, the third value. For each step in the y
direction, we need to increase the index by 3
, the number of values that are stored for x
. So the influence of the y
is: the size of x
times the rounded id
of y
. The final read index is the rounded id
of x
plus the influence of y
.
For the general nD case, we need to do the same operation N times, each feeding into the next. This operation is the riN
function. We take four parameters: the size of the dimension before it prevSize
, the index of the previous dimension prevIX
, the current size sizeX
and the current id idX
. riN
has 2 outputs, the size, for feeding into the next dimension's prevSize
, and the read index feeding into the next dimension's prevIX
.
-The size is the sizeX
times prevSize
. The read index is the rounded idX
times prevSize
added to the prevIX
. Our final readIndex
is the read index output of the last dimension.
To get the read values for the interpolators need a pattern of offsets in each dimension, since we are looking for the read indexes surrounding the point of interest. These offsets are best explained by looking at the code of tabulate2d
, the hardcoded 2D version:
tabulate2d(C,function, sizeX,sizeY, rx0,ry0, rx1,ry1, x,y) =
- environment {
- size = sizeX*sizeY;
- // Maximum X index to access
- midX = sizeX-1;
- // Maximum Y index to access
- midY = sizeY-1;
- // Maximum total index to access
- mid = size-1;
- // Create the table
- wf = function(wfX,wfY);
- // Prepare the 'float' table read index for X
- idX = (x-rx0)/(rx1-rx0)*midX;
- // Prepare the 'float' table read index for Y
- idY = ((y-ry0)/(ry1-ry0))*midY;
- // table creation X:
- wfX =
- rx0+float(ba.time%sizeX)*(rx1-rx0)
- /float(midX);
- // table creation Y:
- wfY =
- ry0+
- ((float(ba.time-(ba.time%sizeX))
- /float(sizeX))
- *(ry1-ry0))
- /float(midY);
-
- // Limit the table read index in [0, mid] if C = 1
- rid(x,mid, 0) = x;
- rid(x,mid, 1) = max(0, min(x, mid));
-
- // Tabulate a binary 'FX' function on a range [rx0, rx1] [ry0, ry1]
- val(x,y) =
- rdtable(size, wf, readIndex);
- readIndex =
- rid(
- rid(int(idX+0.5),midX, C)
- +yOffset
- , mid, C);
- yOffset = sizeX*rid(int(idY),midY,C);
-
- // Tabulate a binary 'FX' function over the range [rx0, rx1] [ry0, ry1] with linear interpolation
- lin =
- it.interpolate_linear(
- dy
- , it.interpolate_linear(dx,v0,v1)
- , it.interpolate_linear(dx,v2,v3))
- with {
- i0 = rid(int(idX), midX, C)+yOffset;
- i1 = i0+1;
- i2 = i0+sizeX;
- i3 = i1+sizeX;
- dx = idX-int(idX);
- dy = idY-int(idY);
- v0 = rdtable(size, wf, rid(i0, mid, C));
- v1 = rdtable(size, wf, rid(i1, mid, C));
- v2 = rdtable(size, wf, rid(i2, mid, C));
- v3 = rdtable(size, wf, rid(i3, mid, C));
- };
-
- // Tabulate a binary 'FX' function over the range [rx0, rx1] [ry0, ry1] with cubic interpolation
- cub =
- it.interpolate_cubic(
- dy
- , it.interpolate_cubic(dx,v0,v1,v2,v3)
- , it.interpolate_cubic(dx,v4,v5,v6,v7)
- , it.interpolate_cubic(dx,v8,v9,v10,v11)
- , it.interpolate_cubic(dx,v12,v13,v14,v15)
- )
- with {
- i0 = i4-sizeX;
- i1 = i5-sizeX;
- i2 = i6-sizeX;
- i3 = i7-sizeX;
-
- i4 = i5-1;
- i5 = rid(int(idX), midX, C)+yOffset;
- i6 = i5+1;
- i7 = i6+1;
-
- i8 = i4+sizeX;
- i9 = i5+sizeX;
- i10 = i6+sizeX;
- i11 = i7+sizeX;
-
- i12 = i4+(2*sizeX);
- i13 = i5+(2*sizeX);
- i14 = i6+(2*sizeX);
- i15 = i7+(2*sizeX);
-
- dx = idX-int(idX);
- dy = idY-int(idY);
- v0 = rdtable(size, wf, rid(i0 , mid, C));
- v1 = rdtable(size, wf, rid(i1 , mid, C));
- v2 = rdtable(size, wf, rid(i2 , mid, C));
- v3 = rdtable(size, wf, rid(i3 , mid, C));
- v4 = rdtable(size, wf, rid(i4 , mid, C));
- v5 = rdtable(size, wf, rid(i5 , mid, C));
- v6 = rdtable(size, wf, rid(i6 , mid, C));
- v7 = rdtable(size, wf, rid(i7 , mid, C));
- v8 = rdtable(size, wf, rid(i8 , mid, C));
- v9 = rdtable(size, wf, rid(i9 , mid, C));
- v10 = rdtable(size, wf, rid(i10, mid, C));
- v11 = rdtable(size, wf, rid(i11, mid, C));
- v12 = rdtable(size, wf, rid(i12, mid, C));
- v13 = rdtable(size, wf, rid(i13, mid, C));
- v14 = rdtable(size, wf, rid(i14, mid, C));
- v15 = rdtable(size, wf, rid(i15, mid, C));
- };
- };
-
-In the interest of brevity, we'll stop explaining here. If you have any more questions, feel free to open an issue on faustlibraries and tag @magnetophon.
-(ba.)if
if-then-else implemented with a select2. WARNING: since select2
is strict (always evaluating both branches),
-the resulting if does not have the usual "lazy" semantic of the C if form, and thus cannot be used to
-protect against forbidden computations like division-by-zero for instance.
if(cond, then, else) : _
Where:
-cond
: conditionthen
: signal selected while cond is trueelse
: signal selected while cond is false(ba.)ifNc
if-then-elseif-then-...elsif-then-else implemented on top of ba.if
.
ifNc((cond1,then1, cond2,then2, ... condN,thenN, else)) : _
-or
- ifNc(Nc, cond1,then1, cond2,then2, ... condN,thenN, else) : _
-or
- cond1,then1, cond2,then2, ... condN,thenN, else : ifNc(Nc) : _
-
-Where:
-Nc
: number of branches/conditions (constant numerical expression)condX
: conditionthenX
: signal selected if condX is the 1st true conditionelse
: signal selected if all the cond1-condN conditions are false process(x,y) = ifNc((x<y,-1, x>y,+1, 0));
-or
- process(x,y) = ifNc(2, x<y,-1, x>y,+1, 0);
-or
- process(x,y) = x<y,-1, x>y,+1, 0 : ifNc(2);
-
-outputs -1
if x<y
, +1
if x>y
, 0
otherwise.
(ba.)ifNcNo
ifNcNo(Nc,No)
is similar to ifNc(Nc)
above but then/else branches have No
outputs.
ifNcNo(Nc,No, cond1,then1, cond2,then2, ... condN,thenN, else) : sig.bus(No)
-
-Where:
-Nc
: number of branches/conditions (constant numerical expression)No
: number of outputs (constant numerical expression)condX
: conditionthenX
: list of No signals selected if condX is the 1st true conditionelse
: list of No signals selected if all the cond1-condN conditions are false process(x) = ifNcNo(2,3, x<0, -1,-1,-1, x>0, 1,1,1, 0,0,0);
-
-outputs -1,-1,-1
if x<0
, 1,1,1
if x>0
, 0,0,0
otherwise.
(ba.)selector
Selects the ith input among n at compile time.
-selector(I,N)
-_,_,_,_ : selector(2,4) : _ // selects the 3rd input among 4
-
-Where:
-I
: input to select (int, numbered from 0, known at compile time)N
: number of inputs (int, known at compile time, N > I)There is also cselector
for selecting among complex input signals of the form (real,imag).
(ba.)select2stereo
Select between 2 stereo signals.
-_,_,_,_ : select2stereo(bpc) : _,_
-
-Where:
-bpc
: the selector switch (0/1)(ba.)selectn
Selects the ith input among N at run time.
-selectn(N,i)
-_,_,_,_ : selectn(4,2) : _ // selects the 3rd input among 4
-
-Where:
-N
: number of inputs (int, known at compile time, N > 0)i
: input to select (int, numbered from 0)N = 64;
-process = par(n, N, (par(i,N,i) : selectn(N,n)));
-
-(ba.)selectbus
Select a bus among NUM_BUSES
buses, where each bus has BUS_SIZE
outputs.
-The order of the signal inputs should be the signals of the first bus, the
-signals of the second bus, and so on.
process = si.bus(BUS_SIZE*NUM_BUSES) : selectbus(BUS_SIZE, NUM_BUSES, id) : si.bus(BUS_SIZE);
-
-Where:
-BUS_SIZE
: number of outputs from each bus (int, known at compile time).NUM_BUSES
: number of buses (int, known at compile time).id
: index of the bus to select (int, 0<=id<NUM_BUSES
)(ba.)selectxbus
Like ba.selectbus
, but with a cross-fade when selecting the bus using the same
-technique than ba.selectmulti
.
process = si.bus(BUS_SIZE*NUM_BUSES) : selectbus(BUS_SIZE, NUM_BUSES, FADE, id) : si.bus(BUS_SIZE);
-
-Where:
-BUS_SIZE
: number of outputs from each bus (int, known at compile time).NUM_BUSES
: number of buses (int, known at compile time).fade
: number of samples for the crossfade.id
: index of the bus to select (int, 0<=id<NUM_BUSES
)(ba.)selectmulti
Selects the ith circuit among N at run time (all should have the same number of inputs and outputs) -with a crossfade.
-selectmulti(n,lgen,id)
-
-Where:
-n
: crossfade in sampleslgen
: list of circuitsid
: circuit to select (int, numbered from 0)process = selectmulti(ma.SR/10, ((3,9),(2,8),(5,7)), nentry("choice", 0, 0, 2, 1));
-process = selectmulti(ma.SR/10, ((_*3,_*9),(_*2,_*8),(_*5,_*7)), nentry("choice", 0, 0, 2, 1));
-
-(ba.)selectoutn
Route input to the output among N at run time.
-_ : selectoutn(N, i) : si.bus(N)
-
-Where:
-N
: number of outputs (int, known at compile time, N > 0)i
: output number to route to (int, numbered from 0) (i.e. slider)process = 1 : selectoutn(3, sel) : par(i, 3, vbargraph("v.bargraph %i", 0, 1));
-sel = hslider("volume", 0, 0, 2, 1) : int;
-
-(ba.)latch
Latch input on positive-going transition of trig: "records" the input when trig -switches from 0 to 1, outputs a frozen values everytime else.
-_ : latch(trig) : _
-
-Where:
-trig
: hold trigger (0 for hold, 1 for bypass)(ba.)sAndH
Sample And Hold: "records" the input when trig is 1, outputs a frozen value when trig is 0.
-sAndH
is a standard Faust function.
_ : sAndH(trig) : _
-
-Where:
-trig
: hold trigger (0 for hold, 1 for bypass)(ba.)downSample
Down sample a signal. WARNING: this function doesn't change the
-rate of a signal, it just holds samples...
-downSample
is a standard Faust function.
_ : downSample(freq) : _
-
-Where:
-freq
: new rate in Hz(ba.)downSampleCV
A version of ba.downSample
where the frequency parameter has
-been replaced by an amount
parameter that is in the range zero
-to one. WARNING: this function doesn't change the rate of a
-signal, it just holds samples...
_ : downSampleCV(amount) : _
-
-Where:
-amount
: The amount of down-sampling to perform [0..1](ba.)peakhold
Outputs current max value above zero.
-_ : peakhold(mode) : _
-
-Where:
-mode
means:
0 - Pass through. A single sample 0 trigger will work as a reset.
-1 - Track and hold max value.
-(ba.)peakholder
While peak-holder functions are scarcely discussed in the literature -(please do send me an email if you know otherwise), common sense -tells that the expected behaviour should be as follows: the absolute -value of the input signal is compared with the output of the peak-holder; -if the input is greater or equal to the output, a new peak is detected -and sent to the output; otherwise, a timer starts and the current peak -is held for N samples; once the timer is out and no new peaks have been -detected, the absolute value of the current input becomes the new peak.
-_ : peakholder(holdTime) : _
-
-Where:
-holdTime
: hold time in samples(ba.)kr2ar
Force a control rate signal to be used as an audio rate signal.
-hslider("freq", 200, 200, 2000, 0.1) : kr2ar;
-
-(ba.)impulsify
Turns a signal into an impulse with the value of the current sample
-(0.3,0.2,0.1 becomes 0.3,0.0,0.0). This function is typically used with a
-button
to turn its output into an impulse. impulsify
is a standard Faust
-function.
button("gate") : impulsify;
-
-(ba.)automat
Record and replay in a loop the successives values of the input signal.
-hslider(...) : automat(t, size, init) : _
-
-Where:
-t
: tempo in BPMsize
: number of items in the loopinit
: init value in the loop(ba.)bpf
bpf is an environment (a group of related definitions) that can be used to -create break-point functions. It contains three functions:
-start(x,y)
to start a break-point functionend(x,y)
to end a break-point functionpoint(x,y)
to add intermediate points to a break-point function, using linear interpolationA minimal break-point function must contain at least a start and an end point:
-f = bpf.start(x0,y0) : bpf.end(x1,y1);
-
-A more involved break-point function can contains any number of intermediate -points:
-f = bpf.start(x0,y0) : bpf.point(x1,y1) : bpf.point(x2,y2) : bpf.end(x3,y3);
-
-In any case the x_{i}
must be in increasing order (for all i
, x_{i} < x_{i+1}
).
-For example the following definition:
f = bpf.start(x0,y0) : ... : bpf.point(xi,yi) : ... : bpf.end(xn,yn);
-
-implements a break-point function f such that:
-f(x) = y_{0}
when x < x_{0}
f(x) = y_{n}
when x > x_{n}
f(x) = y_{i} + (y_{i+1}-y_{i})*(x-x_{i})/(x_{i+1}-x_{i})
when x_{i} <= x
-and x < x_{i+1}
In addition to bpf.point
, there are also step
and curve
functions:
step(x,y)
to add a flat sectionstep_end(x,y)
to end with a flat sectioncurve(B,x,y)
to add a curved sectioncurve_end(B,x,y)
to end with a curved sectionThese functions can be combined with the other bpf
functions.
Here's an example using bpf.step
:
f(x) = x : bpf.start(0,0) : bpf.step(.2,.3) : bpf.step(.4,.6) : bpf.step_end(1,1);
For x < 0.0
, the output is 0.0.
-For 0.0 <= x < 0.2
, the output is 0.0.
-For 0.2 <= x < 0.4
, the output is 0.3.
-For 0.4 <= x < 1.0
, the output is 0.6.
-For 1.0 <= x
, the output is 1.0
For the curve
functions, B
(compile-time constant)
-is a "bias" value strictly greater than zero and less than or equal to 1. When B
is 0.5, the
-output curve is exactly linear and equivalent to bpf.point
. When B
is less than 0.5, the
-output is biased towards the y
value of the previous breakpoint. When B
is greater than 0.5,
-the output is biased towards the y
value of the curve breakpoint. Here's an example:
f = bpf.start(0,0) : bpf.curve(.15,.5,.5) : bpf.curve_end(.85,1,1);
In the following example, the output is biased towards zero (the latter y value) instead of -being a linear ramp from 1 to 0.
-f = bpf.start(0,1) : bpf.curve_end(.9,1,0);
bpf
is a standard Faust function.
(ba.)listInterp
Linearly interpolates between the elements of a list.
-index = 1.69; // range is 0-4
-process = listInterp((800,400,350,450,325),index);
-
-Where:
-index
: the index (float) to interpolate between the different values.
-The range of index
depends on the size of the list.(ba.)bypass1
Takes a mono input signal, route it to e
and bypass it if bpc = 1
.
-When bypassed, e
is feed with zeros so that its state is cleanup up.
-bypass1
is a standard Faust function.
_ : bypass1(bpc,e) : _
-
-Where:
-bpc
: bypass switch (0/1)e
: a mono effect(ba.)bypass2
Takes a stereo input signal, route it to e
and bypass it if bpc = 1
.
-When bypassed, e
is feed with zeros so that its state is cleanup up.
-bypass2
is a standard Faust function.
_,_ : bypass2(bpc,e) : _,_
-
-Where:
-bpc
: bypass switch (0/1)e
: a stereo effect(ba.)bypass1to2
Bypass switch for effect e
having mono input signal and stereo output.
-Effect e
is bypassed if bpc = 1
.When bypassed, e
is feed with zeros
-so that its state is cleanup up.
-bypass1to2
is a standard Faust function.
_ : bypass1to2(bpc,e) : _,_
-
-Where:
-bpc
: bypass switch (0/1)e
: a mono-to-stereo effect(ba.)bypass_fade
Bypass an arbitrary (N x N) circuit with 'n' samples crossfade.
-Inputs and outputs signals are faded out when 'e' is bypassed,
-so that 'e' state is cleanup up.
-Once bypassed the effect is replaced by par(i,N,_)
.
-Bypassed circuits can be chained.
_ : bypass_fade(n,b,e) : _
-or
-_,_ : bypass_fade(n,b,e) : _,_
-
-n
: number of samples for the crossfadeb
: bypass switch (0/1)e
: N x N circuitprocess = bypass_fade(ma.SR/10, checkbox("bypass echo"), echo);
-process = bypass_fade(ma.SR/10, checkbox("bypass reverb"), freeverb);
-
-(ba.)toggle
Triggered by the change of 0 to 1, it toggles the output value -between 0 and 1.
-_ : toggle : _
-
-button("toggle") : toggle : vbargraph("output", 0, 1)
-(an.amp_follower(0.1) > 0.01) : toggle : vbargraph("output", 0, 1) // takes audio input
-
-(ba.)on_and_off
The first channel set the output to 1, the second channel to 0.
-_,_ : on_and_off : _
-
-button("on"), button("off") : on_and_off : vbargraph("output", 0, 1)
-
-(ba.)bitcrusher
Produce distortion by reduction of the signal resolution.
-_ : bitcrusher(nbits) : _
-
-Where:
-nbits
: the number of bits of the wanted resolutionProvides various operations on the last n samples using a high order
-slidingReduce(op,n,maxN,disabledVal,x)
fold-like function:
slidingSum(n)
: the sliding sum of the last n input samples, CPU-lightslidingSump(n,maxN)
: the sliding sum of the last n input samples, numerically stable "forever"slidingMax(n,maxN)
: the sliding max of the last n input samplesslidingMin(n,maxN)
: the sliding min of the last n input samplesslidingMean(n)
: the sliding mean of the last n input samples, CPU-lightslidingMeanp(n,maxN)
: the sliding mean of the last n input samples, numerically stable "forever"slidingRMS(n)
: the sliding RMS of the last n input samples, CPU-lightslidingRMSp(n,maxN)
: the sliding RMS of the last n input samples, numerically stable "forever"If we want the maximum of the last 8 values, we can do that as:
-simpleMax(x) =
- (
- (
- max(x@0,x@1),
- max(x@2,x@3)
- ) :max
- ),
- (
- (
- max(x@4,x@5),
- max(x@6,x@7)
- ) :max
- )
- :max;
-
-max(x@2,x@3)
is the same as max(x@0,x@1)@2
but the latter re-uses a
-value we already computed,so is more efficient. Using the same trick for
-values 4 trough 7, we can write:
efficientMax(x)=
- (
- (
- max(x@0,x@1),
- max(x@0,x@1)@2
- ) :max
- ),
- (
- (
- max(x@0,x@1),
- max(x@0,x@1)@2
- ) :max@4
- )
- :max;
-
-We can rewrite it recursively, so it becomes possible to get the maximum at -have any number of values, as long as it's a power of 2.
-recursiveMax =
- case {
- (1,x) => x;
- (N,x) => max(recursiveMax(N/2,x), recursiveMax(N/2,x)@(N/2));
- };
-
-What if we want to look at a number of values that's not a power of 2?
-For each value, we will have to decide whether to use it or not.
-If n is bigger than the index of the value, we use it, otherwise we replace
-it with (0-(ma.MAX)
):
variableMax(n,x) =
- max(
- max(
- (
- (x@0 : useVal(0)),
- (x@1 : useVal(1))
- ):max,
- (
- (x@2 : useVal(2)),
- (x@3 : useVal(3))
- ):max
- ),
- max(
- (
- (x@4 : useVal(4)),
- (x@5 : useVal(5))
- ):max,
- (
- (x@6 : useVal(6)),
- (x@7 : useVal(7))
- ):max
- )
- )
-with {
- useVal(i) = select2((n>=i) , (0-(ma.MAX)),_);
-};
-
-Now it becomes impossible to re-use any values. To fix that let's first look
-at how we'd implement it using recursiveMax, but with a fixed n that is not
-a power of 2. For example, this is how you'd do it with n=3
:
binaryMaxThree(x) =
- (
- recursiveMax(1,x)@0, // the first x
- recursiveMax(2,x)@1 // the second and third x
- ):max;
-
-n=6
binaryMaxSix(x) =
- (
- recursiveMax(2,x)@0, // first two
- recursiveMax(4,x)@2 // third trough sixth
- ):max;
-
-Note that recursiveMax(2,x)
is used at a different delay then in
-binaryMaxThree
, since it represents 1 and 2, not 2 and 3. Each block is
-delayed the combined size of the previous blocks.
n=7
binaryMaxSeven(x) =
- (
- (
- recursiveMax(1,x)@0, // first x
- recursiveMax(2,x)@1 // second and third
- ):max,
- (
- recursiveMax(4,x)@3 // fourth trough seventh
- )
- ):max;
-
-To make a variable version, we need to know which powers of two are used, -and at which delay time.
-Then it becomes a matter of:
-sequentialOperatorParOut()
sumOfPrevBlockSizes()
useVal()
parallelOp()
In Faust, we can only do that for a fixed maximum number of values: maxN
, known at compile time.
(ba.)slidingReduce
Fold-like high order function. Apply a commutative binary operation op
to
-the last n
consecutive samples of a signal x
. For example :
-slidingReduce(max,128,128,0-(ma.MAX))
will compute the maximum of the last
-128 samples. The output is updated each sample, unlike reduce, where the
-output is constant for the duration of a block.
_ : slidingReduce(op,n,maxN,disabledVal) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)op
: the operator. Needs to be a commutative one.disabledVal
: the value to use when we want to ignore a value.In other words, op(x,disabledVal)
should equal to x
. For example,
-+(x,0)
equals x
and min(x,ma.MAX)
equals x
. So if we want to
-calculate the sum, we need to give 0 as disabledVal
, and if we want the
-minimum, we need to give ma.MAX
as disabledVal
.
(ba.)slidingSum
The sliding sum of the last n input samples.
-It will eventually run into numerical trouble when there is a persistent dc component.
-If that matters in your application, use the more CPU-intensive ba.slidingSump
.
_ : slidingSum(n) : _
-
-Where:
-n
: the number of values to process(ba.)slidingSump
The sliding sum of the last n input samples.
-It uses a lot more CPU than ba.slidingSum
, but is numerically stable "forever" in return.
_ : slidingSump(n,maxN) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)(ba.)slidingMax
The sliding maximum of the last n input samples.
-_ : slidingMax(n,maxN) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)(ba.)slidingMin
The sliding minimum of the last n input samples.
-_ : slidingMin(n,maxN) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)(ba.)slidingMean
The sliding mean of the last n input samples.
-It will eventually run into numerical trouble when there is a persistent dc component.
-If that matters in your application, use the more CPU-intensive ba.slidingMeanp
.
_ : slidingMean(n) : _
-
-Where:
-n
: the number of values to process(ba.)slidingMeanp
The sliding mean of the last n input samples.
-It uses a lot more CPU than ba.slidingMean
, but is numerically stable "forever" in return.
_ : slidingMeanp(n,maxN) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)(ba.)slidingRMS
The root mean square of the last n input samples.
-It will eventually run into numerical trouble when there is a persistent dc component.
-If that matters in your application, use the more CPU-intensive ba.slidingRMSp
.
_ : slidingRMS(n) : _
-
-Where:
-n
: the number of values to process(ba.)slidingRMSp
The root mean square of the last n input samples.
-It uses a lot more CPU than ba.slidingRMS
, but is numerically stable "forever" in return.
_ : slidingRMSp(n,maxN) : _
-
-Where:
-n
: the number of values to processmaxN
: the maximum number of values to process (int, known at compile time, maxN > 0)Provides various operations on N parallel inputs using a high order
-parallelOp(op,N,x)
function:
parallelMax(N)
: the max of n parallel inputsparallelMin(N)
: the min of n parallel inputsparallelMean(N)
: the mean of n parallel inputsparallelRMS(N)
: the RMS of n parallel inputs(ba.)parallelOp
Apply a commutative binary operation op
to N parallel inputs.
si.bus(N) : parallelOp(op,N) : _
-
-where:
-N
: the number of parallel inputs known at compile timeop
: the operator which needs to be commutative(ba.)parallelMax
The maximum of N parallel inputs.
-si.bus(N) : parallelMax(N) : _
-
-Where:
-N
: the number of parallel inputs known at compile time(ba.)parallelMin
The minimum of N parallel inputs.
-si.bus(N) : parallelMin(N) : _
-
-Where:
-N
: the number of parallel inputs known at compile time(ba.)parallelMean
The mean of N parallel inputs.
-si.bus(N) : parallelMean(N) : _
-
-Where:
-N
: the number of parallel inputs known at compile time(ba.)parallelRMS
The RMS of N parallel inputs.
-si.bus(N) : parallelRMS(N) : _
-
-Where:
-N
: the number of parallel inputs known at compile timeWelcome to the documentation for basics.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of compressor effects. Its official prefix is co
.
Useful conversion tools for compressors.
-(co.)ratio2strength
Most compressors have a ratio parameter to define the amount of compression. -A ratio of 1 means no compression, a ratio of 2 means that for every dB the input goes above the threshold, -the output gets turned down half a dB. -To use a compressor as a brick wall limiter, the ratio needs to be infinity. -This is hard to express in a faust UI element, and overcompression can not be expressed at all, -therefore most compressors in this library use a strength parameter instead, where -0 means no compression, 1 means hard limiting and bigger than 1 means over-compression.
-This utility converts a ratio to a strength.
-ratio2strength(ratio) : _
-
-Where:
-ratio
: compression ratio, between 1 and infinity (1=no compression, infinity means hard limiting)(co.)strength2ratio
Most compressors have a ratio parameter to define the amount of compression. -A ratio of 1 means no compression, a ratio of 2 means that for every dB the input goes above the threshold, -the output gets turned down half a dB. -To use a compressor as a brick wall limiter, the ratio needs to be infinity. -This is hard to express in a faust UI element, and overcompression can not be expressed at all, -therefore most compressors in this library use a strength parameter instead, where -0 means no compression, 1 means hard limiting and bigger than 1 means over-compression.
-This utility converts a strength to a ratio.
-strength2ratio(strength) : _
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)(co.)peak_compression_gain_mono_db
Mono dynamic range compressor gain computer with dB output.
-peak_compression_gain_mono_db
is a standard Faust function.
_ : peak_compression_gain_mono_db(strength,thresh,att,rel,knee,prePost) : _
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)peak_compression_gain_N_chan_db
N channels dynamic range compressor gain computer with dB output.
-peak_compression_gain_N_chan_db
is a standard Faust function.
si.bus(N) : peak_compression_gain_N_chan_db(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)FFcompressor_N_chan
Feed forward N channels dynamic range compressor.
-FFcompressor_N_chan
is a standard Faust function.
si.bus(N) : FFcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,meter,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so:
-meter = _<:(_, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
N
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)FBcompressor_N_chan
Feed back N channels dynamic range compressor.
-FBcompressor_N_chan
is a standard Faust function.
si.bus(N) : FBcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,meter,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented with:
-meter = _ <: (_,(ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
-or it can be omitted by defining meter = _;
.N
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)FBFFcompressor_N_chan
Feed forward / feed back N channels dynamic range compressor.
-The feedback part has a much higher strength, so they end up sounding similar.
-FBFFcompressor_N_chan
is a standard Faust function.
si.bus(N) : FBFFcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,FBFF,meter,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionFBFF
: fade between feed forward (0) and feed back (1) compressionmeter
: a gain reduction meter. It can be implemented like so:
-meter = _<:(_,(max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
N
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)RMS_compression_gain_mono_db
Mono RMS dynamic range compressor gain computer with dB output.
-RMS_compression_gain_mono_db
is a standard Faust function.
_ : RMS_compression_gain_mono_db(strength,thresh,att,rel,knee,prePost) : _
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)RMS_compression_gain_N_chan_db
RMS N channels dynamic range compressor gain computer with dB output.
-RMS_compression_gain_N_chan_db
is a standard Faust function.
si.bus(N) : RMS_compression_gain_N_chan_db(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressorIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)RMS_FBFFcompressor_N_chan
RMS feed forward / feed back N channels dynamic range compressor.
-The feedback part has a much higher strength, so they end up sounding similar.
-RMS_FBFFcompressor_N_chan
is a standard Faust function.
si.bus(N) : RMS_FBFFcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,FBFF,meter,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionFBFF
: fade between feed forward (0) and feed back (1) compression.meter
: a gain reduction meter. It can be implemented with:
-meter = _<:(_,(max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
N
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-To save CPU we cheat a bit, in a similar way as in the original libs:
-instead of crosfading between two sets of gain calculators as above,
-we take the abs
of the audio from both the FF and FB, and crossfade between those,
-and feed that into one set of gain calculators
-again the strength is much higher when in FB mode, but implemented differently.
(co.)RMS_FBcompressor_peak_limiter_N_chan
N channel RMS feed back compressor into peak limiter feeding back into the FB compressor.
-By combining them this way, they complement each other optimally:
-the RMS compressor doesn't have to deal with the peaks,
-and the peak limiter get's spared from the steady state signal.
-The feedback part has a much higher strength, so they end up sounding similar.
-RMS_FBcompressor_peak_limiter_N_chan
is a standard Faust function.
si.bus(N) : RMS_FBcompressor_peak_limiter_N_chan(strength,thresh,threshLim,att,rel,knee,link,meter,meterLim,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inthreshLim
: dB level threshold above which the brickwall limiter kicks inatt
: attack time = time constant (sec) when level & compression going up
-this is also used as the release time of the limiterrel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reduction
-the limiter uses a knee half this sizelink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: compressor gain reduction meter. It can be implemented with:
-meter = _<:(_,(max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
meterLim
: brickwall limiter gain reduction meter. It can be implemented with:
-meterLim = _<:(_,(max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
N
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-The gain computer functions in this section have been replaced by a version that outputs dBs, -but we retain the linear output version for backward compatibility.
-(co.)peak_compression_gain_mono
Mono dynamic range compressor gain computer with linear output.
-peak_compression_gain_mono
is a standard Faust function.
_ : peak_compression_gain_mono(strength,thresh,att,rel,knee,prePost) : _
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)peak_compression_gain_N_chan
N channels dynamic range compressor gain computer with linear output.
-peak_compression_gain_N_chan
is a standard Faust function.
si.bus(N) : peak_compression_gain_N_chan(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)RMS_compression_gain_mono
Mono RMS dynamic range compressor gain computer with linear output.
-RMS_compression_gain_mono
is a standard Faust function.
_ : RMS_compression_gain_mono(strength,thresh,att,rel,knee,prePost) : _
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-(co.)RMS_compression_gain_N_chan
RMS N channels dynamic range compressor gain computer with linear output.
-RMS_compression_gain_N_chan
is a standard Faust function.
si.bus(N) : RMS_compression_gain_N_chan(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
-
-Where:
-strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold:
-below thresh-(knee/2) there is no gain reduction,
-above thresh+(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressor, known at compile timeIt uses a strength parameter instead of the traditional ratio, in order to be able to -function as a hard limiter. -For that you'd need a ratio of infinity:1, and you cannot express that in Faust.
-Sometimes even bigger ratios are useful: -for example a group recording where one instrument is recorded with both a close microphone and a room microphone, -and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
-The functions in this section are largely superseded by the limiters above, but we -retain them for backward compatibility and for situations in which a more permissive, -MIT-style license is required.
-(co.)compressor_lad_mono
Mono dynamic range compressor with lookahead delay.
-compressor_lad_mono
is a standard Faust function.
_ : compressor_lad_mono(lad,ratio,thresh,att,rel) : _
-
-Where:
-lad
: lookahead delay in seconds (nonnegative) - gets rounded to nearest sample.
- The effective attack time is a good settingratio
: compression ratio (1 = no compression, >1 means compression)
- Ratios: 4 is moderate compression, 8 is strong compression,
- 12 is mild limiting, and 20 is pretty hard limiting at the thresholdthresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression are going uprel
: release time = time constant (sec) coming out of compression(co.)compressor_mono
Mono dynamic range compressors.
-compressor_mono
is a standard Faust function.
_ : compressor_mono(ratio,thresh,att,rel) : _
-
-Where:
-ratio
: compression ratio (1 = no compression, >1 means compression)
- Ratios: 4 is moderate compression, 8 is strong compression,
- 12 is mild limiting, and 20 is pretty hard limiting at the thresholdthresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression are going uprel
: release time = time constant (sec) coming out of compression(co.)compressor_stereo
Stereo dynamic range compressors.
-_,_ : compressor_stereo(ratio,thresh,att,rel) : _,_
-
-Where:
-ratio
: compression ratio (1 = no compression, >1 means compression)thresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compression(co.)compression_gain_mono
Compression-gain calculation for dynamic range compressors.
-_ : compression_gain_mono(ratio,thresh,att,rel) : _
-
-Where:
-ratio
: compression ratio (1 = no compression, >1 means compression)thresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compression(co.)limiter_1176_R4_mono
A limiter guards against hard-clipping. It can be -implemented as a compressor having a high threshold (near the -clipping level), fast attack, and high ratio. Since -the compression ratio is so high, some knee smoothing is -desirable (for softer limiting). This example is intended -to get you started using compressors as limiters, so all -parameters are hardwired here to nominal values.
-ratio
: 4 (moderate compression).
- See compressor_mono
comments for a guide to other choices.
- Mike Shipley likes this (lowest) setting on the 1176.
- (Grammy award-winning mixer for Queen, Tom Petty, etc.).
thresh
: -6 dB, meaning 4:1 compression begins at amplitude 1/2.
att
: 800 MICROseconds (Note: scaled by ratio in the 1176)
- The 1176 range is said to be 20-800 microseconds.
- Faster attack gives "more bite" (e.g. on vocals),
- and makes hard-clipping less likely on fast overloads.
rel
: 0.5 s (Note: scaled by ratio in the 1176)
- The 1176 range is said to be 50-1100 ms.
The 1176 also has a "bright, clear eq effect" (use filters.lib if desired).
-limiter_1176_R4_mono
is a standard Faust function.
_ : limiter_1176_R4_mono : _
-
-(co.)limiter_1176_R4_stereo
A limiter guards against hard-clipping. It can be
-implemented as a compressor having a high threshold (near the
-clipping level), fast attack and release, and high ratio. Since
-the ratio is so high, some knee smoothing is
-desirable ("soft limiting"). This example is intended
-to get you started using compressor_*
as a limiter, so all
-parameters are hardwired to nominal values here.
ratio
: 4 (moderate compression), 8 (severe compression),
- 12 (mild limiting), or 20 to 1 (hard limiting).
att
: 20-800 MICROseconds (Note: scaled by ratio in the 1176).
rel
: 50-1100 ms (Note: scaled by ratio in the 1176).
Mike Shipley likes 4:1 (Grammy-winning mixer for Queen, Tom Petty, etc.) -Faster attack gives "more bite" (e.g. on vocals). -He hears a bright, clear eq effect as well (not implemented here).
- _,_ : limiter_1176_R4_stereo : _,_
-
-(co.)peak_expansion_gain_N_chan_db
N channels dynamic range expander gain computer.
-peak_expansion_gain_N_chan_db
is a standard Faust function.
si.bus(N) : peak_expansion_gain_N_chan_db(strength,thresh,range,att,hold,rel,knee,prePost,link,maxHold,N) : si.bus(N)
-
-Where:
-strength
: strength of the expansion (0 = no expansion, 100 means gating, <1 means upward compression)thresh
: dB level threshold below which expansion kicks inrange
: maximum amount of expansion in dBatt
: attack time = time constant (sec) coming out of expansionhold
: hold time (sec)rel
: release time = time constant (sec) going into expansionknee
: a gradual increase in gain reduction around the threshold:
-above thresh+(knee/2) there is no gain reduction,
-below thresh-(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-range detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmaxHold
: the maximum hold time in samples, known at compile timeN
: the number of channels of the gain computer, known at compile time(co.)expander_N_chan
Feed forward N channels dynamic range expander.
-expander_N_chan
is a standard Faust function.
si.bus(N) : expander_N_chan(strength,thresh,range,att,hold,rel,knee,prePost,link,meter,maxHold,N) : si.bus(N)
-
-Where:
-strength
: strength of the expansion (0 = no expansion, 100 means gating, <1 means upward compression)thresh
: dB level threshold below which expansion kicks inrange
: maximum amount of expansion in dBatt
: attack time = time constant (sec) coming out of expansionhold
: hold timerel
: release time = time constant (sec) going into expansionknee
: a gradual increase in gain reduction around the threshold:
-above thresh+(knee/2) there is no gain reduction,
-below thresh-(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-range detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so:
-meter = _<:(_, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
maxHold
: the maximum hold time in samples, known at compile timeN
: the number of channels of the expander, known at compile time(co.)expanderSC_N_chan
Feed forward N channels dynamic range expander with sidechain.
-expanderSC_N_chan
is a standard Faust function.
si.bus(N) : expanderSC_N_chan(strength,thresh,range,att,hold,rel,knee,prePost,link,meter,maxHold,N,SCfunction,SCswitch,SCsignal) : si.bus(N)
-
-Where:
-strength
: strength of the expansion (0 = no expansion, 100 means gating, <1 means upward compression)thresh
: dB level threshold below which expansion kicks inrange
: maximum amount of expansion in dBatt
: attack time = time constant (sec) coming out of expansionhold
: hold timerel
: release time = time constant (sec) going into expansionknee
: a gradual increase in gain reduction around the threshold:
-above thresh+(knee/2) there is no gain reduction,
-below thresh-(knee/2) there is the same gain reduction as without a knee,
-and in between there is a gradual increase in gain reductionprePost
: places the level detector either at the input or after the gain computer;
-this turns it from a linear return-to-zero detector into a log domain return-to-range detectorlink
: the amount of linkage between the channels: 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so:
-meter = _<:(_, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;
maxHold
: the maximum hold time in samples, known at compile timeN
: the number of channels of the expander, known at compile timeSCfunction
: a function that get's placed before the level-detector, needs to have a single input and outputSCswitch
: use either the regular audio input or the SCsignal as the input for the level detectorSCsignal
: an audio signal, to be used as the input for the level detector when SCswitch is 1(co.)limiter_lad_N
N-channels lookahead limiter inspired by IOhannes Zmölnig's post, which is -in turn based on the thesis by Peter Falkner "Entwicklung eines digitalen -Stereo-Limiters mit Hilfe des Signalprozessors DSP56001". -This version of the limiter uses a peak-holder with smoothed -attack and release based on tau time constant filters.
-It is also possible to use a time constant that is 2PI*tau
by dividing
-the attack and release times by 2PI
. This time constant allows for
-the amplitude profile to reach 1 - e^(-2PI)
of the final
-peak after the attack time. The input path can be delayed by the same
-amount as the attack time to synchronise input and amplitude profile,
-realising a system that is particularly effective as a colourless
-(ideally) brickwall limiter.
Note that the effectiveness of the ceiling settings are dependent on -the other parameters, especially the time constant used for the -smoothing filters and the lookahead delay.
-Similarly, the colourless characteristics are also dependent on attack, -hold, and release times. Since fluctuations above ~15 Hz are -perceived as timbral effects, [Vassilakis and Kendall 2010] it is -reasonable to set the attack time to 1/15 seconds for a smooth amplitude -modulation. On the other hand, the hold time can be set to the -peak-to-peak period of the expected lowest frequency in the signal, -which allows for minimal distortion of the low frequencies. The -release time can then provide a perceptually linear and gradual gain -increase determined by the user for any specific application.
-The scaling factor for all the channels is determined by the loudest peak -between them all, so that amplitude ratios between the signals are kept.
-si.bus(N) : limiter_lad_N(N, LD, ceiling, attack, hold, release) : si.bus(N)
-
-Where:
-N
: is the number of channels, known at compile-timeLD
: is the lookahead delay in seconds, known at compile-timeceiling
: is the linear amplitude output limitattack
: is the attack time in secondshold
: is the hold time in secondsrelease
: is the release time in secondsExample for a stereo limiter: limiter_lad_N(2, .01, 1, .01, .1, 1);
(co.)limiter_lad_mono
Specialised case of limiter_lad_N
mono limiter.
_ : limiter_lad_mono(LD, ceiling, attack, hold, release) : _
-
-Where:
-LD
: is the lookahead delay in seconds, known at compile-timeceiling
: is the linear amplitude output limitattack
: is the attack time in secondshold
: is the hold time in secondsrelease
: is the release time in seconds(co.)limiter_lad_stereo
Specialised case of limiter_lad_N
stereo limiter.
_,_ : limiter_lad_stereo(LD, ceiling, attack, hold, release) : _,_
-
-Where:
-LD
: is the lookahead delay in seconds, known at compile-timeceiling
: is the linear amplitude output limitattack
: is the attack time in secondshold
: is the hold time in secondsrelease
: is the release time in seconds(co.)limiter_lad_quad
Specialised case of limiter_lad_N
quadraphonic limiter.
si.bus(4) : limiter_lad_quad(LD, ceiling, attack, hold, release) : si.bus(4)
-
-Where:
-LD
: is the lookahead delay in seconds, known at compile-timeceiling
: is the linear amplitude output limitattack
: is the attack time in secondshold
: is the hold time in secondsrelease
: is the release time in seconds(co.)limiter_lad_bw
Specialised case of limiter_lad_N
and ready-to-use unit-amplitude mono
-limiting function. This implementation, in particular, uses 2PI*tau
-time constant filters for attack and release smoothing with
-synchronised input and gain signals.
This function's best application is to be used as a brickwall limiter with -the least colouring artefacts while keeping a not-so-slow release curve. -Tests have shown that, given a pop song with 60 dB of amplification -and a 0-dB-ceiling, the loudest peak recorded was ~0.38 dB.
-_ : limiter_lad_bw : _
-
-Welcome to the documentation for compressors.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a collection of delay functions. Its official prefix is de
.
(de.)delay
Simple d
samples delay where n
is the maximum delay length as a number of
-samples. Unlike the @
delay operator, here the delay signal d
is explicitly
-bounded to the interval [0..n]. The consequence is that delay will compile even
-if the interval of d can't be computed by the compiler.
-delay
is a standard Faust function.
_ : delay(n,d) : _
-
-Where:
-n
: the max delay length in samplesd
: the delay length in samples (integer)(de.)fdelay
Simple d
samples fractional delay based on 2 interpolated delay lines where n
is
-the maximum delay length as a number of samples.
-fdelay
is a standard Faust function.
_ : fdelay(n,d) : _
-
-Where:
-n
: the max delay length in samplesd
: the delay length in samples (float)(de.)sdelay
s(mooth)delay: a mono delay that doesn't click and doesn't -transpose when the delay time is changed.
-_ : sdelay(n,it,d) : _
-
-Where:
-n
: the max delay length in samplesit
: interpolation time (in samples), for example 1024d
: the delay length in samples (float)(de.)prime_power_delays
Prime Power Delay Line Lengths.
-si.bus(N) : prime_power_delays(N,pathmin,pathmax) : si.bus(N);
-
-Where:
-N
: positive integer up to 16 (for higher powers of 2, extend 'primes' array below)pathmin
: minimum acoustic ray length in the reverberator (in meters)pathmax
: maximum acoustic ray length (meters) - think "room size"(de.)fdelaylti
and (de.)fdelayltv
Fractional delay line using Lagrange interpolation.
-_ : fdelaylt[i|v](N, n, d) : _
-
-Where:
-N=1,2,3,...
is the order of the Lagrange interpolation polynomial (constant numerical expression)n
: the max delay length in samplesd
: the delay length in samplesfdelaylti
is most efficient, but designed for constant/slowly-varying delay.
-fdelayltv
is more expensive and more robust when the delay varies rapidly.
Note: the requested delay should not be less than (N-1)/2
.
(de.)fdelay[N]
For convenience, fdelay1
, fdelay2
, fdelay3
, fdelay4
, fdelay5
-are also available where N
is the order of the interpolation, built using fdelayltv
.
Thiran Allpass Interpolation.
-(de.)fdelay[N]a
Delay lines interpolated using Thiran allpass interpolation.
-_ : fdelay[N]a(n, d) : _
-
-(exactly like fdelay
)
Where:
-N=1,2,3, or 4
is the order of the Thiran interpolation filter (constant numerical expression),
- and the delay argument is at least N-1/2
. First-order: d
at least 0.5, second-order: d
at least 1.5,
- third-order: d
at least 2.5, fourth-order: d
at least 3.5.n
: the max delay length in samplesd
: the delay length in samplesThe interpolated delay should not be less than N-1/2
.
-(The allpass delay ranges from N-1/2
to N+1/2
).
-This constraint can be alleviated by altering the code,
-but be aware that allpass filters approach zero delay
-by means of pole-zero cancellations.
Delay arguments too small will produce an UNSTABLE allpass!
-Because allpass interpolation is recursive, it is not as robust -as Lagrange interpolation under time-varying conditions -(you may hear clicks when changing the delay rapidly).
Welcome to the documentation for delays.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a set of demo functions based on examples located in the
-/examples
folder. Its official prefix is dm
.
(dm.)mth_octave_spectral_level_demo
Demonstrate mth_octave_spectral_level in a standalone GUI.
-_ : mth_octave_spectral_level_demo(BandsPerOctave) : _
-_ : spectral_level_demo : _ // 2/3 octave
-
-(dm.)parametric_eq_demo
A parametric equalizer application.
-_ : parametric_eq_demo : _
-
-(dm.)spectral_tilt_demo
A spectral tilt application.
-_ : spectral_tilt_demo(N) : _
-
-Where:
-N
: filter order (integer)All other parameters interactive
-(dm.)mth_octave_filterbank_demo
and (dm.)filterbank_demo
Graphic Equalizer: each filter-bank output signal routes through a fader.
-_ : mth_octave_filterbank_demo(M) : _
-_ : filterbank_demo : _
-
-Where:
-M
: number of bands per octave(dm.)cubicnl_demo
Distortion demo application.
-_ : cubicnl_demo : _
-
-(dm.)gate_demo
Gate demo application.
-_,_ : gate_demo : _,_
-
-(dm.)compressor_demo
Compressor demo application.
-_,_ : compressor_demo : _,_
-
-(dm.)moog_vcf_demo
Illustrate and compare all three Moog VCF implementations above.
-_ : moog_vcf_demo : _
-
-(dm.)wah4_demo
Wah pedal application.
-_ : wah4_demo : _
-
-(dm.)crybaby_demo
Crybaby effect application.
-_ : crybaby_demo : _
-
-(dm.)flanger_demo
Flanger effect application.
-_,_ : flanger_demo : _,_
-
-(dm.)phaser2_demo
Phaser effect demo application.
-_,_ : phaser2_demo : _,_
-
-(dm.)tapeStop_demo
Stereo tape-stop effect.
-_,_ : tapeStop_demo : _,_
-
-(dm.)freeverb_demo
Freeverb demo application.
-_,_ : freeverb_demo : _,_
-
-(dm.)stereo_reverb_tester
Handy test inputs for reverberator demos below.
-_,_ : stereo_reverb_tester(gui_group) : _,_
-
-For suppressing the gui_group
input, pass it as !
.
-(See (dm.)fdnrev0_demo
for an example of its use).
(dm.)fdnrev0_demo
A reverb application using fdnrev0
.
_,_,_,_ : fdnrev0_demo(N,NB,BBSO) : _,_
-
-Where:
-N
: feedback Delay Network (FDN) order / number of delay lines used =
- order of feedback matrix / 2, 4, 8, or 16 [extend primes array below for
- 32, 64, ...]NB
: number of frequency bands / Number of (nearly) independent T60 controls
- / Integer 3 or greaterBBSO
: butterworth band-split order / order of lowpass/highpass bandsplit
- used at each crossover freq / odd positive integer(dm.)zita_rev_fdn_demo
Reverb demo application based on zita_rev_fdn
.
si.bus(8) : zita_rev_fdn_demo : si.bus(8)
-
-(dm.)zita_light
Light version of dm.zita_rev1
with only 2 UI elements.
_,_ : zita_light : _,_
-
-(dm.)zita_rev1
Example GUI for zita_rev1_stereo
(mostly following the Linux zita-rev1
GUI).
Only the dry/wet and output level parameters are "dezippered" here. If
-parameters are to be varied in real time, use smooth(0.999)
or the like
-in the same way.
_,_ : zita_rev1 : _,_
-
-(dm.)vital_rev_demo
Example GUI for vital_rev
with all parameters exposed.
_,_ : vital_rev_demo : _,_
-
-(dm.)reverbTank_demo
This is a stereo reverb following the "ReverbTank" example in [1], -although some parameter ranges and scaling have been adjusted. -It is an unofficial version of the Spin Semiconductor® Reverb. -Other relevant instructional material can be found in [2-4].
-_,_ : reverbTank_demo : _,_
-
-[1] Pirkle, W. C. (2019). Designing audio effect plugins in C++ (2nd ed.). Chapter 17.14.
-[2] Spin Semiconductor. (n.d.). Reverberation. Retrieved 2024-04-16, from http://www.spinsemi.com/knowledge_base/effects.html#Reverberation
-[3] Zölzer, U. (2022). Digital audio signal processing (3rd ed.). Chapter 7, Figure 7.39.
-[4] Valhalla DSP. (2010, August 25). RIP Keith Barr. Retrieved 2024-04-16, from https://valhalladsp.com/2010/08/25/rip-keith-barr/
-(dm.)dattorro_rev_demo
Example GUI for dattorro_rev
with all parameters exposed and additional
-dry/wet and output gain control.
_,_ : dattorro_rev_demo : _,_
-
-(dm.)jprev_demo
Example GUI for jprev
with all parameters exposed.
_,_ : jprev_demo : _,_
-
-(dm.)greyhole_demo
Example GUI for greyhole
with all parameters exposed.
_,_ : greyhole_demo : _,_
-
-(dm.)sawtooth_demo
An application demonstrating the different sawtooth oscillators of Faust.
-sawtooth_demo : _
-
-(dm.)virtual_analog_oscillator_demo
Virtual analog oscillator demo application.
-virtual_analog_oscillator_demo : _
-
-(dm.)oscrs_demo
Simple application demoing filter based oscillators.
-oscrs_demo : _
-
-(dm.)velvet_noise_demo
Listen to velvet_noise!
-velvet_noise_demo : _
-
-(dm.)latch_demo
Illustrate latch operation.
-echo 'import("pkg:faust/faust/stdfaust.lib@1.0.0");' > latch_demo.dsp
-echo 'process = dm.latch_demo;' >> latch_demo.dsp
-faust2octave latch_demo.dsp
-Octave:1> plot(faustout);
-
-(dm.)envelopes_demo
Illustrate various envelopes overlaid, including their gate * 1.1.
-echo 'import("pkg:faust/faust/stdfaust.lib@1.0.0");' > envelopes_demo.dsp
-echo 'process = dm.envelopes_demo;' >> envelopes_demo.dsp
-faust2octave envelopes_demo.dsp
-Octave:1> plot(faustout);
-
-(dm.)fft_spectral_level_demo
Make a real-time spectrum analyzer using FFT from analyzers.lib.
-echo 'import("pkg:faust/faust/stdfaust.lib@1.0.0");' > fft_spectral_level_demo.dsp
-echo 'process = dm.fft_spectral_level_demo;' >> fft_spectral_level_demo.dsp
-Mac:
- faust2caqt fft_spectral_level_demo.dsp
- open fft_spectral_level_demo.app
-Linux GTK:
- faust2jack fft_spectral_level_demo.dsp
- ./fft_spectral_level_demo
-Linux QT:
- faust2jaqt fft_spectral_level_demo.dsp
- ./fft_spectral_level_demo
-
-(dm.)reverse_echo_demo(nChans)
Multichannel echo effect with reverse delays.
-echo 'import("pkg:faust/faust/stdfaust.lib@1.0.0");' > reverse_echo_demo.dsp
-echo 'nChans = 3; // Any integer > 1 should work here' >> reverse_echo_demo.dsp
-echo 'process = dm.reverse_echo_demo(nChans);' >> reverse_echo_demo.dsp
-Mac:
- faust2caqt reverse_echo_demo.dsp
- open reverse_echo_demo.app
-Linux GTK:
- faust2jack reverse_echo_demo.dsp
- ./reverse_echo_demo
-Linux QT:
- faust2jaqt reverse_echo_demo.dsp
- ./reverse_echo_demo
-Etc.
-
-(dm.)pospass_demo
Use Positive-Pass Filter pospass() to frequency-shift a sine tone. -First, a real sinusoid is converted to its analytic-signal form -using pospass() to filter out its negative frequency component. -Next, it is multiplied by a modulating complex sinusoid at the -shifting frequency to create the frequency-shifted result. -The real and imaginary parts are output to channels 1 & 2. -For a more interesting frequency-shifting example, check the -"Use Mic" checkbox to replace the input sinusoid by mic input. -Note that frequency shifting is not the same as frequency scaling. -A frequency-shifted harmonic signal is usually not harmonic. -Very small frequency shifts give interesting chirp effects when -there is feedback around the frequency shifter.
-echo 'import("pkg:faust/faust/stdfaust.lib@1.0.0");' > pospass_demo.dsp
-echo 'process = dm.pospass_demo;' >> pospass_demo.dsp
-Mac:
- faust2caqt pospass_demo.dsp
- open pospass_demo.app
-Linux GTK:
- faust2jack pospass_demo.dsp
- ./pospass_demo
-Linux QT:
- faust2jaqt pospass_demo.dsp
- ./pospass_demo
-Etc.
-
-(dm.)exciter
Psychoacoustic harmonic exciter, with GUI.
-_ : exciter : _
-
-(dm.)vocoder_demo
Use example of the vocoder function where an impulse train is used -as excitation.
-_ : vocoder_demo : _
-
-(dm.)colored_noise_demo
A coloured noise signal generator.
-colored_noise_demo : _
-
Welcome to the documentation for demos.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Yamaha DX7 emulation library. Its official prefix is dx
.
(dx.)dx7_ampf
DX7 amplitude conversion function. 3 versions of this function -are available:
-dx7_amp_bpf
: BPF version (same as in the CSOUND toolkit)dx7_amp_func
: estimated mathematical equivalent of dx7_amp_bpf
dx7_ampf
: default (sugar for dx7_amp_func
)dx7AmpPreset : dx7_ampf_bpf : _
-
-Where:
-dx7AmpPreset
: DX7 amplitude value (0-99)(dx.)dx7_egraterisef
DX7 envelope generator rise conversion function. 3 versions of this function -are available:
-dx7_egraterise_bpf
: BPF version (same as in the CSOUND toolkit)dx7_egraterise_func
: estimated mathematical equivalent of dx7_egraterise_bpf
dx7_egraterisef
: default (sugar for dx7_egraterise_func
)dx7envelopeRise : dx7_egraterisef : _
-
-Where:
-dx7envelopeRise
: DX7 envelope rise value (0-99)(dx.)dx7_egraterisepercf
DX7 envelope generator percussive rise conversion function. 3 versions of -this function are available:
-dx7_egrateriseperc_bpf
: BPF version (same as in the CSOUND toolkit)dx7_egrateriseperc_func
: estimated mathematical equivalent of dx7_egrateriseperc_bpf
dx7_egraterisepercf
: default (sugar for dx7_egrateriseperc_func
)dx7envelopePercRise : dx7_egraterisepercf : _
-
-Where:
-dx7envelopePercRise
: DX7 envelope percussive rise value (0-99)(dx.)dx7_egratedecayf
DX7 envelope generator decay conversion function. 3 versions of -this function are available:
-dx7_egratedecay_bpf
: BPF version (same as in the CSOUND toolkit)dx7_egratedecay_func
: estimated mathematical equivalent of dx7_egratedecay_bpf
dx7_egratedecayf
: default (sugar for dx7_egratedecay_func
)dx7envelopeDecay : dx7_egratedecayf : _
-
-Where:
-dx7envelopeDecay
: DX7 envelope decay value (0-99)(dx.)dx7_egratedecaypercf
DX7 envelope generator percussive decay conversion function. 3 versions of -this function are available:
-dx7_egratedecayperc_bpf
: BPF version (same as in the CSOUND toolkit)dx7_egratedecayperc_func
: estimated mathematical equivalent of dx7_egratedecayperc_bpf
dx7_egratedecaypercf
: default (sugar for dx7_egratedecayperc_func
)dx7envelopePercDecay : dx7_egratedecaypercf : _
-
-Where:
-dx7envelopePercDecay
: DX7 envelope decay value (0-99)(dx.)dx7_eglv2peakf
DX7 envelope level to peak conversion function. 3 versions of -this function are available:
-dx7_eglv2peak_bpf
: BPF version (same as in the CSOUND toolkit)dx7_eglv2peak_func
: estimated mathematical equivalent of dx7_eglv2peak_bpf
dx7_eglv2peakf
: default (sugar for dx7_eglv2peak_func
)dx7Level : dx7_eglv2peakf : _
-
-Where:
-dx7Level
: DX7 level value (0-99)(dx.)dx7_velsensf
DX7 velocity sensitivity conversion function.
-dx7Velocity : dx7_velsensf : _
-
-Where:
-dx7Velocity
: DX7 level value (0-8)(dx.)dx7_fdbkscalef
DX7 feedback scaling conversion function.
-dx7Feedback : dx7_fdbkscalef : _
-
-Where:
-dx7Feedback
: DX7 feedback value(dx.)dx7_op
DX7 Operator. Implements a phase-modulable sine wave oscillator connected -to a DX7 envelope generator.
-dx7_op(freq,phaseMod,outLev,R1,R2,R3,R4,L1,L2,L3,L4,keyVel,rateScale,type,gain,gate) : _
-
-Where:
-freq
: frequency of the oscillatorphaseMod
: phase deviation (-1 - 1)outLev
: preset output level (0-99)R1
: preset envelope rate 1 (0-99)R2
: preset envelope rate 2 (0-99)R3
: preset envelope rate 3 (0-99)R4
: preset envelope rate 4 (0-99)L1
: preset envelope level 1 (0-99)L2
: preset envelope level 2 (0-99)L3
: preset envelope level 3 (0-99)L4
: preset envelope level 4 (0-99)keyVel
: preset key velocity sensitivity (0-99)rateScale
: preset envelope rate scaletype
: preset operator typegain
: general gaingate
: trigger signal(dx.)dx7_algo
DX7 algorithms. Implements the 32 DX7 algorithms (a quick Google search -should give your more details on this). Each algorithm uses 6 operators.
-dx7_algo(algN,egR1,egR2,egR3,egR4,egL1,egL2,egL3,egL4,outLevel,keyVelSens,ampModSens,opMode,opFreq,opDetune,opRateScale,feedback,lfoDelay,lfoDepth,lfoSpeed,freq,gain,gate) : _
-
-Where:
-algN
: algorithm number (0-31, should be an int...)egR1
: preset envelope rates 1 (a list of 6 values between 0-99)egR2
: preset envelope rates 2 (a list of 6 values between 0-99)egR3
: preset envelope rates 3 (a list of 6 values between 0-99)egR4
: preset envelope rates 4 (a list of 6 values between 0-99)egL1
: preset envelope levels 1 (a list of 6 values between 0-99)egL2
: preset envelope levels 2 (a list of 6 values between 0-99)egL3
: preset envelope levels 3 (a list of 6 values between 0-99)egL4
: preset envelope levels 4 (a list of 6 values between 0-99)outLev
: preset output levels (a list of 6 values between 0-99)keyVel
: preset key velocity sensitivities (a list of 6 values between 0-99)ampModSens
: preset amplitude sensitivities (a list of 6 values between 0-99)opMode
: preset operator mode (a list of 6 values between 0-1)opFreq
: preset operator frequencies (a list of 6 values between 0-99)opDetune
: preset operator detuning (a list of 6 values between 0-99)opRateScale
: preset operator rate scale (a list of 6 values between 0-99)feedback
: preset operator feedback (a list of 6 values between 0-99)lfoDelay
: preset LFO delay (a list of 6 values between 0-99)lfoDepth
: preset LFO depth (a list of 6 values between 0-99)lfoSpeed
: preset LFO speed (a list of 6 values between 0-99)freq
: fundamental frequencygain
: general gaingate
: trigger signal(dx.)dx7_ui
Generic DX7 function where all parameters are controllable using UI elements.
-The master-with-mute
branch must be used for this function to work...
-This function is MIDI-compatible.
dx7_ui : _
-
Welcome to the documentation for dx7.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a collection of envelope generators. Its official prefix is en
.
(en.)ar
AR (Attack, Release) envelope generator (useful to create percussion envelopes).
-ar
is a standard Faust function.
ar(at,rt,t) : _
-
-Where:
-at
: attack (sec)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)asr
ASR (Attack, Sustain, Release) envelope generator.
-asr
is a standard Faust function.
asr(at,sl,rt,t) : _
-
-Where:
-at
: attack (sec)sl
: sustain level (between 0..1)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)adsr
ADSR (Attack, Decay, Sustain, Release) envelope generator.
-adsr
is a standard Faust function.
adsr(at,dt,sl,rt,t) : _
-
-Where:
-at
: attack time (sec)dt
: decay time (sec)sl
: sustain level (between 0..1)rt
: release time (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)adsrf_bias
ADSR (Attack, Decay, Sustain, Release, Final) envelope generator with -control over bias on each segment, and toggle for legato.
-adsrf_bias(at,dt,sl,rt,final,b_att,b_dec,b_rel,legato,t) : _
-
-Where:
-at
: attack time (sec)dt
: decay time (sec)sl
: sustain level (between 0..1)rt
: release time (sec)final
: final level (between 0..1) but less than or equal to sl
b_att
: bias during attack (between 0..1) where 0.5 is no bias.b_dec
: bias during decay (between 0..1) where 0.5 is no bias.b_rel
: bias during release (between 0..1) where 0.5 is no bias.legato
: toggle for legato. If disabled, envelopes "re-trigger" from zero.t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)adsr_bias
ADSR (Attack, Decay, Sustain, Release) envelope generator with -control over bias on each segment, and toggle for legato.
-adsr_bias(at,dt,sl,rt,b_att,b_dec,b_rel,legato,t) : _
-
-Where:
-at
: attack time (sec)dt
: decay time (sec)sl
: sustain level (between 0..1)rt
: release time (sec)b_att
: bias during attack (between 0..1) where 0.5 is no bias.b_dec
: bias during decay (between 0..1) where 0.5 is no bias.b_rel
: bias during release (between 0..1) where 0.5 is no bias.legato
: toggle for legato. If disabled, envelopes "re-trigger" from zero.t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)ahdsrf_bias
AHDSR (Attack, Hold, Decay, Sustain, Release, Final) envelope generator -with control over bias on each segment, and toggle for legato.
-ahdsrf_bias(at,ht,dt,sl,rt,final,b_att,b_dec,b_rel,legato,t) : _
-
-Where:
-at
: attack time (sec)ht
: hold time (sec)dt
: decay time (sec)sl
: sustain level (between 0..1)rt
: release time (sec)final
: final level (between 0..1) but less than or equal to sl
b_att
: bias during attack (between 0..1) where 0.5 is no bias.b_dec
: bias during decay (between 0..1) where 0.5 is no bias.b_rel
: bias during release (between 0..1) where 0.5 is no bias.legato
: toggle for legato. If disabled, envelopes "re-trigger" from zero.t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)ahdsr_bias
AHDSR (Attack, Hold, Decay, Sustain, Release) envelope generator -with control over bias on each segment, and toggle for legato.
-ahdsr_bias(at,ht,dt,sl,rt,final,b_att,b_dec,b_rel,legato,t) : _
-
-Where:
-at
: attack time (sec)ht
: hold time (sec)dt
: decay time (sec)sl
: sustain level (between 0..1)rt
: release time (sec)final
: final level (between 0..1) but less than or equal to sl
b_att
: bias during attack (between 0..1) where 0.5 is no bias.b_dec
: bias during decay (between 0..1) where 0.5 is no bias.b_rel
: bias during release (between 0..1) where 0.5 is no bias.legato
: toggle for legato. If disabled, envelopes "re-trigger" from zero.t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)smoothEnvelope
An envelope with an exponential attack and release.
-smoothEnvelope
is a standard Faust function.
smoothEnvelope(ar,t) : _
-
-ar
: attack and release duration (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)arfe
ARFE (Attack and Release-to-Final-value Exponentially) envelope generator.
-Approximately equal to smoothEnvelope(Attack/6.91)
when Attack == Release.
arfe(at,rt,fl,t) : _
-
-Where:
-at
: attack (sec)rt
: release (sec)fl
: final level to approach upon release (such as 0)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)are
ARE (Attack, Release) envelope generator with Exponential segments.
-Approximately equal to smoothEnvelope(Attack/6.91)
when Attack == Release.
are(at,rt,t) : _
-
-Where:
-at
: attack (sec)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)asre
ASRE (Attack, Sustain, Release) envelope generator with Exponential segments.
-asre(at,sl,rt,t) : _
-
-Where:
-at
: attack (sec)sl
: sustain level (between 0..1)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)adsre
ADSRE (Attack, Decay, Sustain, Release) envelope generator with Exponential -segments.
-adsre(at,dt,sl,rt,t) : _
-
-Where:
-at
: attack (sec)dt
: decay (sec)sl
: sustain level (between 0..1)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)ahdsre
AHDSRE (Attack, Hold, Decay, Sustain, Release) envelope generator with Exponential -segments.
-ahdsre(at,ht,dt,sl,rt,t) : _
-
-Where:
-at
: attack (sec)ht
: hold (sec)dt
: decay (sec)sl
: sustain level (between 0..1)rt
: release (sec)t
: trigger signal (attack is triggered when t>0
, release is triggered
-when t=0
)(en.)dx7envelope
DX7 operator envelope generator with 4 independent rates and levels. It is -essentially a 4 points BPF.
-dx7_envelope(R1,R2,R3,R4,L1,L2,L3,L4,t) : _
-
-Where:
-RN
: rates in secondsLN
: levels (0-1)t
: trigger signalWelcome to the documentation for envelopes.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library allows to build linear, explicit finite difference schemes
-physical models in 1 or 2 dimensions using an approach based on the cellular
-automata formalism. Its official prefix is fd
.
In order to use the library, one needs to discretize the linear partial -differential equation of the desired system both at boundaries and in-between -them, thus obtaining a set of explicit recursion relations. Each one -of these will provide, for each spatial point the scalar coefficients to be -multiplied by the states of the current and past neighbour points.
-Coefficients need to be stacked in parallel in order to form a coefficients -matrix for each point in the mesh. It is necessary to provide one matrix for -coefficients matrices are defined, they need to be placed in parallel and -ordered following the desired mesh structure (i.e., coefficients for the top -left boundaries will come first, while bottom right boundaries will come -last), to form a coefficients scheme, which can be used with the library -functions.
-Here are listed some works on finite difference schemes and cellular -automata thet were the basis for the implementation of this library
-Once the coefficients scheme is defined, the user can simply call one of -these functions to obtain a fully working physical model. They expect to -receive a force input signal for each mesh point and output the state of each -point. Interpolation operators can be used to drive external forces to the -desired points, and to get the signal only from a certain area of the mesh.
-(fd.)model1D
This function can be used to obtain a physical model in 1 dimension. -Takes a force input signal for each point and outputs the state of each -point.
-si.bus(points) : model1D(points,R,T,scheme) : si.bus(points)
-
-Where:
-points
: size of the mesh in pointsR
: neighbourhood radius, indicates how many side points are needed (i.e.
- if R=1 the mesh depends on one point on the left and one on the right)T
: time coefficient, indicates how much steps back in time are needed (i.
- e. if T=1 the maximum delay needed for a neighbour state is 1 sample)scheme
: coefficients scheme(fd.)model2D
This function can be used to obtain a physical model in 2 dimension. -Takes a force input signal for each point and outputs the state of each -point. -IMPORTANT: 2D models with more than 30x20 points might crash the c++ -compiler. 2D models need to be compiled with the command line compiler, -the online one presents some issues.
-si.bus(pointsX*pointsY) : model2D(pointsX,pointsY,R,T,scheme) :
- si.bus(pointsX*pointsY)
-
-Where:
-pointsX
: horizontal size of the mesh in pointspointsY
: vertical size of the mesh in pointsR
: neighbourhood radius, indicates how many side points are needed (i.e.
- if R=1 the mesh depends on one point on the left and one on the right)T
: time coefficient, indicates how much steps back in time are needed (i.
- e. if T=1 the maximum delay needed for a neighbour state is 1 sample)scheme
: coefficients schemeInterpolation functions can be used to drive the input signals to the -correct mesh points, or to get the output signal from the -desired points. All the interpolation functions allow to change the -input/output points at run time. In general, all these functions get in -input a number of connections, and output the same number of connections, -where each signal is multiplied by zero except the ones specified by the -arguments.
-(fd.)stairsInterp1D
Stairs interpolator in 1 dimension. Takes a number of signals and outputs -the same number of signals, where each one is multiplied by zero except the -one specified by the argument. This can vary at run time (i.e. a slider), -but must be an integer.
-si.bus(points) : stairsInterp1D(points,point) : si.bus(points)
-
-Where:
-points
: total number of points in the meshpoint
: number of the desired nonzero signal(fd.)stairsInterp2D
Stairs interpolator in 2 dimensions. Similar to the 1-D version.
-si.bus(pointsX*pointsY) : stairsInterp2D(pointsX,pointsY,pointX,pointY) :
- si.bus(pointsX*pointsY)
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionpointX
: horizontal index of the desired nonzero signalpointY
: vertical index of the desired nonzero signal(fd.)linInterp1D
Linear interpolator in 1 dimension. Takes a number of signals and outputs -the same number of signals, where each one is multiplied by zero except two -signals around a floating point index. This is essentially a Faust -implementation of the $J(x_i)$ operator, not scaled by the spatial step. -(see Stefan Bilbao's book, Numerical Sound Synthesis). The index can vary -at run time.
-si.bus(points) : linInterp1D(points,point) : si.bus(points)
-
-Where:
-points
: total number of points in the meshpoint
: floating point index(fd.)linInterp2D
Linear interpolator in 2 dimensions. Similar to the 1 D version.
-si.bus(pointsX*pointsY) : linInterp2D(pointsX,pointsY,pointX,pointY) :
- si.bus(pointsX*pointsY)
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionpointX
: horizontal float indexpointY
: vertical float index(fd.)stairsInterp1DOut
Stairs interpolator in 1 dimension. Similar to stairsInterp1D
, except it
-outputs only the desired signal.
si.bus(points) : stairsInterp1DOut(points,point) : _
-
-Where:
-points
: total number of points in the meshpoint
: number of the desired nonzero signal(fd.)stairsInterp2DOut
Stairs interpolator in 2 dimensions which outputs only one signal.
-si.bus(pointsX*pointsY) : stairsInterp2DOut(pointsX,pointsY,pointX,pointY) : _
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionpointX
: horizontal index of the desired nonzero signalpointY
: vertical index of the desired nonzero signal(fd.)linInterp1DOut
Linear interpolator in 1 dimension. Similar to stairsInterp1D
, except it
-sums each output signal and provides only one output value.
si.bus(points) : linInterp1DOut(points,point) : _
-
-Where:
-points
: total number of points in the meshpoint
: floating point index(fd.)stairsInterp2DOut
Linear interpolator in 2 dimensions which outputs only one signal.
-si.bus(pointsX*pointsY) : linInterp2DOut(pointsX,pointsY,pointX,pointY) : _
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionpointX
: horizontal float indexpointY
: vertical float indexThe routing functions are used internally by the model building functions, -but can also be taken separately. These functions route the forces, the -coefficients scheme and the neighbours’ signals into the correct scheme -points and take as input, in this order: the coefficients block, the -feedback signals and the forces. In output they provide, in order, for each -scheme point: the force signal, the coefficient matrices and the neighbours’ -signals. These functions are based on the Faust route primitive.
-(fd.)route1D
Routing function for 1 dimensional schemes.
-si.bus((2*R+1)*(T+1)*points),si.bus(points*2) : route1D(points, R, T) :
- si.bus((1 + ((2*R+1)*(T+1)) + (2*R+1))*points)
-
-Where:
-points
: total number of points in the meshR
: neighbourhood radiusT
: time coefficient(fd.)route2D
Routing function for 2 dimensional schemes.
-si.bus((2*R+1)^2*(T+1)*pointsX*pointsY),si.bus(pointsX*pointsY*2) :
- route2D(pointsX, pointsY, R, T) :
- si.bus((1 + ((2*R+1)^2*(T+1)) + (2*R+1)^2)*pointsX*pointsY)
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionR
: neighbourhood radiusT
: time coefficientThe scheme operation functions are used internally by the model building
-functions but can also be taken separately. The schemePoint function is
-where the update equation is actually calculated. The buildScheme
functions
-are used to stack in parallel several schemePoint blocks, according to the
-choosed mesh size.
(fd.)schemePoint
This function calculates the next state for each mesh point, in order to -form a scheme, several of these blocks need to be stacked in parallel. -This function takes in input, in order, the force, the coefficient matrices -and the neighbours’ signals and outputs the next point state.
-_,si.bus((2*R+1)^D*(T+1)),si.bus((2*R+1)^D) : schemePoint(R,T,D) : _
-
-Where:
-R
: neighbourhood radiusT
: time coefficientD
: scheme spatial dimensions (i.e. 1 if 1-D, 2 if 2-D)(fd.)buildScheme1D
This function is used to stack in parallel several schemePoint functions in -1 dimension, according to the number of points.
-si.bus((1 + ((2*R+1)*(T+1)) + (2*R+1))*points) : buildScheme1D(points,R,T) :
- si.bus(points)
-
-Where:
-points
: total number of points in the meshR
: neighbourhood radiusT
: time coefficient(fd.)buildScheme2D
This function is used to stack in parallel several schemePoint functions in -2 dimensions, according to the number of points in the X and Y directions.
-si.bus((1 + ((2*R+1)^2*(T+1)) + (2*R+1)^2)*pointsX*pointsY) :
- buildScheme2D(pointsX,pointsY,R,T) : si.bus(pointsX*pointsY)
-
-Where:
-pointsX
: total number of points in the X directionpointsY
: total number of points in the Y directionR
: neighbourhood radiusT
: time coefficientHere are defined two physically based interaction algorithms: a hammer and -a bow. These functions need to be coupled to the mesh pde, in the point -where the interaction happens: to do so, the mesh output signals can be fed -back and driven into the force block using the interpolation operators. -The latters can be also used to drive the single force output signal to the -correct scheme points.
-(fd.)hammer
Implementation of a nonlinear collision model. The hammer is essentially a -finite difference scheme of a linear damped oscillator, which is coupled -with the mesh through the collision model (see Stefan Bilbao's book, -Numerical Sound Synthesis).
-_ :hammer(coeff,omega0Sqr,sigma0,kH,alpha,k,offset,fIn) : _
-
-Where:
-coeff
: output force scaling coefficientomega0Sqr
: squared angular frequency of the hammer oscillatorsigma0
: damping coefficient of the hammer oscillatorkH
: hammer stiffness coefficientalpha
: nonlinearity parameterk
: time sampling step (the same as for the mesh)offset
: distance between the string and the hammer at rest in metersfIn
: hammer excitation signal (i.e. a button)(fd.)bow
Implementation of a nonlinear friction based interaction model that induces -Helmholtz motion. (see Stefan Bilbao's book, Numerical Sound Synthesis).
-_ :bow(coeff,alpha,k,vb) : _
-
-Where:
-coeff
: output force scaling coefficientalpha
: nonlinearity parameterk
: time sampling step (the same as for the mesh)vb
: bow velocity [m/s]Welcome to the documentation for fds.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Filters library. Its official prefix is fi
.
The Filters library is organized into 22 sections:
-(fi.)zero
One zero filter. Difference equation: .
-_ : zero(z) : _
-
-Where:
-z
: location of zero along real axis in z-plane(fi.)pole
One pole filter. Could also be called a "leaky integrator". -Difference equation: .
-_ : pole(p) : _
-
-Where:
-p
: pole location = feedback coefficient(fi.)integrator
Same as pole(1)
[implemented separately for block-diagram clarity].
(fi.)dcblockerat
DC blocker with configurable "break frequency".
-The amplitude response is substantially flat above fb
,
-and sloped at about +6 dB/octave below fb
.
-Derived from the analog transfer function:
-
-(which can be seen as a 1st-order Butterworth highpass filter)
-by the low-frequency-matching bilinear transform method
-(i.e., using the typical frequency-scaling constant 2*SR
).
_ : dcblockerat(fb) : _
-
-Where:
-fb
: "break frequency" in Hz, i.e., -3 dB gain frequency (see 2nd reference below)(fi.)dcblocker
DC blocker. Default dc blocker has -3dB point near 35 Hz (at 44.1 kHz)
-and high-frequency gain near 1.0025 (due to no scaling).
-dcblocker
is as standard Faust function.
_ : dcblocker : _
-
-(fi.)lptN
One-pole lowpass filter with arbitrary dis/charging factors set in dB and -times set in seconds.
-_ : lptN(N, tN) : _
-
-Where:
-N
: is the attenuation factor in dBtN
: is the filter period in seconds, that is, the time for the
-impulse response to decay by N
dB(fi.)ff_comb
Feed-Forward Comb Filter. Note that ff_comb
requires integer delays
-(uses delay
internally).
-ff_comb
is a standard Faust function.
_ : ff_comb(maxdel,intdel,b0,bM) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelb0
: gain applied to delay-line inputbM
: gain applied to delay-line output and then summed with input(fi.)ff_fcomb
Feed-Forward Comb Filter. Note that ff_fcomb
takes floating-point delays
-(uses fdelay
internally).
-ff_fcomb
is a standard Faust function.
_ : ff_fcomb(maxdel,del,b0,bM) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelb0
: gain applied to delay-line inputbM
: gain applied to delay-line output and then summed with input(fi.)ffcombfilter
Typical special case of ff_comb()
where: b0 = 1
.
(fi.)fb_comb
Feed-Back Comb Filter (integer delay).
-_ : fb_comb(maxdel,intdel,b0,aN) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelb0
: gain applied to delay-line input and forwarded to outputaN
: minus the gain applied to delay-line output before summing with the input
- and feeding to the delay line(fi.)fb_fcomb
Feed-Back Comb Filter (floating point delay).
-_ : fb_fcomb(maxdel,del,b0,aN) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelb0
: gain applied to delay-line input and forwarded to outputaN
: minus the gain applied to delay-line output before summing with the input
- and feeding to the delay line(fi.)rev1
Special case of fb_comb
(rev1(maxdel,N,g)
).
-The "rev1 section" dates back to the 1960s in computer-music reverberation.
-See the jcrev
and brassrev
in reverbs.lib
for usage examples.
(fi.)fbcombfilter
and (fi.)ffbcombfilter
Other special cases of Feed-Back Comb Filter.
-_ : fbcombfilter(maxdel,intdel,g) : _
-_ : ffbcombfilter(maxdel,del,g) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelg
: feedback gain(fi.)allpass_comb
Schroeder Allpass Comb Filter. Note that:
-allpass_comb(maxlen,len,aN) = ff_comb(maxlen,len,aN,1) : fb_comb(maxlen,len-1,1,aN);
-
-which is a direct-form-1 implementation, requiring two delay lines. -The implementation here is direct-form-2 requiring only one delay line.
-_ : allpass_comb(maxdel,intdel,aN) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (integer) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelaN
: minus the feedback gain(fi.)allpass_fcomb
Schroeder Allpass Comb Filter. Note that:
-allpass_comb(maxlen,len,aN) = ff_comb(maxlen,len,aN,1) : fb_comb(maxlen,len-1,1,aN);
-
-which is a direct-form-1 implementation, requiring two delay lines. -The implementation here is direct-form-2 requiring only one delay line.
-allpass_fcomb
is a standard Faust library.
_ : allpass_comb(maxdel,intdel,aN) : _
-_ : allpass_fcomb(maxdel,del,aN) : _
-
-Where:
-maxdel
: maximum delay (a power of 2)intdel
: current (float) comb-filter delay between 0 and maxdeldel
: current (float) comb-filter delay between 0 and maxdelaN
: minus the feedback gain(fi.)rev2
Special case of allpass_comb
(rev2(maxlen,len,g)
).
-The "rev2 section" dates back to the 1960s in computer-music reverberation.
-See the jcrev
and brassrev
in reverbs.lib
for usage examples.
(fi.)allpass_fcomb5
and (fi.)allpass_fcomb1a
Same as allpass_fcomb
but use fdelay5
and fdelay1a
internally
-(Interpolation helps - look at an fft of faust2octave on
`1-1' <: allpass_fcomb(1024,10.5,0.95), allpass_fcomb5(1024,10.5,0.95);`).
-
-(fi.)iir
Nth-order Infinite-Impulse-Response (IIR) digital filter, -implemented in terms of the Transfer-Function (TF) coefficients. -Such filter structures are termed "direct form".
-iir
is a standard Faust function.
_ : iir(bcoeffs,acoeffs) : _
-
-Where:
-bcoeffs
: (b0,b1,...,b_order) = TF numerator coefficientsacoeffs
: (a1,...,a_order) = TF denominator coeffs (a0=1)(fi.)fir
FIR filter (convolution of FIR filter coefficients with a signal). fir
is standard Faust function.
_ : fir(bv) : _
-
-Where:
-bv
= b0,b1,...,bn is a parallel bank of coefficient signals.bv
is processed using pattern-matching at compile time,
- so it must have this normal form (parallel signals).
Smoothing white noise with a five-point moving average:
-bv = .2,.2,.2,.2,.2;
-process = noise : fir(bv);
-
-Equivalent (note double parens):
-process = noise : fir((.2,.2,.2,.2,.2));
-
-(fi.)conv
and (fi.)convN
Convolution of input signal with given coefficients.
-_ : conv((k1,k2,k3,...,kN)) : _ // Argument = one signal bank
-_ : convN(N,(k1,k2,k3,...)) : _ // Useful when N < count((k1,...))
-
-(fi.)tf1
, (fi.)tf2
and (fi.)tf3
tfN = N'th-order direct-form digital filter.
-_ : tf1(b0,b1,a1) : _
-_ : tf2(b0,b1,b2,a1,a2) : _
-_ : tf3(b0,b1,b2,b3,a1,a2,a3) : _
-
-Where:
-b
: transfer-function numeratora
: transfer-function denominator (monic)(fi.)notchw
Simple notch filter based on a biquad (tf2
).
-notchw
is a standard Faust function.
_ : notchw(width,freq) : _
-
-Where:
-width
: "notch width" in Hz (approximate)freq
: "notch frequency" in HzDirect-Form Second-Order Biquad Sections
-(fi.)tf21
, (fi.)tf22
, (fi.)tf22t
and (fi.)tf21t
tfN = N'th-order direct-form digital filter where:
-tf21
is tf2, direct-form 1tf22
is tf2, direct-form 2tf22t
is tf2, direct-form 2 transposedtf21t
is tf2, direct-form 1 transposed_ : tf21(b0,b1,b2,a1,a2) : _
-_ : tf22(b0,b1,b2,a1,a2) : _
-_ : tf22t(b0,b1,b2,a1,a2) : _
-_ : tf21t(b0,b1,b2,a1,a2) : _
-
-Where:
-b
: transfer-function numeratora
: transfer-function denominator (monic)Ladder and lattice digital filters generally have superior numerical -properties relative to direct-form digital filters. They can be derived -from digital waveguide filters, which gives them a physical interpretation.
-(fi.)av2sv
Compute reflection coefficients sv from transfer-function denominator av.
-sv = av2sv(av)
-
-Where:
-av
: parallel signal bank a1,...,aN
sv
: parallel signal bank s1,...,sN
where ro = ith
reflection coefficient, and
- ai
= coefficient of z^(-i)
in the filter
- transfer-function denominator A(z)
.
(fi.)bvav2nuv
Compute lattice tap coefficients from transfer-function coefficients.
-nuv = bvav2nuv(bv,av)
-
-Where:
-av
: parallel signal bank a1,...,aN
bv
: parallel signal bank b0,b1,...,aN
nuv
: parallel signal bank nu1,...,nuN
where nui
is the i'th tap coefficient,
- bi
is the coefficient of z^(-i)
in the filter numerator,
- ai
is the coefficient of z^(-i)
in the filter denominator
(fi.)iir_lat2
Two-multiply lattice IIR filter of arbitrary order.
-_ : iir_lat2(bv,av) : _
-
-Where:
-bv
: transfer-function numeratorav
: transfer-function denominator (monic)(fi.)allpassnt
Two-multiply lattice allpass (nested order-1 direct-form-ii allpasses), with taps.
-_ : allpassnt(n,sv) : si.bus(n+1)
-
-Where:
-n
: the order of the filtersv
: the reflection coefficients (-1 1)The first output is the n-th order allpass output, -while the remaining outputs are taps taken from the -input of each delay element from the input to the output. -See (fi.)allpassn for the single-output case.
-(fi.)iir_kl
Kelly-Lochbaum ladder IIR filter of arbitrary order.
-_ : iir_kl(bv,av) : _
-
-Where:
-bv
: transfer-function numeratorav
: transfer-function denominator (monic)(fi.)allpassnklt
Kelly-Lochbaum ladder allpass.
-_ : allpassnklt(n,sv) : _
-
-Where:
-n
: the order of the filtersv
: the reflection coefficients (-1 1)(fi.)iir_lat1
One-multiply lattice IIR filter of arbitrary order.
-_ : iir_lat1(bv,av) : _
-
-Where:
-(fi.)allpassn1mt
One-multiply lattice allpass with tap lines.
-_ : allpassn1mt(N,sv) : _
-
-Where:
-N
: the order of the filter (fixed at compile time)sv
: the reflection coefficients (-1 1)(fi.)iir_nl
Normalized ladder filter of arbitrary order.
-_ : iir_nl(bv,av) : _
-
-Where:
-bv
: transfer-function numeratorav
: transfer-function denominator (monic)(fi.)allpassnnlt
Normalized ladder allpass filter of arbitrary order.
-_ : allpassnnlt(N,sv) : _
-
-Where:
-N
: the order of the filter (fixed at compile time)sv
: the reflection coefficients (-1,1)(fi.)tf2np
Biquad based on a stable second-order Normalized Ladder Filter
-(more robust to modulation than tf2
and protected against instability).
_ : tf2np(b0,b1,b2,a1,a2) : _
-
-Where:
-b
: transfer-function numeratora
: transfer-function denominator (monic)(fi.)wgr
Second-order transformer-normalized digital waveguide resonator.
-_ : wgr(f,r) : _
-
-Where:
-f
: resonance frequency (Hz)r
: loss factor for exponential decay (set to 1 to make a numerically stable oscillator)(fi.)nlf2
Second order normalized digital waveguide resonator.
-_ : nlf2(f,r) : _
-
-Where:
-f
: resonance frequency (Hz)r
: loss factor for exponential decay (set to 1 to make a sinusoidal oscillator)(fi.)apnl
Passive Nonlinear Allpass based on Pierce switching springs idea.
-Switch between allpass coefficient a1
and a2
at signal zero crossings.
_ : apnl(a1,a2) : _
-
-Where:
-a1
and a2
: allpass coefficientsAn allpass filter has gain 1 at every frequency, but variable phase.
-Ladder/lattice allpass filters are specified by reflection coefficients.
-They are defined here as nested allpass filters, hence the names allpassn*
.
(fi.)scatN
N-port scattering junction.
-si.bus(N) : scatN(N,av,filter) : si.bus(N)
-
-Where:
-N
: number of incoming/outgoing wavesav
: vector (list) of N
alpha parameters (each between 0 and 2, and normally summing to 2): https://ccrma.stanford.edu/~jos/pasp/Alpha_Parameters.htmlfilter
: optional junction filter to apply (_
for none, see below)With no filter:
-filter
argument.
- For guaranteed stability, the filter should be positive real. (See 2nd ref. below).For (two-port scattering), the reflection coefficient corresponds -to alpha parameters .
-process = _ : *(1.0/sqrt(N)) <: daisyRev(16,2,0.9999) :> _,_ with {
- daisyRev(N,Dp2,G) = si.bus(N) : (si.bus(2*N) :> si.bus(N)
- : fi.scatN(N, par(i,N,2*G/float(N)), fi.lowpass(1,5000.0))
- : par(i,N,de.delay(DS(i),DS(i)-1))) ~ si.bus(N) with { DS(i) = 2^(Dp2+i); };
-};
-
-(fi.)scat
Scatter off of reflectance r with reflection coefficient s.
-_ : scat(s,r) : _
-
-s
: reflection coefficient between -1 and 1 for stabilityr
: single-input, single-output block diagram,
- having gain less than 1 at all frequencies for stability.process = fi.allpassn(3,(.3,.2,.1)), fi.scat(.1, fi.scat(.2, fi.scat(.3, _)))
- :> - : ^(2) : +~_;
-
-(fi.)allpassn
Two-multiply lattice filter.
-_ : allpassn(n,sv) : _
-
-n
: the order of the filtersv
: the reflection coefficients (-1 1)sv
: the reflection coefficients (s1,s2,...,sN), each between -1 and 1.Equivalent to fi.allpassnt(n,sv) : _, par(i,n,!);
-Equivalent to fi.scat( s(n), fi.scat( s(n-1), ..., fi.scat( s(1), _ )))
- with { s(k) = ba.take(k,sv); } ;
-Identical to allpassn
in old/filter.lib
.
(fi.)allpassnn
Normalized form - four multiplies and two adds per section, -but coefficients can be time varying and nonlinear without -"parametric amplification" (modulation of signal energy).
-_ : allpassnn(n,tv) : _
-
-Where:
-n
: the order of the filtertv
: the reflection coefficients (-PI PI)(fi.)allpassnkl
Kelly-Lochbaum form - four multiplies and two adds per -section, but all signals have an immediate physical -interpretation as traveling pressure waves, etc.
-_ : allpassnkl(n,sv) : _
-
-Where:
-n
: the order of the filtersv
: the reflection coefficients (-1 1)(fi.)allpass1m
One-multiply form - one multiply and three adds per section. -Normally the most efficient in special-purpose hardware.
-_ : allpassn1m(n,sv) : _
-
-Where:
-n
: the order of the filtersv
: the reflection coefficients (-1 1)(fi.)tf2s
and (fi.)tf2snp
Second-order direct-form digital filter, -specified by ANALOG transfer-function polynomials B(s)/A(s), -and a frequency-scaling parameter. Digitization via the -bilinear transform is built in.
-_ : tf2s(b2,b1,b0,a1,a0,w1) : _
-
-Where:
- b2 s^2 + b1 s + b0
-H(s) = --------------------
- s^2 + a1 s + a0
-
-and w1
is the desired digital frequency (in radians/second)
-corresponding to analog frequency 1 rad/sec (i.e., s = j
).
A second-order ANALOG Butterworth lowpass filter, -normalized to have cutoff frequency at 1 rad/sec, -has transfer function:
- 1
-H(s) = -----------------
- s^2 + a1 s + 1
-
-where a1 = sqrt(2)
. Therefore, a DIGITAL Butterworth lowpass
-cutting off at SR/4
is specified as tf2s(0,0,1,sqrt(2),1,PI*SR/2);
Bilinear transform scaled for exact mapping of w1.
-(fi.)tf1snp
First-order special case of tf2snp above.
-_ : tf1snp(b1,b0,a0) : _
-
-(fi.)tf3slf
Analogous to tf2s
above, but third order, and using the typical
-low-frequency-matching bilinear-transform constant 2/T ("lf" series)
-instead of the specific-frequency-matching value used in tf2s
and tf1s
.
-Note the lack of a "w1" argument.
_ : tf3slf(b3,b2,b1,b0,a3,a2,a1,a0) : _
-
-(fi.)tf1s
First-order direct-form digital filter, -specified by ANALOG transfer-function polynomials B(s)/A(s), -and a frequency-scaling parameter.
-_ : tf1s(b1,b0,a0,w1) : _
-
-Where:
- b1 s + b0
-
-H(s) = ---------- - s + a0
-and w1
is the desired digital frequency (in radians/second)
-corresponding to analog frequency 1 rad/sec (i.e., s = j
).
A first-order ANALOG Butterworth lowpass filter, -normalized to have cutoff frequency at 1 rad/sec, -has transfer function:
- 1
-
-H(s) = ------- - s + 1
-so b0 = a0 = 1
and b1 = 0
. Therefore, a DIGITAL first-order
-Butterworth lowpass with gain -3dB at SR/4
is specified as
tf1s(0,1,1,PI*SR/2); // digital half-band order 1 Butterworth
-
-Bilinear transform scaled for exact mapping of w1.
-(fi.)tf2sb
Bandpass mapping of tf2s
: In addition to a frequency-scaling parameter
-w1
(set to HALF the desired passband width in rad/sec),
-there is a desired center-frequency parameter wc (also in rad/s).
-Thus, tf2sb
implements a fourth-order digital bandpass filter section
-specified by the coefficients of a second-order analog lowpass prototype
-section. Such sections can be combined in series for higher orders.
-The order of mappings is (1) frequency scaling (to set lowpass cutoff w1),
-(2) bandpass mapping to wc, then (3) the bilinear transform, with the
-usual scale parameter 2*SR
. Algebra carried out in maxima and pasted here.
_ : tf2sb(b2,b1,b0,a1,a0,w1,wc) : _
-
-(fi.)tf1sb
First-to-second-order lowpass-to-bandpass section mapping, -analogous to tf2sb above.
-_ : tf1sb(b1,b0,a0,w1,wc) : _
-
-(fi.)resonlp
Simple resonant lowpass filter based on tf2s
(virtual analog).
-resonlp
is a standard Faust function.
_ : resonlp(fc,Q,gain) : _
-_ : resonhp(fc,Q,gain) : _
-_ : resonbp(fc,Q,gain) : _
-
-
-Where:
-fc
: center frequency (Hz)Q
: qgain
: gain (0-1)(fi.)resonhp
Simple resonant highpass filters based on tf2s
(virtual analog).
-resonhp
is a standard Faust function.
_ : resonlp(fc,Q,gain) : _
-_ : resonhp(fc,Q,gain) : _
-_ : resonbp(fc,Q,gain) : _
-
-
-Where:
-fc
: center frequency (Hz)Q
: qgain
: gain (0-1)(fi.)resonbp
Simple resonant bandpass filters based on tf2s
(virtual analog).
-resonbp
is a standard Faust function.
_ : resonlp(fc,Q,gain) : _
-_ : resonhp(fc,Q,gain) : _
-_ : resonbp(fc,Q,gain) : _
-
-
-Where:
-fc
: center frequency (Hz)Q
: qgain
: gain (0-1)(fi.)lowpass
Nth-order Butterworth lowpass filter.
-lowpass
is a standard Faust function.
_ : lowpass(N,fc) : _
-
-Where:
-N
: filter order (number of poles), nonnegative constant numerical expressionfc
: desired cut-off frequency (-3dB frequency) in Hzbutter
function in Octave ("[z,p,g] = butter(N,1,'s');")
(fi.)highpass
Nth-order Butterworth highpass filter.
-highpass
is a standard Faust function.
_ : highpass(N,fc) : _
-
-Where:
-N
: filter order (number of poles), nonnegative constant numerical expressionfc
: desired cut-off frequency (-3dB frequency) in Hzbutter
function in Octave ("[z,p,g] = butter(N,1,'s');")
(fi.)lowpass0_highpass1
These special allpass filters are needed by filterbank et al. below.
-They are equivalent to (lowpass(N,fc)
+|- highpass(N,fc))/2
, but with
-canceling pole-zero pairs removed (which occurs for odd N).
(fi.)lowpass_plus
|minus_highpass
Catch-all definitions for generality - even order is done: -Catch-all definitions for generality - even order is done: -FIXME: Rewrite the following, as for orders 3 and 5 above, - to eliminate pole-zero cancellations: -FIXME: Rewrite the following, as for orders 3 and 5 above, - to eliminate pole-zero cancellations:
-Elliptic (Cauer) Lowpass Filters
-ncauer
and ellip
in Octave.(fi.)lowpass3e
Third-order Elliptic (Cauer) lowpass filter.
-_ : lowpass3e(fc) : _
-
-Where:
-fc
: -3dB frequency in HzFor spectral band-slice level display (see octave_analyzer3e
):
[z,p,g] = ncauer(Rp,Rs,3); % analog zeros, poles, and gain, where
-Rp = 60 % dB ripple in stopband
-Rs = 0.2 % dB ripple in passband
-
-(fi.)lowpass6e
Sixth-order Elliptic/Cauer lowpass filter.
-_ : lowpass6e(fc) : _
-
-Where:
-fc
: -3dB frequency in HzFor spectral band-slice level display (see octave_analyzer6e):
-[z,p,g] = ncauer(Rp,Rs,6); % analog zeros, poles, and gain, where
- Rp = 80 % dB ripple in stopband
- Rs = 0.2 % dB ripple in passband
-
-(fi.)highpass3e
Third-order Elliptic (Cauer) highpass filter. Inversion of lowpass3e
wrt unit
-circle in s plane (s <- 1/s).
_ : highpass3e(fc) : _
-
-Where:
-fc
: -3dB frequency in Hz(fi.)highpass6e
Sixth-order Elliptic/Cauer highpass filter. Inversion of lowpass3e
wrt unit
-circle in s plane (s <- 1/s).
_ : highpass6e(fc) : _
-
-Where:
-fc
: -3dB frequency in Hz(fi.)bandpass
Order 2*Nh Butterworth bandpass filter made using the transformation
-s <- s + wc^2/s
on lowpass(Nh)
, where wc
is the desired bandpass center
-frequency. The lowpass(Nh)
cutoff w1
is half the desired bandpass width.
-bandpass
is a standard Faust function.
_ : bandpass(Nh,fl,fu) : _
-
-Where:
-Nh
: HALF the desired bandpass order (which is therefore even)fl
: lower -3dB frequency in Hzfu
: upper -3dB frequency in Hz
-Thus, the passband width is fu-fl
,
- and its center frequency is (fl+fu)/2
.(fi.)bandstop
Order 2*Nh Butterworth bandstop filter made using the transformation
-s <- s + wc^2/s
on highpass(Nh)
, where wc
is the desired bandpass center
-frequency. The highpass(Nh)
cutoff w1
is half the desired bandpass width.
-bandstop
is a standard Faust function.
_ : bandstop(Nh,fl,fu) : _
-
-Where:
-Nh
: HALF the desired bandstop order (which is therefore even)fl
: lower -3dB frequency in Hzfu
: upper -3dB frequency in Hz
-Thus, the passband (stopband) width is fu-fl
,
- and its center frequency is (fl+fu)/2
.(fi.)bandpass6e
Order 12 elliptic bandpass filter analogous to bandpass(6)
.
(fi.)bandpass12e
Order 24 elliptic bandpass filter analogous to bandpass(6)
.
(fi.)pospass
Positive-Pass Filter (single-side-band filter).
-_ : pospass(N,fc) : _,_
-
-where
-N
: filter order (Butterworth bandpass for positive frequencies).fc
: lower bandpass cutoff frequency in Hz.dm.pospass_demo
A filter passing only positive frequencies can be made from a -half-band lowpass by modulating it up to the positive-frequency range. -Equivalently, down-modulate the input signal using a complex sinusoid at -SR/4 Hz, -lowpass it with a half-band filter, and modulate back up by SR/4 Hz. -In Faust/math notation: - -
-An approximation to the Hilbert transform is given by the -imaginary output signal:
-hilbert(N) = pospass(N) : !,*(2);
-
-Parametric Equalizers (Shelf, Peaking).
-(fi.)low_shelf
First-order "low shelf" filter (gain boost|cut between dc and some frequency)
-low_shelf
is a standard Faust function.
_ : lowshelf(N,L0,fx) : _
-_ : low_shelf(L0,fx) : _ // default case (order 3)
-_ : lowshelf_other_freq(N,L0,fx) : _
-
-Where:
-* N
: filter order 1, 3, 5, ... (odd only, default should be 3, a constant numerical expression)
-* L0
: desired level (dB) between dc and fx (boost L0>0
or cut L0<0
)
-* fx
: -3dB frequency of lowpass band (L0>0
) or upper band (L0<0
)
- (see "SHELF SHAPE" below).
The gain at SR/2 is constrained to be 1. -The generalization to arbitrary odd orders is based on the well known -fact that odd-order Butterworth band-splits are allpass-complementary -(see filterbank documentation below for references).
-The magnitude frequency response is approximately piecewise-linear -on a log-log plot ("BODE PLOT"). The Bode "stick diagram" approximation -L(lf) is easy to state in dB versus dB-frequency lf = dB(f):
-See lowshelf_other_freq
.
See "Parametric Equalizers" above for references regarding
-low_shelf
, high_shelf
, and peak_eq
.
(fi.)high_shelf
First-order "high shelf" filter (gain boost|cut above some frequency).
-high_shelf
is a standard Faust function.
_ : highshelf(N,Lpi,fx) : _
-_ : high_shelf(L0,fx) : _ // default case (order 3)
-_ : highshelf_other_freq(N,Lpi,fx) : _
-
-Where:
-N
: filter order 1, 3, 5, ... (odd only, a constant numerical expression).Lpi
: desired level (dB) between fx and SR/2 (boost Lpi>0 or cut Lpi<0)fx
: -3dB frequency of highpass band (L0>0) or lower band (L0<0)
- (Use highshelf_other_freq() below to find the other one.)The gain at dc is constrained to be 1.
-See lowshelf
documentation above for more details on shelf shape.
See "Parametric Equalizers" above for references regarding
-low_shelf
, high_shelf
, and peak_eq
.
(fi.)peak_eq
Second order "peaking equalizer" section (gain boost or cut near some frequency)
-Also called a "parametric equalizer" section.
-peak_eq
is a standard Faust function.
_ : peak_eq(Lfx,fx,B) : _
-
-Where:
-Lfx
: level (dB) at fx (boost Lfx>0 or cut Lfx<0)fx
: peak frequency (Hz)B
: bandwidth (B) of peak in HzSee "Parametric Equalizers" above for references regarding
-low_shelf
, high_shelf
, and peak_eq
.
(fi.)peak_eq_cq
Constant-Q second order peaking equalizer section.
-_ : peak_eq_cq(Lfx,fx,Q) : _
-
-Where:
-Lfx
: level (dB) at fxfx
: boost or cut frequency (Hz)Q
: "Quality factor" = fx/B where B = bandwidth of peak in HzSee "Parametric Equalizers" above for references regarding
-low_shelf
, high_shelf
, and peak_eq
.
(fi.)peak_eq_rm
Regalia-Mitra second order peaking equalizer section.
-_ : peak_eq_rm(Lfx,fx,tanPiBT) : _
-
-Where:
-Lfx
: level (dB) at fxfx
: boost or cut frequency (Hz)tanPiBT
: tan(PI*B/SR)
, where B = -3dB bandwidth (Hz) when 10^(Lfx/20) = 0
- ~ PI*B/SR for narrow bandwidths BP.A. Regalia, S.K. Mitra, and P.P. Vaidyanathan, -"The Digital All-Pass Filter: A Versatile Signal Processing Building Block" -Proceedings of the IEEE, 76(1):19-37, Jan. 1988. (See pp. 29-30.) -See also "Parametric Equalizers" above for references on shelf -and peaking equalizers in general.
-(fi.)spectral_tilt
Spectral tilt filter, providing an arbitrary spectral rolloff factor -alpha in (-1,1), where - -1 corresponds to one pole (-6 dB per octave), and - +1 corresponds to one zero (+6 dB per octave). -In other words, alpha is the slope of the ln magnitude versus ln frequency. -For a "pinking filter" (e.g., to generate 1/f noise from white noise), -set alpha to -1/2.
-_ : spectral_tilt(N,f0,bw,alpha) : _
-
-Where:
-N
: desired integer filter order (fixed at compile time)f0
: lower frequency limit for desired roll-off band > 0bw
: bandwidth of desired roll-off bandalpha
: slope of roll-off desired in nepers per neper,
- between -1 and 1 (ln mag / ln radian freq)See dm.spectral_tilt_demo
and the documentation for no.pink_noise
.
J.O. Smith and H.F. Smith, -"Closed Form Fractional Integration and Differentiation via Real Exponentially Spaced Pole-Zero Pairs", -arXiv.org publication arXiv:1606.06154 [cs.CE], June 7, 2016, -* http://arxiv.org/abs/1606.06154
-(fi.)levelfilter
Dynamic level lowpass filter.
-levelfilter
is a standard Faust function.
_ : levelfilter(L,freq) : _
-
-Where:
-L
: desired level (in dB) at Nyquist limit (SR/2), e.g., -60freq
: corner frequency (-3dB point) usually set to fundamental freqN
: Number of filters in series where L = L/N(fi.)levelfilterN
Dynamic level lowpass filter.
-_ : levelfilterN(N,freq,L) : _
-
-Where:
-N
: Number of filters in series where L = L/N, a constant numerical expressionfreq
: corner frequency (-3dB point) usually set to fundamental freqL
: desired level (in dB) at Nyquist limit (SR/2), e.g., -60Mth-octave filter-banks split the input signal into a bank of parallel signals, one
-for each spectral band. They are related to the Mth-Octave Spectrum-Analyzers in
-analysis.lib
.
-The documentation of this library contains more details about the implementation.
-The parameters are:
M
: number of band-slices per octave (>1), a constant numerical expressionN
: total number of bands (>2), a constant numerical expressionftop
: upper bandlimit of the Mth-octave bands (<SR/2)In addition to the Mth-octave output signals, there is a highpass signal -containing frequencies from ftop to SR/2, and a "dc band" lowpass signal -containing frequencies from 0 (dc) up to the start of the Mth-octave bands. -Thus, the N output signals are
-highpass(ftop), MthOctaveBands(M,N-2,ftop), dcBand(ftop*2^(-M*(N-1)))
-
-A Filter-Bank is defined here as a signal bandsplitter having the -property that summing its output signals gives an allpass-filtered -version of the filter-bank input signal. A more conventional term for -this is an "allpass-complementary filter bank". If the allpass filter -is a pure delay (and possible scaling), the filter bank is said to be -a "perfect-reconstruction filter bank" (see Vaidyanathan-1993 cited -below for details). A "graphic equalizer", in which band signals -are scaled by gains and summed, should be based on a filter bank.
-The filter-banks below are implemented as Butterworth or Elliptic -spectrum-analyzers followed by delay equalizers that make them -allpass-complementary.
-Go to higher filter orders - see Regalia et al. or Vaidyanathan (cited -below) regarding the construction of more aggressive recursive -filter-banks using elliptic or Chebyshev prototype filters.
-(fi.)mth_octave_filterbank[n]
Allpass-complementary filter banks based on Butterworth band-splitting. -For Butterworth band-splits, the needed delay equalizer is easily found.
-_ : mth_octave_filterbank(O,M,ftop,N) : par(i,N,_) // Oth-order
-_ : mth_octave_filterbank_alt(O,M,ftop,N) : par(i,N,_) // dc-inverted version
-
-Also for convenience:
-_ : mth_octave_filterbank3(M,ftop,N) : par(i,N,_) // 3rd-order Butterworth
-_ : mth_octave_filterbank5(M,ftop,N) : par(i,N,_) // 5th-order Butterworth
-mth_octave_filterbank_default = mth_octave_filterbank5;
-
-Where:
-O
: order of filter used to split each frequency band into two, a constant numerical expressionM
: number of band-slices per octave, a constant numerical expressionftop
: highest band-split crossover frequency (e.g., 20 kHz)N
: total number of bands (including dc and Nyquist), a constant numerical expressionThese are similar to the Mth-octave analyzers above, except that the -band-split frequencies are passed explicitly as arguments.
-(fi.)filterbank
Filter bank.
-filterbank
is a standard Faust function.
_ : filterbank (O,freqs) : par(i,N,_) // Butterworth band-splits
-
-Where:
-O
: band-split filter order (odd integer required for filterbank[i], a constant numerical expression)freqs
: (fc1,fc2,...,fcNs) [in numerically ascending order], where
- Ns=N-1 is the number of octave band-splits
- (total number of bands N=Ns+1).If frequencies are listed explicitly as arguments, enclose them in parens:
-_ : filterbank(3,(fc1,fc2)) : _,_,_
-
-(fi.)filterbanki
Inverted-dc filter bank.
-_ : filterbanki(O,freqs) : par(i,N,_) // Inverted-dc version
-
-Where:
-O
: band-split filter order (odd integer required for filterbank[i]
, a constant numerical expression)freqs
: (fc1,fc2,...,fcNs) [in numerically ascending order], where
- Ns=N-1 is the number of octave band-splits
- (total number of bands N=Ns+1).If frequencies are listed explicitly as arguments, enclose them in parens:
-_ : filterbanki(3,(fc1,fc2)) : _,_,_
-
-Solving the continuous SVF equations using trapezoidal integration
- -(fi.)svf
An environment with lp
, bp
, hp
, notch
, peak
, ap
, bell
, ls
, hs
SVF based filters.
-All filters have freq
and Q
parameters, the bell
, ls
, hs
ones also have a gain
third parameter.
_ : svf.xx(freq, Q, [gain]) : _
-
-Where:
-freq
: cut frequencyQ
: quality factor[gain]
: gain in dBThe Linkwitz-Riley (LR) crossovers are designed to produce a fully-flat -magnitude response when their outputs are combined. The 4th-order -LR filters (LR4) have a 24dB/octave slope and they are rather popular audio -crossovers used in multi-band processing.
-The LR4 can be constructed by cascading two second-order Butterworth -filters. For the second-order Butterworth filters, we will use the SVF -filter implemented above by setting the Q-factor to 1.0 / sqrt(2.0). -These will be cascaded in pairs to build the LR4 highpass and lowpass. -For the phase correction, we will use the 2nd-order Butterworth allpass.
-Zavalishin, Vadim. "The art of VA filter design." Native Instruments, Berlin, Germany (2012).
-(fi.)lowpassLR4
4th-order Linkwitz-Riley lowpass.
-_ : lowpassLR4(cf) : _
-
-Where:
-cf
is the lowpass cutoff in Hz(fi.)highpassLR4
4th-order Linkwitz-Riley highpass.
-_ : highpassLR4(cf) : _
-
-Where:
-cf
is the highpass cutoff in Hz(fi.)crossover2LR4
Two-way 4th-order Linkwitz-Riley crossover.
-_ : crossover2LR4(cf) : si.bus(2)
-
-Where:
-cf
is the crossover split cutoff in Hz(fi.)crossover3LR4
Three-way 4th-order Linkwitz-Riley crossover.
-_ : crossover3LR4(cf1, cf2) : si.bus(3)
-
-Where:
-cf1
is the crossover lower split cutoff in Hzcf2
is the crossover upper split cutoff in Hz(fi.)crossover4LR4
Four-way 4th-order Linkwitz-Riley crossover.
-_ : crossover4LR4(cf1, cf2, cf3) : si.bus(4)
-
-Where:
-cf1
is the crossover lower split cutoff in Hzcf2
is the crossover mid split cutoff in Hzcf3
is the crossover upper split cutoff in Hz(fi.)crossover8LR4
Eight-way 4th-order Linkwitz-Riley crossover.
-_ : crossover8LR4(cf1, cf2, cf3, cf4, cf5, cf6, cf7) : si.bus(8)
-
-Where:
-cf1-cf7
are the crossover cutoff frequencies in Hz(fi.)itu_r_bs_1770_4_kfilter
The prefilter from Recommendation ITU-R BS.1770-4 for loudness -measurement. Also known as "K-filter". The recommendation defines -biquad filter coefficients for a fixed sample rate of 48kHz (page -4-5). Here, we construct biquads for arbitrary samplerates. The -resulting filter is normalized, such that the magnitude at 997Hz is -unity gain 1.0.
-Please note, the ITU-recommendation handles the normalization in
-equation (2) by subtracting 0.691dB, which is not needed with
-itu_r_bs_1770_4_kfilter
.
One option for future improvement might be, to round those filter
-coefficients, that are almost equal to one. Second, the maximum
-magnitude difference at 48kHz between the ITU-defined filter and
-itu_r_bs_1770_4_kfilter
is 0.001dB, which obviously could be
-less.
_ : itu_r_bs_1770_4_kfilter : _
-
-(fi.)avg_rect
Moving average.
-_ : avg_rect(period) : _
-
-Where:
-period
is the averaging frame in seconds(fi.)avg_tau
Averaging function based on a one-pole filter and the tau response time. -Tau represents the effective length of the one-pole impulse response, -that is, tau is the integral of the filter's impulse response. This -response is slower to reach the final value but has less ripples in -non-steady signals.
-_ : avg_tau(period) : _
-
-Where:
-period
is the time, in seconds, for the system to decay by 1/e,
-or to reach 1-1/e of its final value.(fi.)avg_t60
Averaging function based on a one-pole filter and the t60 response time.
-This response is particularly useful when the system is required to
-reach the final value after about period
seconds.
_ : avg_t60(period) : _
-
-Where:
-period
is the time, in seconds, for the system to decay by 1/1000,
-or to reach 1-1/1000 of its final value.(fi.)avg_t19
Averaging function based on a one-pole filter and the t19 response time.
-This response is close to the moving-average algorithm as it roughly reaches
-the final value after period
seconds and shows about the same
-oscillations for non-steady signals.
_ : avg_t19(period) : _
-
-Where:
-period
is the time, in seconds, for the system to decay by 1/e^2.2,
-or to reach 1-1/e^2.2 of its final value.Zölzer, U. (2008). Digital audio signal processing (Vol. 9). New York: Wiley.
Welcome to the documentation for filters.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Faust library for high order ambisonic. Its official prefix is ho
.
(ho.)encoder
Ambisonic encoder. Encodes a signal in the circular harmonics domain -depending on an order of decomposition and an angle.
-encoder(N, x, a) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)x
: the signala
: the angle(ho.)rEncoder
Ambisonic encoder in 2D including source rotation. A mono signal is encoded at a certain ambisonic order -with two possible modes: either rotation with an angular speed, or static with a fixed angle (when speed is zero).
-_ : rEncoder(N, sp, a, it) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)sp
: the azimuth speed expressed as angular speed (2PI/sec), positive or negativea
: the fixed azimuth when the rotation stops (sp = 0) in radiansit
: interpolation time (in milliseconds) between the rotation and the fixed modes(ho.)stereoEncoder
Encoding of a stereo pair of channels with symetric angles (a/2, -a/2).
-_,_ : stereoEncoder(N, a) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)a
: opening angle in radians, left channel at a/2 angle, right channel at -a/2 angle(ho.)multiEncoder
Encoding of a set of P signals distributed on the unit circle according to a list of P speeds and P angles.
-_,_, ... : multiEncoder(N, lspeed, langle, it) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)lspeed
: a list of P speeds in turns by second (one speed per input signal, positive or negative)langle
: a list of P angles in radians on the unit circle to localize the sources (one angle per input signal)it
: interpolation time (in milliseconds) between the rotation and the fixed modes.(ho.)decoder
Decodes an ambisonics sound field for a circular array of loudspeakers.
-_ : decoder(N, P) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)P
: the number of speakers (constant numerical expression)The number of loudspeakers must be greater or equal to 2n+1. -It's preferable to use 2n+2 loudspeakers.
-(ho.)decoderStereo
Decodes an ambisonic sound field for stereophonic configuration.
-An "home made" ambisonic decoder for stereophonic restitution
-(30° - 330°): Sound field lose energy around 180°. You should
-use inPhase
optimization with ponctual sources.
_ : decoderStereo(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)iBasicDecoder
The irregular basic decoder is a simple decoder that projects the incoming ambisonic situation -to the loudspeaker situation (P loudspeakers) whatever it is, without compensation. -When there is a strong irregularity, there can be some discontinuity in the sound field.
-_,_, ... : iBasicDecoder(N,la, direct, shift) : _,_, ...
-
-Where:
-N
: the ambisonic order (there are 2*N+1 inputs to this function)la
: the list of P angles in degrees, for instance (0, 85, 182, 263) for four loudspeakersdirect
: 1 for direct mode, -1 for the indirect mode (changes the rotation direction)shift
: angular shift in degrees to easily adjust angles(ho.)circularScaledVBAP
The function provides a circular scaled VBAP with all loudspeakers and the virtual source on the unit-circle.
-_ : circularScaledVBAP(l, t) : _,_, ...
-
-Where:
-l
: the list of angles of the loudspeakers in degrees, for instance (0, 85, 182, 263) for four loudspeakerst
: the current angle of the virtual source in degrees(ho.)imlsDecoder
Irregular decoder in 2D for an irregular configuration of P loudspeakers -using 2D VBAP for compensation.
-_,_, ... : imlsDecoder(N,la, direct, shift) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)la
: the list of P angles in degrees, for instance (0, 85, 182, 263) for four loudspeakersdirect
: 1 for direct mode, -1 for the indirect mode (changes the rotation direction)shift
: angular shift in degrees to easily adjust angles(ho.)iDecoder
General decoder in 2D enabling an irregular multi-loudspeaker configuration -and to switch between multi-channel and stereo.
-_,_, ... : iDecoder(N, la, direct, st, g) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)la
: the list of angles in degreesdirect
: 1 for direct mode, -1 for the indirect mode (changes the rotation direction)shift
: angular shift in degrees to easily adjust anglesst
: 1 for stereo, 0 for multi-loudspeaker configuration. When 1, stereo sounds goes through the first two channelsg
: gain between 0 and 1Functions to weight the circular harmonics signals depending to the
-ambisonics optimization.
-It can be basic
for no optimization, maxRe
or inPhase
.
(ho.)optimBasic
The basic optimization has no effect and should be used for a perfect -circle of loudspeakers with one listener at the perfect center loudspeakers -array.
-_ : optimBasic(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optimMaxRe
The maxRe optimization optimizes energy vector. It should be used for an -auditory confined in the center of the loudspeakers array.
-_ : optimMaxRe(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optimInPhase
The inPhase optimization optimizes energy vector and put all loudspeakers signals -in phase. It should be used for an auditory.
-_ : optimInPhase(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optim
Ambisonic optimizer including the three elementary optimizers:
-(ho).optimBasic
, (ho).optimMaxRe
and (ho.)optimInPhase
.
_,_, ... : optim(N, ot) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)ot
: optimization type (0 for optimBasic
, 1 for optimMaxRe
, 2 for optimInPhase
)(ho.)wider
Can be used to wide the diffusion of a localized sound. The order -depending signals are weighted and appear in a logarithmic way to -have linear changes.
-_ : wider(N,w) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)w
: the width value between 0 - 1(ho.)mirror
Mirroring effect on the sound field.
-_,_, ... : mirror(N, fa) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)fa
: mirroring type (1 = original sound field, 0 = original+mirrored sound field, -1 = mirrored sound field)(ho.)map
It simulates the distance of the source by applying a gain -on the signal and a wider processing on the soundfield.
-map(N, x, r, a)
-
-Where:
-N
: the ambisonic order (constant numerical expression)x
: the signalr
: the radiusa
: the angle in radian(ho.)rotate
Rotates the sound field.
-_ : rotate(N, a) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)a
: the angle in radian(ho.)scope
Produces an XY pair of signals representing the ambisonic sound field.
-_,_, ... : scope(N, rt) : _,_
-
-Where:
-N
: the ambisonic order (constant numerical expression)rt
: refreshment time in millisecondsWe propose implementations of processes intricated to the ambisonic model. -The process is implemented using as many instances as the number of harmonics at at certain order. -The key control parameters of these instances are computed thanks to distribution functions -(th functions below) and to a global driving factor.
-(ho.).fxDecorrelation
Spatial ambisonic decorrelation in fx mode.
-fxDecorrelation
applies decorrelations to spatial components already created.
-The decorrelation is defined for each #i spatial component among P=2*N+1 at the ambisonic order N
-as a delay of 0 if factor fa
is under a certain value 1-(i+1)/P and d*F((i+1)/p) in the contrary case,
-where d
is the maximum delay applied (in samples) and F is a distribution function for durations.
-The user can choose this delay time distribution among 22 different ones.
-The delay increases according to the index of ambisonic components.
-But it increases at each step and it is modulated by a threshold.
-Therefore, delays are progressively revealed when the factor increases:
_,_, ... : fxDecorrelation(N, d, wf, fa, fd, tf) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)d
: the maximum delay applied (in samples)wf
: window frequency (in Hz) for the overlapped delayfa
: decorrelation factor (between 0 and 1)fd
: feedback / level of reinjection (between 0 and 1)tf
: type of function of delay distribution (integer, between 0 and 21)(ho.).synDecorrelation
Spatial ambisonic decorrelation in syn mode.
-synDecorrelation
generates spatial decorrelated components in ambisonics from one mono signal.
-The decorrelation is defined for each #i spatial component among P=2*N+1 at the ambisonic order N
-as a delay of 0 if factor fa
is under a certain value 1-(i+1)/P and d*F((i+1)/p) in the contrary case,
-where d
is the maximum delay applied (in samples) and F is a distribution function for durations.
-The user can choose this delay time distribution among 22 different ones.
-The delay increases according to the index of ambisonic components.
-But it increases at each step and it is modulated by a threshold.
-Therefore, delays are progressively revealed when the factor increases:
When the factor is between [0; 1/P], upper harmonics are progressively faded and the level of the H0 component is compensated -to avoid source localization and to produce a large mono.
-_,_, ... : synDecorrelation(N, d, wf, fa, fd, tf) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)d
: the maximum delay applied (in samples)wf
: window frequency (in Hz) for the overlapped delayfa
: decorrelation factor (between 0 and 1)fd
: feedback / level of reinjection (between 0 and 1)tf
: type of function of delay distribution (integer, between 0 and 21)(ho.).fxRingMod
Spatial ring modulation in syn mode.
-fxRingMod
applies ring modulation to spatial components already created.
-The ring modulation is defined for each spatial component among P=2*n+1 at the ambisonic order N
.
-For each spatial component #i, the result is either the original signal or a ring modulated signal
-according to a threshold that is i/P.
The general process is drive by a factor fa
between 0 and 1 and a modulation frequency f0
.
-If fa
is greater than theshold (P-i-1)/P, the ith ring modulator is on with carrier frequency of f0*(i+1)/P.
-On the contrary, it provides the original signal.
Therefore ring modulators are progressively revealed when fa
increases.
_,_, ... : fxRingMod(N, f0, fa, tf) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)f0
: the maximum delay applied (in samples)fa
: decorrelation factor (between 0 and 1)tf
: type of function of delay distribution (integer, between 0 and 21)(ho.).synRingMod
Spatial ring modulation in syn mode.
-synRingMod
generates spatial components in ambisonics from one mono signal thanks to ring modulation.
-The ring modulation is defined for each spatial component among P=2*n+1 at the ambisonic order N
.
-For each spatial component #i, the result is either the original signal or a ring modulated signal
-according to a threshold that is i/P.
The general process is drive by a factor fa
between 0 and 1 and a modulation frequency f0
.
-If fa
is greater than theshold (P-i-1)/P, the ith ring modulator is on with carrier frequency of f0*(i+1)/P.
-On the contrary, it provides the original signal.
Therefore ring modulators are progressively revealed when fa
increases.
-When the factor is between [0; 1/P], upper harmonics are progressively faded and the level of the H0 component is compensated
-to avoid source localization and to produce a large mono.
_,_, ... : synRingMod(N, f0, fa, tf) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)f0
: the maximum delay applied (in samples)fa
: decorrelation factor (between 0 and 1)tf
: type of function of delay distribution (integer, between 0 and 21)(ho.)encoder3D
Ambisonic encoder. Encodes a signal in the circular harmonics domain -depending on an order of decomposition, an angle and an elevation.
-encoder3D(N, x, a, e) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)x
: the signala
: the anglee
: the elevation(ho.)rEncoder3D
Ambisonic encoder in 3D including source rotation. A mono signal is encoded at at certain ambisonic order -with two possible modes: either rotation with 2 angular speeds (azimuth and elevation), or static with a fixed pair of angles.
-rEncoder3D
is a standard Faust function.
_ : rEncoder3D(N, azsp, elsp, az, el, it) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)azsp
: the azimuth speed expressed as angular speed (2PI/sec), positive or negativeelsp
: the elevation speed expressed as angular speed (2PI/sec), positive or negativeaz
: the fixed azimuth when the azimuth rotation stops (azsp = 0) in radiansel
: the fixed elevation when the elevation rotation stops (elsp = 0) in radiansit
: interpolation time (in milliseconds) between the rotation and the fixed modes(ho.)optimBasic3D
The basic optimization has no effect and should be used for a perfect -sphere of loudspeakers with one listener at the perfect center loudspeakers -array.
-_ : optimBasic3D(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optimMaxRe3D
The maxRe optimization optimize energy vector. It should be used for an -auditory confined in the center of the loudspeakers array.
-_ : optimMaxRe3D(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optimInPhase3D
The inPhase Optimization optimizes energy vector and put all loudspeakers signals -in phase. It should be used for an auditory.
-_ : optimInPhase3D(N) : _
-
-Where:
-N
: the ambisonic order (constant numerical expression)(ho.)optim3D
Ambisonic optimizer including the three elementary optimizers:
-(ho).optimBasic3D
, (ho).optimMaxRe3D
and (ho.)optimInPhase3D
.
_,_, ... : optim3D(N, ot) : _,_, ...
-
-Where:
-N
: the ambisonic order (constant numerical expression)ot
: optimization type (0 for optimBasic, 1 for optimMaxRe, 2 for optimInPhase)Welcome to the documentation for hoa.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-4 phases envelope to control vibrato gain
-USAGE: - _ : *(envVibrato(b,a,s,r,t)) : _ -where - b = beginning duration (silence) in seconds - a = attack duration in seconds - s = sustain as a percentage of the amplitude to be modified - r = release duration in seconds - t = trigger signal
-Envelope generator which asymptotically approaches a target value.
-USAGE: - asympT60(value,trgt,T60,trig) : _ -where - value = starting value - trgt = target value - T60 = ramping time - trig = trigger signal
-Positive and negative clipping functions.
-USAGE: - _ : saturationPos : _ - _ : saturationNeg : _ - _ : saturationPos : saturationNeg : _
-Simple bow table.
-USAGE: - index : bow(offset,slope) : _ -where - 0 <= index <= 1
-Simple reed table to be used with waveguide models of clarinet, saxophone, etc.
-USAGE: - _ : reed(offset,slope) : _ -where - offset = offset between 0 and 1 - slope = slope between 0 and 1 -REFERENCE: -* https://ccrma.stanford.edu/~jos/pasp/View_Single_Reed_Oscillation.html
-Simple One zero and One zero recursive filters
-USAGE: - _ : oneZero0(b0,b1) : _ - _ : oneZero1(b0,b1) : _ -REFERENCE: -* https://ccrma.stanford.edu/~jos/fp2/One_Zero.html
-Band pass filter using a biquad (TF2 is declared in filter.lib)
-USAGE: - _ : bandPassH(resonance,radius) : _ -where - resonance = center frequency - radius = radius
-Jet Table: flue jet non-linear function, computed by a polynomial calculation
-USAGE: - _ : nonLinearModulator(nonlinearity,env,freq,typeMod,freqMod,order) : _ -where - nonlinearity = nonlinearity coefficient between 0 and 1 - env = input to connect any kind of envelope - freq = current tone frequency - typeMod = if 0: theta is modulated by the incoming signal; - freqMod = frequency of the sine wave modulation - order = order of the filter
-This function takes a mono input signal and spacialize it in stereo -in function of the period duration of the tone being played.
-USAGE: - _ : stereo(periodDuration) : , -where - periodDuration = period duration of the tone being played in number of samples -REFERENCE: -* https://ccrma.stanford.edu/realsimple/faust_strings/
-GUI for zita_rev1_stereo from reverbs.lib
-USAGE: - , : instrRerveb
Welcome to the documentation for instruments.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library to handle interpolation. Its official prefix is it
.
This library provides several basic interpolation functions, as well as interpolators
-taking a gen
circuit of N outputs producing values to be interpolated, triggered
-by a idv
read index signal. Two points and four points interpolations are implemented.
The idv
parameter is to be used as a read index. In -single
(= singleprecision) mode,
-a technique based on 2 signals with the pure integer index and a fractional part in the [0,1]
-range is used to avoid accumulating errors. In -double
(= doubleprecision) or -quad
(= quadprecision) modes,
-a standard implementation with a single fractional index signal is used. Three functions int_part
, frac_part
and mak_idv
are available to manipulate the read index signal.
Here is a use-case with waveform
. Here the signal given to interpolator_XXX
uses the idv
model.
waveform_interpolator(wf, step, interp) = interp(gen, idv)
-with {
- gen(idx) = wf, (idx:max(0):min(size-1)) : rdtable with { size = wf:(_,!); }; /* waveform size */
- index = (+(step)~_)-step; /* starting from 0 */
- idv = it.make_idv(index); /* build the signal for interpolation in a generic way */
-};
-
-waveform_linear(wf, step) = waveform_interpolator(wf, step, it.interpolator_linear);
-waveform_cosine(wf, step) = waveform_interpolator(wf, step, it.interpolator_cosine);
-waveform_cubic(wf, step) = waveform_interpolator(wf, step, it.interpolator_cubic);
-
-waveform_interp(wf, step, selector) = waveform_interpolator(wf, step, interp_select(selector))
-with {
- /* adapts the argument order */
- interp_select(sel, gen, idv) = it.interpolator_select(gen, idv, sel);
-};
-
-waveform and index
-waveform_interpolator1(wf, idv, interp) = interp(gen, idv)
-with {
- gen(idx) = wf, (idx:max(0):min(size-1)) : rdtable with { size = wf:(_,!); }; /* waveform size */
-};
-
-waveform_linear1(wf, idv) = waveform_interpolator1(wf, idv, it.interpolator_linear);
-waveform_cosine1(wf, idv) = waveform_interpolator1(wf, idv, it.interpolator_cosine);
-waveform_cubic1(wf, idv) = waveform_interpolator1(wf, idv, it.interpolator_cubic);
-
-waveform_interp1(wf, idv, selector) = waveform_interpolator1(wf, idv, interp_select(selector))
-with {
- /* adapts the argument order */
- interp_select(sel, gen, idv) = it.interpolator_select(gen, idv, sel);
-};
-
-Some tests here:
-wf = waveform {0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 50.0, 40.0, 30.0, 20.0, 10.0, 0.0};
-
-process = waveform_linear(wf, step), waveform_cosine(wf, step), waveform_cubic(wf, step) with { step = 0.25; };
-
-process = waveform_interp(wf, 0.25, nentry("algo", 0, 0, 3, 1));
-
-process = waveform_interp1(wf, idv, nentry("algo", 0, 0, 3, 1))
-with {
- step = 0.1;
- idv_aux = (+(step)~_)-step; /* starting from 0 */
- idv = it.make_idv(idv_aux); /* build the signal for interpolation in a generic way */
-};
-
-/* Test linear interpolation between 2 samples with a `(idx,dv)` signal built using a waveform */
-linear_test = (idx,dv), it.interpolator_linear(gen, (idx,dv))
-with {
- /* signal to interpolate (only 2 points here) */
- gen(id) = waveform {3.0, -1.0}, (id:max(0)) : rdtable;
- dv = waveform {0.0, 0.25, 0.50, 0.75, 1.0}, index : rdtable;
- idx = 0;
- /* test index signal */
- index = (+(1)~_)-1; /* starting from 0 */
-};
-
-/* Test cosine interpolation between 2 samples with a `(idx,dv)` signal built using a waveform */
-cosine_test = (idx,dv), it.interpolator_cosine(gen, (idx,dv))
-with {
- /* signal to interpolate (only 2 points here) */
- gen(id) = waveform {3.0, -1.0}, (id:max(0)) : rdtable;
- dv = waveform {0.0, 0.25, 0.50, 0.75, 1.0}, index : rdtable;
- idx = 0;
- /* test index signal */
- index = (+(1)~_)-1; /* starting from 0 */
-};
-
-/* Test cubic interpolation between 4 samples with a `(idx,dv)` signal built using a waveform */
-cubic_test = (idx,dv), it.interpolator_cubic(gen, (idx,dv))
-with {
- /* signal to interpolate (only 4 points here) */
- gen(id) = waveform {-1.0, 2.0, 1.0, 4.0}, (id:max(0)) : rdtable;
- dv = waveform {0.0, 0.25, 0.50, 0.75, 1.0}, index : rdtable;
- idx = 0;
- /* test index signal */
- index = (+(1)~_)-1; /* starting from 0 */
-};
-
-(it.)interpolate_linear
Linear interpolation between 2 values.
-interpolate_linear(dv,v0,v1) : _
-
-Where:
-dv
: in the fractional value in [0..1] rangev0
: is the first valuev1
: is the second value(it.)interpolate_cosine
Cosine interpolation between 2 values.
-interpolate_cosine(dv,v0,v1) : _
-
-Where:
-dv
: in the fractional value in [0..1] rangev0
: is the first valuev1
: is the second value(it.)interpolate_cubic
Cubic interpolation between 4 values.
-interpolate_cubic(dv,v0,v1,v2,v3) : _
-
-Where:
-dv
: in the fractional value in [0..1] rangev0
: is the first valuev1
: is the second valuev2
: is the third valuev3
: is the fourth value(it.)interpolator_two_points
Generic interpolator on two points (current and next index), assuming an increasing index.
-interpolator_two_points(gen, idv, interpolate_two_points) : si.bus(outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pairinterpolate_two_points
: a two points interpolation function(it.)interpolator_linear
Linear interpolator for a 'gen' circuit triggered by an 'idv' input to generate values.
-interpolator_linear(gen, idv) : si.bus(outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pair(it.)interpolator_cosine
Cosine interpolator for a 'gen' circuit triggered by an 'idv' input to generate values.
-interpolator_cosine(gen, idv) : si.bus(outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pair(it.)interpolator_four_points
Generic interpolator on interpolator_four_points points (previous, current and two next indexes), assuming an increasing index.
-interpolator_four_points(gen, idv, interpolate_four_points) : si.bus(outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pairinterpolate_four_points
: a four points interpolation function(it.)interpolator_cubic
Cubic interpolator for a 'gen' circuit triggered by an 'idv' input to generate values
-interpolator_cubic(gen, idv) : si.bus(outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pair(it.)interpolator_select
Generic configurable interpolator (with selector between in [0..3]). The value 3 is used for no interpolation.
-interpolator_select(gen, idv, sel) : _,_... (equal to N = outputs(gen))
-
-Where:
-gen
: a circuit with an 'idv' reader input that produces N outputsidv
: a fractional read index expressed as a float value, or a (int,frac) pairsel
: an interpolation algorithm selector in [0..3] (0 = linear, 1 = cosine, 2 = cubic, 3 = nointerp)(it.)lagrangeCoeffs(N, xCoordsList)
This is a function to generate N + 1 coefficients for an Nth-order Lagrange -basis polynomial with arbitrary spacing of the points.
-lagrangeCoeffs(N, xCoordsList, x) : si.bus(N + 1)
-
-Where:
-N
: order of the interpolation filter, known at compile-timexCoordsList
: a list of N + 1 elements determining the x-axis coordinates of N + 1 values, known at compile-timex
: a fractional position on the x-axis to obtain the interpolated y-value(it.)lagrangeInterpolation(N, xCoordsList)
Nth-order Lagrange interpolator to interpolate between a set of arbitrarily spaced N + 1 points.
-x , yCoords : lagrangeInterpolation(N, xCoordsList) : _
-
-Where:
-N
: order of the interpolator, known at compile-timexCoordsList
: a list of N + 1 elements determining the x-axis spacing of the points, known at compile-timex
: an x-axis position to interpolate between the y-valuesyCoords
: N + 1 elements determining the values of the interpolation pointsExample: find the centre position of a four-point set using an order-3 -Lagrange function fitting the equally-spaced points [2, 5, -1, 3]:
-N = 3;
-xCoordsList = (0, 1, 2, 3);
-x = N / 2.0;
-yCoords = 2, 5, -1, 3;
-process = x, yCoords : lagrangeInterpolation(N, xCoordsList);
-
-which outputs ~1.938.
-Example: output the dashed curve showed on the Wikipedia page (top figure, https://en.wikipedia.org/wiki/Lagrange_polynomial):
-N = 3;
-xCoordsList = (-9, -4, -1, 7);
-x = os.phasor(16, 1) - 9;
-yCoords = 5, 2, -2, 9;
-process = x, yCoords : lagrangeInterpolation(N, xCoordsList);
-
-(it.)frdtable(N, S)
Look-up circular table with Nth-order Lagrange interpolation for fractional -indexes. The index is wrapped-around and the table is cycles for an index -span of size S, which is the table size in samples.
-frdtable(N, S, init, idx) : _
-
-Where:
-N
: Lagrange interpolation order, known at compile-timeS
: table size in samples, known at compile-timeinit
: signal for table initialisationidx
: fractional index wrapped-around 0 and STest the effectiveness of the 5th-order interpolation scheme by -creating a table look-up oscillator using only 16 points of a sinewave; -compare the result with a non-interpolated version:
-N = 5;
-S = 16;
-index = os.phasor(S, 1000);
-process = rdtable(S, os.sinwaveform(S), int(index)) ,
- it.frdtable(N, S, os.sinwaveform(S), index);
-
-(it.)frwtable(N, S)
Look-up updatable circular table with Nth-order Lagrange interpolation for -fractional indexes. The index is wrapped-around and the table is circular -indexes ranging from 0 to S, which is the table size in samples.
-frwtable(N, S, init, w_idx, x, r_idx) : _
-
-Where:
-N
: Lagrange interpolation order, known at compile-timeS
: table size in samples, known at compile-timeinit
: constant for table initialisation, known at compile-timew_idx
: it should be an INT between 0 and S - 1x
: input signal written on the w_idx positionsr_idx
: fractional index wrapped-around 0 and STest the effectiveness of the 5th-order interpolation scheme by -creating a table look-up oscillator using only 16 points of a sinewave; -compare the result with a non-interpolated version:
-N = 5;
-S = 16;
-rIdx = os.phasor(S, 300);
-wIdx = ba.period(S);
-process = rwtable(S, os.sinwaveform(S), wIdx, os.sinwaveform(S), int(rIdx)) ,
- frwtable(N, S, os.sinwaveform(S), wIdx, os.sinwaveform(S), rIdx);
-
-(it.)remap
Linearly map from an input domain to an output range.
-_ : remap(from1, from2, to1, to2) : _
-
-Where:
-from1
: the domain's lower bound.from2
: the domain's upper bound.to1
: the range's lower bound.to2
: the range's upper bound.Note that having from1
== from2
in the mapping will cause a division by zero that has to be taken in account.
Example: An oscillator remapped from [-1., 1.] to [100., 1000.]
-os.osc(440) : it.remap(-1., 1., 100., 1000.)
-
Welcome to the documentation for interpolators.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Mathematic library for Faust. Its official prefix is ma
.
(ma.)SR
Current sampling rate given at init time. Constant during program execution.
-SR : _
-
-(ma.)T
Current sample duration in seconds computed from the sampling rate given at init time. Constant during program execution.
-T : _
-
-(ma.)BS
Current block-size. Can change during the execution at each block.
-BS : _
-
-(ma.)PI
Constant PI in double precision.
-PI : _
-
-(ma.)deg2rad
Convert degrees to radians.
-45. : deg2rad
-
-(ma.)rad2deg
Convert radians to degrees.
-ma.PI : rad2deg
-
-(ma.)E
Constant e in double precision.
-E : _
-
-(ma.)EPSILON
Constant EPSILON available in simple/double/quad precision,
-as defined in the floating-point standard
-and machine epsilon,
-that is smallest positive number such that 1.0 + EPSILON != 1.0
.
EPSILON : _
-
-(ma.)MIN
Constant MIN available in simple/double/quad precision (minimal positive value).
-MIN : _
-
-(ma.)MAX
Constant MAX available in simple/double/quad precision (maximal positive value).
-MAX : _
-
-(ma.)FTZ
Flush to zero: force samples under the "maximum subnormal number" -to be zero. Usually not needed in C++ because the architecture -file take care of this, but can be useful in JavaScript for instance.
-_ : FTZ : _
-
-(ma.)copysign
Changes the sign of x (first input) to that of y (second input).
-_,_ : copysign : _
-
-(ma.)neg
Invert the sign (-x) of a signal.
-_ : neg : _
-
-(ma.)not
Bitwise not
implemented with xor as not(x) = x xor -1;
.
-So working regardless of the size of the integer, assuming negative numbers in two's complement.
_ : not : _
-
-(ma.)sub(x,y)
Subtract x
and y
.
_,_ : sub : _
-
-(ma.)inv
Compute the inverse (1/x) of the input signal.
-_ : inv : _
-
-(ma.)cbrt
Computes the cube root of of the input signal.
-_ : cbrt : _
-
-(ma.)hypot
Computes the euclidian distance of the two input signals -sqrt(xx+yy) without undue overflow or underflow.
-_,_ : hypot : _
-
-(ma.)ldexp
Takes two input signals: x and n, and multiplies x by 2 to the power n.
-_,_ : ldexp : _
-
-(ma.)scalb
Takes two input signals: x and n, and multiplies x by 2 to the power n.
-_,_ : scalb : _
-
-(ma.)log1p
Computes log(1 + x) without undue loss of accuracy when x is nearly zero.
-_ : log1p : _
-
-(ma.)logb
Return exponent of the input signal as a floating-point number.
-_ : logb : _
-
-(ma.)ilogb
Return exponent of the input signal as an integer number.
-_ : ilogb : _
-
-(ma.)log2
Returns the base 2 logarithm of x.
-_ : log2 : _
-
-(ma.)expm1
Return exponent of the input signal minus 1 with better precision.
-_ : expm1 : _
-
-(ma.)acosh
Computes the principle value of the inverse hyperbolic cosine -of the input signal.
-_ : acosh : _
-
-(ma.)asinh
Computes the inverse hyperbolic sine of the input signal.
-_ : asinh : _
-
-(ma.)atanh
Computes the inverse hyperbolic tangent of the input signal.
-_ : atanh : _
-
-(ma.)sinh
Computes the hyperbolic sine of the input signal.
-_ : sinh : _
-
-(ma.)cosh
Computes the hyperbolic cosine of the input signal.
-_ : cosh : _
-
-(ma.)tanh
Computes the hyperbolic tangent of the input signal.
-_ : tanh : _
-
-(ma.)erf
Computes the error function of the input signal.
-_ : erf : _
-
-(ma.)erfc
Computes the complementary error function of the input signal.
-_ : erfc : _
-
-(ma.)gamma
Computes the gamma function of the input signal.
-_ : gamma : _
-
-(ma.)lgamma
Calculates the natural logorithm of the absolute value of -the gamma function of the input signal.
-_ : lgamma : _
-
-(ma.)J0
Computes the Bessel function of the first kind of order 0 -of the input signal.
-_ : J0 : _
-
-(ma.)J1
Computes the Bessel function of the first kind of order 1 -of the input signal.
-_ : J1 : _
-
-(ma.)Jn
Computes the Bessel function of the first kind of order n -(first input signal) of the second input signal.
-_,_ : Jn : _
-
-(ma.)Y0
Computes the linearly independent Bessel function of the second kind -of order 0 of the input signal.
-_ : Y0 : _
-
-(ma.)Y1
Computes the linearly independent Bessel function of the second kind -of order 1 of the input signal.
-_ : Y0 : _
-
-(ma.)Yn
Computes the linearly independent Bessel function of the second kind -of order n (first input signal) of the second input signal.
-_,_ : Yn : _
-
-(ma.)fabs
, (ma.)fmax
, (ma.)fmin
Just for compatibility...
-fabs = abs
-fmax = max
-fmin = min
-
-(ma.)np2
Gives the next power of 2 of x.
-np2(n) : _
-
-Where:
-n
: an integer(ma.)frac
Gives the fractional part of n.
-frac(n) : _
-
-Where:
-n
: a decimal number(ma.)modulo
Modulus operation.
-modulo(x,y) : _
-
-Where:
-x
: the numeratory
: the denominator(ma.)isnan
Return non-zero if x is a NaN.
-isnan(x)
-_ : isnan : _
-
-Where:
-x
: signal to analyse(ma.)isinf
Return non-zero if x is a positive or negative infinity.
-isinf(x)
-_ : isinf : _
-
-Where:
-x
: signal to analyse(ma.)chebychev
Chebychev transformation of order N.
-_ : chebychev(N) : _
-
-Where:
-N
: the order of the polynomial, a constant numerical expressionT[0](x) = 1,
-T[1](x) = x,
-T[n](x) = 2x*T[n-1](x) - T[n-2](x)
-
-(ma.)chebychevpoly
Linear combination of the first Chebyshev polynomials.
-_ : chebychevpoly((c0,c1,...,cn)) : _
-
-Where:
-cn
: the different Chebychevs polynomials such that:
- chebychevpoly((c0,c1,...,cn)) = Sum of chebychev(i)*ci(ma.)diffn
Negated first-order difference.
-_ : diffn : _
-
-(ma.)signum
The signum function signum(x) is defined as --1 for x<0, 0 for x==0, and 1 for x>0.
-_ : signum : _
-
-(ma.)nextpow2
The nextpow2(x) returns the lowest integer m such that -2^m >= x.
-2^nextpow2(n) : _
-
-Useful for allocating delay lines, e.g.,
-delay(2^nextpow2(maxDelayNeeded), currentDelay);
-
-(ma.)zc
Indicator function for zero-crossing: it returns 1 if a zero-crossing -occurs, 0 otherwise.
-_ : zc : _
-
-(ma.)primes
Return the n-th prime using a waveform primitive. Note that primes(0) is 2, -primes(1) is 3, and so on. The waveform is length 2048, so the largest -precomputed prime is primes(2047) which is 17863.
-_ : primes : _
-
Welcome to the documentation for maths.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-MaxMSP compatibility Library.
-Welcome to the documentation for maxmsp.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This ongoing work is the fruit of a collaboration between GRAME-CNCM and -the ANIS (Arts Numériques et Immersions Sensorielles) research group from -GIPSA-Lab (Université Grenoble Alpes).
-This library implements basic 1-DoF mass-interaction physics algorithms,
-allowing to declare and connect physical elements (masses, springs, non
-linear interactions, etc.) together to form topological networks.
-Models can be assembled by hand, however in more complex scenarios it is
-recommended to use a scripting tool (such as MIMS) to generate the FAUST
-signal routing for a given physical network. Its official prefix is mi
.
The core mass-interaction algorithms implemented in this library are in the public -domain and are disclosed in the following scientific publications:
-These utility functions are used to help certain operations (e.g. define initial -positions and velocities for physical elements).
-(mi.)initState
Used to set initial delayed position values that must be initialised -at step 0 of the physics simulation.
-If you develop any of your own modules, you will need to use this (see
-mass
and springDamper
algorithm codes for examples).
x : initState(x0) : _
-
-Where:
-x
: position value signalx0
: initial value for positionAll mass-type physical element functions are declared here. They all expect to receive -a force input signal and produce a position signal. -All physical parameters are expressed in sample-rate dependant values.
-(mi.)mass
Implementation of a punctual mass element. -Takes an input force and produces output position.
-mass(m, grav, x0, xr0),_ : _
-
-Where:
-m
: mass valuegrav
: gravity force valuex0
: initial positionxr0
: initial delayed position (inferred from initial velocity)(mi.)oscil
Implementation of a simple linear harmonic oscillator. -Takes an input force and produces output position.
-oscil(m, k, z, grav, x0, xr0),_ : _
-
-Where:
-m
: mass valuek
: stiffness valuez
: damping valuegrav
: gravity force valuex0
: initial positionxr0
: initial delayed position (inferred from initial velocity)(mi.)ground
Implementation of a fixed point element. -The position output produced by this module never changes, however -it still expects a force input signal (for compliance with connection -rules).
-ground(x0),_ : _
-
-Where:
-x0
: initial position(mi.)posInput
Implementation of a position input module (driven by an outside -signal). Takes two signal inputs: incoming force (which doesn't -affect position) and the driving position signal.
-posInput(x0),_,_ : _
-
-Where:
-x0
: initial positionAll interaction-type physical element functions are declared here. They each expect to -receive two position signals (coming from the two mass-elements that they connect) and -produce two equal and opposite force signals that must be routed back to the mass -elements' inputs. -All physical parameters are expressed in sample-rate dependant values.
-(mi.)spring
Implementation of a linear elastic spring interaction.
-spring(k, x1r, x2r),_,_ : _,_
-
-Where:
-k
: stiffness valuex1r
: initial delayed position of mass 1 (unused here)x2r
: initial delayed position of mass 2 (unused here)(mi.)damper
Implementation of a linear damper interaction. -Beware: in 32bit precision mode, damping forces can become -truncated if position values are not centered around zero!
-damper(z, x1r, x2r),_,_ : _,_
-
-Where:
-z
: damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)springDamper
Implementation of a linear viscoelastic spring-damper interaction -(a combination of the spring and damper modules).
-springDamper(k, z, x1r, x2r),_,_ : _,_
-
-Where:
-k
: stiffness valuez
: damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlSpringDamper2
Implementation of a non-linear viscoelastic spring-damper interaction
-containing a quadratic term (function of squared distance).
-Beware: at high displacements, this interaction will break numerical
-stability conditions ! The nlSpringDamperClipped
is a safer option.
nlSpringDamper2(k, q, z, x1r, x2r),_,_ : _,_
-
-Where:
-k
: linear stiffness valueq
: quadratic stiffness valuez
: damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlSpringDamper3
Implementation of a non-linear viscoelastic spring-damper interaction
-containing a cubic term (function of distance^3).
-Beware: at high displacements, this interaction will break numerical
-stability conditions ! The nlSpringDamperClipped
is a safer option.
nlSpringDamper3(k, q, z, x1r, x2r),_,_ : _,_
-
-Where:
-k
: linear stiffness valueq
: cubic stiffness valuez
: damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlSpringDamperClipped
Implementation of a non-linear viscoelastic spring-damper interaction -containing a cubic term (function of distance^3), bound by an -upper linear stiffness (hard-clipping).
-This bounding means that when faced with strong displacements, the -interaction profile will "clip" at a given point and never produce -forces higher than the bounding equivalent linear spring, stopping models -from becoming unstable.
-So far the interaction clips "hard" (with no soft-knee spline -interpolation, etc.)
-nlSpringDamperClipped(s, c, k, z, x1r, x2r),_,_ : _,_
-
-Where:
-s
: linear stiffness valuec
: cubic stiffness valuek
: upper-bound linear stiffness valuez
: (linear) damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlPluck
Implementation of a piecewise linear plucking interaction. -The symmetric function provides a repulsive viscoelastic interaction -upon contact, until a tipping point is reached (when the plucking occurs). -The tipping point depends both on the stiffness and the distance scaling -of the interaction.
-nlPluck(knl, scale, z, x1r, x2r),_,_ : _,_
-
-Where:
-knl
: stiffness scaling parameter (vertical stretch of the NL function)scale
: distance scaling parameter (horizontal stretch of the NL function)z
: (linear) damping valuex1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlBow
Implementation of a non-linear friction based interaction
-that allows for stick-slip bowing behaviour.
-Two versions are proposed : a piecewise linear function (very
-similar to the nlPluck
) or a mathematical approximation (see
-Stefan Bilbao's book, Numerical Sound Synthesis).
nlBow(znl, scale, type, x1r, x2r),_,_ : _,_
-
-Where:
-znl
: friction scaling parameter (vertical stretch of the NL function)scale
: velocity scaling parameter (horizontal stretch of the NL function)type
: interaction profile (0 = piecewise linear, 1 = smooth function)x1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)collision
Implementation of a collision interaction, producing linear visco-elastic -repulsion forces when two mass elements are interpenetrating.
-collision(k, z, thres, x1r, x2r),_,_ : _,_
-
-Where:
-k
: collision stiffness parameterz
: collision damping parameterthres
: threshold distance for the contact between elementsx1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2(mi.)nlCollisionClipped
Implementation of a collision interaction, producing non-linear -visco-elastic repulsion forces when two mass elements are interpenetrating. -Bound by an upper stiffness value to maintain stability. -This interaction is particularly useful for more realistic contact dynamics -(greater difference in velocity provides sharper contacts, and reciprocally).
-nlCollisionClipped(s, c, k, z, thres, x1r, x2r),_,_ : _,_
-
-Where:
-s
: collision linear stiffness parameterc
: collision cubic stiffness parameterk
: collision upper-bounding stiffness parameterz
: collision damping parameterthres
: threshold distance for the contact between elementsx1r
: initial delayed position of mass 1x2r
: initial delayed position of mass 2Welcome to the documentation for mi.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Collection of audio effects library. Its official prefix is ef
.
The library is organized into 7 sections:
- -(ef.)cubicnl
Cubic nonlinearity distortion.
-cubicnl
is a standard Faust function.
_ : cubicnl(drive,offset) : _
-_ : cubicnl_nodc(drive,offset) : _
-
-Where:
-drive
: distortion amount, between 0 and 1offset
: constant added before nonlinearity to give even harmonics. Note: offset
- can introduce a nonzero mean - feed cubicnl output to dcblocker to remove this.(ef.)gate_mono
Mono signal gate.
-gate_mono
is a standard Faust function.
_ : gate_mono(thresh,att,hold,rel) : _
-
-Where:
-thresh
: dB level threshold above which gate opens (e.g., -60 dB)att
: attack time = time constant (sec) for gate to open (e.g., 0.0001 s = 0.1 ms)hold
: hold time = time (sec) gate stays open after signal level < thresh (e.g., 0.1 s)rel
: release time = time constant (sec) for gate to close (e.g., 0.020 s = 20 ms)(ef.)gate_stereo
Stereo signal gates.
-gate_stereo
is a standard Faust function.
_,_ : gate_stereo(thresh,att,hold,rel) : _,_
-
-Where:
-thresh
: dB level threshold above which gate opens (e.g., -60 dB)att
: attack time = time constant (sec) for gate to open (e.g., 0.0001 s = 0.1 ms)hold
: hold time = time (sec) gate stays open after signal level < thresh (e.g., 0.1 s)rel
: release time = time constant (sec) for gate to close (e.g., 0.020 s = 20 ms)(ef.)fibonacci
Fibonacci system where the current output is the current -input plus the sum of the previous N outputs.
-_ : fibonacci(N) : _
-
-Where:
-N
: the Fibonacci system's order, where 2 is standardGenerate the famous series: [1, 1, 2, 3, 5, 8, 13, ...]
-1. : ba.impulsify : fibonacci(2)
-
-(ef.)fibonacciGeneral
Fibonacci system with customizable coefficients. -The order of the system is inferred from the number of coefficients.
-_ : fibonacciGeneral(wave) : _
-
-Where:
-wave
: a waveform such as waveform{1, 1}
Use the update equation y = 2*y' + 3*y'' + 4*y'''
1. : ba.impulsify : fibonacciGeneral(waveform{2, 3, 4})
-
-(ef.)fibonacciSeq
First N numbers of the Fibonacci sequence [1, 1, 2, 3, 5, 8, ...] -as parallel channels.
-fibonacciSeq(N) : si.bus(N)
-
-Where:
-N
: The number of Fibonacci numbers to generate as channels.(ef.)speakerbp
Dirt-simple speaker simulator (overall bandpass eq with observed
-roll-offs above and below the passband). speakerbp
is a standard Faust function.
Low-frequency speaker model = +12 dB/octave slope breaking to -flat near f1. Implemented using two dc blockers in series.
-High-frequency model = -24 dB/octave slope implemented using a -fourth-order Butterworth lowpass.
-_ : speakerbp(f1,f2) : _
-
-Based on measured Celestion G12 (12" speaker):
-speakerbp(130,5000)
-
-(ef.)piano_dispersion_filter
Piano dispersion allpass filter in closed form.
-piano_dispersion_filter(M,B,f0)
-_ : piano_dispersion_filter(1,B,f0) : +(totalDelay),_ : fdelay(maxDelay) : _
-
-Where:
-M
: number of first-order allpass sections (compile-time only)
- Keep below 20. 8 is typical for medium-sized piano strings.B
: string inharmonicity coefficient (0.0001 is typical)f0
: fundamental frequency in Hzf0
of allpass chain in samples,
- provided in negative form to facilitate subtraction
- from delay-line length.(ef.)stereo_width
Stereo Width effect using the Blumlein Shuffler technique.
-stereo_width
is a standard Faust function.
_,_ : stereo_width(w) : _,_
-
-Where:
-w
: stereo width between 0 and 1At w=0
, the output signal is mono ((left+right)/2 in both channels).
-At w=1
, there is no effect (original stereo image).
-Thus, w between 0 and 1 varies stereo width from 0 to "original".
(ef.)mesh_square
Square Rectangular Digital Waveguide Mesh.
-bus(4*N) : mesh_square(N) : bus(4*N)
-
-Where:
-N
: number of nodes along each edge - a power of two (1,2,4,8,...)The mesh is constructed recursively using 2x2 embeddings. Thus,
-the top level of mesh_square(M)
is a block 2x2 mesh, where each
-block is a mesh(M/2)
. Let these blocks be numbered 1,2,3,4 in the
-geometry NW,NE,SW,SE, i.e., as:
1 2
- 3 4
-
-Each block has four vector inputs and four vector outputs, where the
-length of each vector is M/2
. Label the input vectors as Ni,Ei,Wi,Si,
-i.e., as the inputs from the North, East South, and West,
-and similarly for the outputs. Then, for example, the upper
-left input block of M/2 signals is labeled 1Ni. Most of the
-connections are internal, such as 1Eo -> 2Wi. The 8*(M/2)
input
-signals are grouped in the order:
1Ni 2Ni
- 3Si 4Si
- 1Wi 3Wi
- 2Ei 4Ei
-
-and the output signals are:
- 1No 1Wo
- 2No 2Eo
- 3So 3Wo
- 4So 4Eo
-
-or:
- In: 1No 1Wo 2No 2Eo 3So 3Wo 4So 4Eo
- Out: 1Ni 2Ni 3Si 4Si 1Wi 3Wi 2Ei 4Ei
-
-Thus, the inputs are grouped by direction N,S,W,E, while the
-outputs are grouped by block number 1,2,3,4, which can also be
-interpreted as directions NW, NE, SW, SE. A simple program
-illustrating these orderings is process = mesh_square(2);
.
Reflectively terminated mesh impulsed at one corner:
-mesh_square_test(N,x) = mesh_square(N)~(busi(4*N,x)) // input to corner
-with {
- busi(N,x) = bus(N) : par(i,N,*(-1)) : par(i,N-1,_), +(x);
-};
-process = 1-1' : mesh_square_test(4); // all modes excited forever
-
-In this simple example, the mesh edges are connected as follows:
- 1No -> 1Ni, 1Wo -> 2Ni, 2No -> 3Si, 2Eo -> 4Si,
- 3So -> 1Wi, 3Wo -> 3Wi, 4So -> 2Ei, 4Eo -> 4Ei
-
-A routing matrix can be used to obtain other connection geometries.
-(ef.)dryWetMixer
Linear dry-wet mixer for a N inputs and N outputs effect.
-si.bus(inputs(FX)) : dryWetMixer(wetAmount, FX) : si.bus(inputs(FX))
-
-Where:
-wetAmount
: the wet amount (0-1). 0 produces only the dry signal and 1 produces only the wet signalFX
: an arbitrary effect (N inputs and N outputs) to apply to the input bus(ef.)dryWetMixerConstantPower
Constant-power dry-wet mixer for a N inputs and N outputs effect.
-si.bus(inputs(FX)) : dryWetMixerConstantPower(wetAmount, FX) :si.bus(inputs(FX))
-
-Where:
-wetAmount
: the wet amount (0-1). 0 produces only the dry signal and 1 produces only the wet signalFX
: an arbitrary effect (N inputs and N outputs) to apply to the input bus(ef.)mixLinearClamp
Linear mixer for N
buses, each with C
channels. The output will be a sum of 2 buses
-determined by the mixing index mix
. 0 produces the first bus, 1 produces the
-second, and so on. mix
is clamped automatically. For example, mixLinearClamp(4, 1, 1)
-will weight its 4 inputs by (0, 1, 0, 0)
. Similarly, mixLinearClamp(4, 1, 1.1)
-will weight its 4 inputs by (0,.9,.1,0)
.
si.bus(N*C) : mixLinearClamp(N, C, mix) : si.bus(C)
-
-Where:
-N
: the number of input busesC
: the number of channels in each busmix
: the mixing index, continuous in [0;N-1].(ef.)mixLinearLoop
Linear mixer for N
buses, each with C
channels. Refer to mixLinearClamp
. mix
-will loop for multiples of N
. For example, mixLinearLoop(4, 1, 0)
has the same
-effect as mixLinearLoop(4, 1, -4)
and mixLinearLoop(4, 1, 4)
.
si.bus(N*C) : mixLinearLoop(N, C, mix) : si.bus(C)
-
-Where:
-N
: the number of input busesC
: the number of channels in each busmix
: the mixing index (N-1) selects the last bus, and 0 or N selects the 0th bus.(ef.)mixPowerClamp
Constant-power mixer for N
buses, each with C
channels. The output will be a sum of 2 buses
-determined by the mixing index mix
. 0 produces the first bus, 1 produces the
-second, and so on. mix
is clamped automatically. mixPowerClamp(4, 1, 1)
-will weight its 4 inputs by (0, 1./sqrt(2), 0, 0)
. Similarly, mixPowerClamp(4, 1, 1.5)
-will weight its 4 inputs by (0,.5,.5,0)
.
si.bus(N*C) : mixPowerClamp(N, C, mix) : si.bus(C)
-
-Where:
-N
: the number of input busesC
: the number of channels in each busmix
: the mixing index, continuous in [0;N-1].(ef.)mixPowerLoop
Constant-power mixer for N
buses, each with C
channels. Refer to mixPowerClamp
. mix
-will loop for multiples of N
. For example, mixPowerLoop(4, 1, 0)
has the same effect
-as mixPowerLoop(4, 1, -4)
and mixPowerLoop(4, 1, 4)
.
si.bus(N*C) : mixPowerLoop(N, C, mix) : si.bus(C)
-
-Where:
-N
: the number of input busesC
: the number of channels in each busmix
: the mixing index (N-1) selects the last bus, and 0 or N selects the 0th bus.(ef.)echo
A simple echo effect.
-echo
is a standard Faust function.
_ : echo(maxDuration,duration,feedback) : _
-
-Where:
-maxDuration
: the max echo duration in secondsduration
: the echo duration in secondsfeedback
: the feedback coefficient(ef.)reverseEchoN(nChans,delay)
Reverse echo effect.
-_ : ef.reverseEchoN(N,delay) : si.bus(N)
-
-Where:
-N
: Number of output channels desired (1 or more), a constant numerical expressiondelay
: echo delay (integer power of 2)_ : dm.reverseEchoN(N) : _,_
-
-The effect uses N instances of reverseDelayRamped
at different phases.
(ef.)reverseDelayRamped(delay,phase)
Reverse delay with amplitude ramp.
-_ : ef.reverseDelayRamped(delay,phase) : _
-
-Where:
-delay
: echo delay (integer power of 2)phase
: float between 0 and 1 giving ramp delay phase*delay_ : ef.reverseDelayRamped(32,0.6) : _,_
-
-(ef.)uniformPanToStereo(nChans)
Pan nChans channels to the stereo field, spread uniformly left to right.
-si.bus(N) : ef.uniformPanToStereo(N) : _,_
-
-Where:
-N
: Number of input channels to pan down to stereo, a constant numerical expression_,_,_ : ef.uniformPanToStereo(3) : _,_
-
-(ef.)tapeStop
A tape-stop effect, like putting a finger on a vinyl record player.
-_,_ : tapeStop(2, LAGRANGE_ORDER, MAX_TIME_SAMP, crossfade, gainAlpha, stopAlpha, stopTime, stop) : _,_
-_ : tapeStop(1, LAGRANGE_ORDER, MAX_TIME_SAMP, crossfade, gainAlpha, stopAlpha, stopTime, stop) : _
-
-Where:
-C
: The number of input and output channels.LAGRANGE_ORDER
: The order of the Lagrange interpolation on the delay line. [2-3] recommended.MAX_TIME_SAMP
: Maximum stop time in samplescrossfade
: A crossfade in samples to apply when resuming normal playback. Crossfade is not applied during the enabling of the tape-stop.gainAlpha
: During the tape-stop, lower alpha stays louder longer. Safe values are in the range [.01,2].stopAlpha
: stopAlpha==1
represents a linear deceleration (constant force). stopAlpha<1
represents an initially weaker, then stronger force. stopAlpha>1
represents an initially stronger, then weaker force. Safe values are in the range [.01,2].stopTime
: Desired duration of the stop time, in samples.stop
: When stop
becomes positive, the tape-stop effect will start. When stop
becomes zero, normal audio will resume via crossfade.(ef.)transpose
A simple pitch shifter based on 2 delay lines.
-transpose
is a standard Faust function.
_ : transpose(w, x, s) : _
-
-Where:
-w
: the window length (samples)x
: crossfade duration duration (samples)s
: shift (semitones)(ef.)softclipQuadratic
Quadratic softclip nonlinearity.
-_ : softclipQuadratic : _;
-
-(ef.)wavefold
Wavefolding nonlinearity.
-_ : wavefold(width) : _;
-
-Where:
-width
: The width of the folded section [0..1] (float).Welcome to the documentation for misceffects.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Faust Noise Generator Library. Its official prefix is no
.
(no.)noise
White noise generator (outputs random number between -1 and 1).
-noise
is a standard Faust function.
noise : _
-
-(no.)multirandom
Generates multiple decorrelated random numbers in parallel.
-multirandom(N) : si.bus(N)
-
-Where:
-N
: the number of decorrelated random numbers in parallel, a constant numerical expression(no.)multinoise
Generates multiple decorrelated noises in parallel.
-multinoise(N) : si.bus(N)
-
-Where:
-N
: the number of decorrelated random numbers in parallel, a constant numerical expression(no.)noises
A convenient wrapper around multinoise.
-noises(N,i) : _
-
-Where:
-N
: the number of decorrelated random numbers in parallel, a constant numerical expressioni
: the selected random number (i in [0..N[)(no.)randomseed
A random seed based on the foreign function arc4random
-(see man arc4random). Used in rnoise
, rmultirandom
, etc. to
-avoid having the same pseudo random sequence at each run.
WARNING: using the foreign function arc4random
, so only available in C/C++ and LLVM backends.
randomseed : _
-
-(no.)rnoise
A randomized white noise generator (outputs random number between -1 and 1).
-WARNING: using the foreign function arc4random
, so only available in C/C++ and LLVM backends.
rnoise : _
-
-(no.)rmultirandom
Generates multiple decorrelated random numbers in parallel.
-WARNING: using the foreign function arc4random
, so only available in C/C++ and LLVM backends.
rmultirandom(N) : _
-
-Where:
-N
: the number of decorrelated random numbers in parallel, a constant numerical expression(no.)rmultinoise
Generates multiple decorrelated noises in parallel.
-WARNING: using the foreign function arc4random
, so only available in C/C++ and LLVM backends.
rmultinoise(N) : _
-
-Where:
-N
: the number of decorrelated random numbers in parallel, a constant numerical expression(no.)rnoises
A convenient wrapper around rmultinoise.
-WARNING: using the foreign function arc4random
, so only available in C/C++ and LLVM backends.
rnoises(N,i) : _
-
-Where:
-N
: the number of decorrelated random numbers in paralleli
: the selected random number (i in [0..N[)(no.)pink_noise
Pink noise (1/f noise) generator (third-order approximation covering the audio band well).
-pink_noise
is a standard Faust function.
pink_noise : _
-
-Higher-order approximations covering any frequency band can be obtained using
-no.noise : fi.spectral_tilt(order,lowerBandLimit,Bandwidth,p)
-
-where p=-0.5
means filter rolloff f^(-1/2)
which gives 1/f rolloff in the
-power spectral density, and can be changed to other real values.
// pink_noise_compare.dsp - compare three pinking filters
-process = pink_noises with {
- f0 = 35; // Lower bandlimit in Hz
- bw3 = 0.7 * ma.SR/2.0 - f0; // Bandwidth in Hz, 3rd order case
- bw9 = 0.8 * ma.SR/2.0 - f0; // Bandwidth in Hz, 9th order case
- pink_tilt_3 = fi.spectral_tilt(3,f0,bw3,-0.5);
- pink_tilt_9 = fi.spectral_tilt(9,f0,bw9,-0.5);
- pink_noises = 1-1' <:
- no.pink_filter, // original designed by invfreqz in Octave
- pink_tilt_3, // newer method using the same filter order
- pink_tilt_9; // newer method using a higher filter order
-};
-
-faust2octave pink_noise_compare.dsp
-Octave:1> semilogx(20*log10(abs(fft(faustout,8192))(1:4096,:)));
-...
-
-
-(no.)pink_noise_vm
Multi pink noise generator.
-pink_noise_vm(N) : _
-
-Where:
-N
: number of latched white-noise processes to sum,
- not to exceed sizeof(int) in C++ (typically 32).(no.)lfnoise
, (no.)lfnoise0
and (no.)lfnoiseN
Low-frequency noise generators (Butterworth-filtered downsampled white noise).
-lfnoise0(rate) : _ // new random number every int(SR/rate) samples or so
-lfnoiseN(N,rate) : _ // same as "lfnoise0(rate) : lowpass(N,rate)" [see filters.lib]
-lfnoise(rate) : _ // same as "lfnoise0(rate) : seq(i,5,lowpass(N,rate))" (no overshoot)
-
-(view waveforms in faust2octave):
-rate = SR/100.0; // new random value every 100 samples (SR from music.lib)
-process = lfnoise0(rate), // sampled/held noise (piecewise constant)
- lfnoiseN(3,rate), // lfnoise0 smoothed by 3rd order Butterworth LPF
- lfnoise(rate); // lfnoise0 smoothed with no overshoot
-
-(no.)sparse_noise
Sparse noise generator.
-sparse_noise(f0) : _
-
-Where:
-f0
: average frequency of noise impulses per secondRandom impulses in the amplitude range -1 to 1 are generated -at an average rate of f0 impulses per second.
-(no.)velvet_noise_vm
Velvet noise generator.
-velvet_noise(amp, f0) : _
-
-Where:
-amp
: amplitude of noise impulses (positive and negative)f0
: average frequency of noise impulses per second(no.)gnoise
Approximate zero-mean, unit-variance Gaussian white noise generator.
-gnoise(N) : _
-
-Where:
-N
: number of uniform random numbers added to approximate Gaussian white noise(no.)colored_noise
Generates a colored noise signal with an arbitrary spectral -roll-off factor (alpha) over the entire audible frequency range -(20-20000 Hz). The output is normalized so that an equal RMS -level is maintained for different values of alpha.
-colored_noise(N,alpha) : _
-
-Where:
-N
: desired integer filter order (constant numerical expression)alpha
: slope of roll-off, between -1 and 1. -1 corresponds to
-brown/red noise, -1/2 pink noise, 0 white noise, 1/2 blue noise,
-and 1 violet/azure noise.See dm.colored_noise_demo
.
Welcome to the documentation for noises.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a collection of sound generators. Its official prefix is os
.
The oscillators library is organized into 9 sections:
-Note that there is a numerical problem with several phasor functions built using the internal
-phasor_imp
. The reason is that the incremental step is smaller than ma.EPSILON
, which happens with very small frequencies,
-so it will have no effect when summed to 1, but it will be enough to make the fractional function wrap
-around when summed to 0. An example of this problem can be observed when running the following code:
process = os.phasor(1.0, -.001);
The output of this program is the sequence 1, 0, 1, 0, 1... This happens because the negative incremental
-step is greater than -ma.EPSILON
, which will have no effect when summed to 1, but it will be significant
-enough to make the fractional function wrap around when summed to 0.
The incremental step can be clipped to guarantee that the phasor will
-always run correctly for its full cycle, otherwise, for increments smaller than ma.EPSILON
,
-phasor would initially run but it'd eventually get stuck once the output gets big enough.
All functions using phasor_imp
are affected by this problem, but a safer
-version is implemented, and can be used alternatively by setting SAFE=1
in the environment using
-explicit sustitution syntax.
For example: process = os[SAFE=1;].phasor(1.0, -.001);
will use the safer implementation of phasor_imp
.
Oscillators using tables. The table size is set by the -pl.tablesize constant.
-(os.)sinwaveform
Sine waveform ready to use with a rdtable
.
sinwaveform(tablesize) : _
-
-Where:
-tablesize
: the table size(os.)coswaveform
Cosine waveform ready to use with a rdtable
.
coswaveform(tablesize) : _
-
-Where:
-tablesize
: the table size(os.)phasor
A simple phasor to be used with a rdtable
.
-phasor
is a standard Faust function.
phasor(tablesize,freq) : _
-
-Where:
-tablesize
: the table sizefreq
: the frequency in HzNote that tablesize
is just a multiplier for the output of a unit-amp phasor
-so phasor(1.0, freq)
can be used to generate a phasor output in the range [0, 1[.
(os.)hs_phasor
Hardsyncing phasor to be used with a rdtable
.
hs_phasor(tablesize,freq,reset) : _
-
-Where:
-tablesize
: the table sizefreq
: the frequency in Hzreset
: a reset signal, reset phase to 0 when equal to 1(os.)hsp_phasor
Hardsyncing phasor with selectable phase to be used with a rdtable
.
hsp_phasor(tablesize,freq,reset,phase)
-
-Where:
-tablesize
: the table sizefreq
: the frequency in Hzreset
: reset the oscillator to phase when equal to 1phase
: phase between 0 and 1(os.)oscsin
Sine wave oscillator.
-oscsin
is a standard Faust function.
oscsin(freq) : _
-
-Where:
-freq
: the frequency in Hz(os.)hs_oscsin
Sin lookup table with hardsyncing phase.
-hs_oscsin(freq,reset) : _
-
-Where:
-freq
: the frequency in Hzreset
: reset the oscillator to 0 when equal to 1(os.)osccos
Cosine wave oscillator.
-osccos(freq) : _
-
-Where:
-freq
: the frequency in Hz(os.)hs_osccos
Cos lookup table with hardsyncing phase.
-hs_osccos(freq,reset) : _
-
-Where:
-freq
: the frequency in Hzreset
: reset the oscillator to 0 when equal to 1(os.)oscp
A sine wave generator with controllable phase.
-oscp(freq,phase) : _
-
-Where:
-freq
: the frequency in Hzphase
: the phase in radian(os.)osci
Interpolated phase sine wave oscillator.
-osci(freq) : _
-
-Where:
-freq
: the frequency in Hz(os.)osc
Default sine wave oscillator (same as oscsin).
-osc
is a standard Faust function.
osc(freq) : _
-
-Where:
-freq
: the frequency in Hz(os.)m_oscsin
Sine wave oscillator based on the sin
mathematical function.
m_oscsin(freq) : _
-
-Where:
-freq
: the frequency in Hz(os.)m_osccos
Sine wave oscillator based on the cos
mathematical function.
m_osccos(freq) : _
-
-Where:
-freq
: the frequency in HzLow Frequency Oscillators (LFOs) have prefix lf_
-(no aliasing suppression, since it is inaudible at LF).
-Use sawN
and its derivatives for audio oscillators with suppressed aliasing.
(os.)lf_imptrain
Unit-amplitude low-frequency impulse train.
-lf_imptrain
is a standard Faust function.
lf_imptrain(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)lf_pulsetrainpos
Unit-amplitude nonnegative LF pulse train, duty cycle between 0 and 1.
-lf_pulsetrainpos(freq, duty) : _
-
-Where:
-freq
: frequency in Hzduty
: duty cycle between 0 and 1(os.)lf_pulsetrain
Unit-amplitude zero-mean LF pulse train, duty cycle between 0 and 1.
-lf_pulsetrain(freq,duty) : _
-
-Where:
-freq
: frequency in Hzduty
: duty cycle between 0 and 1(os.)lf_squarewavepos
Positive LF square wave in [0,1]
-lf_squarewavepos(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)lf_squarewave
Zero-mean unit-amplitude LF square wave.
-lf_squarewave
is a standard Faust function.
lf_squarewave(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)lf_trianglepos
Positive unit-amplitude LF positive triangle wave.
-lf_trianglepos(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)lf_triangle
Zero-mean unit-amplitude LF triangle wave.
-lf_triangle
is a standard Faust function.
lf_triangle(freq) : _
-
-Where:
-freq
: frequency in HzSawtooth waveform oscillators for virtual analog synthesis et al.
-The 'simple' versions (lf_rawsaw
, lf_sawpos
and saw1
), are mere samplings of
-the ideal continuous-time ("analog") waveforms. While simple, the
-aliasing due to sampling is quite audible. The differentiated
-polynomial waveform family (saw2
, sawN
, and derived functions)
-do some extra processing to suppress aliasing (not audible for
-very low fundamental frequencies). According to Lehtonen et al.
-(JASA 2012), the aliasing of saw2
should be inaudible at fundamental
-frequencies below 2 kHz or so, for a 44.1 kHz sampling rate and 60 dB SPL
-presentation level; fundamentals 415 and below required no aliasing
-suppression (i.e., saw1
is ok).
(os.)lf_rawsaw
Simple sawtooth waveform oscillator between 0 and period in samples.
-lf_rawsaw(periodsamps) : _
-
-Where:
-periodsamps
: number of periods per samples(os.)lf_sawpos
Simple sawtooth waveform oscillator between 0 and 1.
-lf_sawpos(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)lf_sawpos_phase
Simple sawtooth waveform oscillator between 0 and 1 -with phase control.
-lf_sawpos_phase(freq, phase) : _
-
-Where:
-freq
: frequency in Hzphase
: phase between 0 and 1(os.)lf_sawpos_reset
Simple sawtooth waveform oscillator between 0 and 1 -with reset.
-lf_sawpos_reset(freq,reset) : _
-
-Where:
-freq
: frequency in Hzreset
: reset the oscillator to 0 when equal to 1(os.)lf_sawpos_phase_reset
Simple sawtooth waveform oscillator between 0 and 1 -with phase control and reset.
-lf_sawpos_phase_reset(freq,phase,reset) : _
-
-Where:
-freq
: frequency in Hzphase
: phase between 0 and 1reset
: reset the oscillator to phase when equal to 1(os.)lf_saw
Simple sawtooth waveform oscillator between -1 and 1.
-lf_saw
is a standard Faust function.
lf_saw(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)sawN
Alias-Suppressed Sawtooth Audio-Frequency Oscillator using Nth-order polynomial transitions -to reduce aliasing.
-sawN(N,freq)
, sawNp(N,freq,phase)
, saw2dpw(freq)
, saw2(freq)
, saw3(freq)
,
-saw4(freq)
, sawtooth(freq)
, saw2f2(freq)
, saw2f4(freq)
sawN(N,freq) : _ // Nth-order aliasing-suppressed sawtooth using DPW method (see below)
-sawNp(N,freq,phase) : _ // sawN with phase offset feature
-saw2dpw(freq) : _ // saw2 using DPW
-saw2ptr(freq) : _ // saw2 using the faster, stateless PTR method
-saw2(freq) : _ // DPW method, but subject to change if a better method emerges
-saw3(freq) : _ // sawN(3)
-saw4(freq) : _ // sawN(4)
-sawtooth(freq) : _ // saw2
-saw2f2(freq) : _ // saw2dpw with 2nd-order droop-correction filtering
-saw2f4(freq) : _ // saw2dpw with 4th-order droop-correction filtering
-
-Where:
-N
: polynomial order, a constant numerical expression between 1 and 4freq
: frequency in Hzphase
: phase between 0 and 1Differentiated Polynomial Wave (DPW).
-"Alias-Suppressed Oscillators based on Differentiated Polynomial Waveforms", -Vesa Valimaki, Juhan Nam, Julius Smith, and Jonathan Abel, -IEEE Tr. Audio, Speech, and Language Processing (IEEE-ASLP), -Vol. 18, no. 5, pp 786-798, May 2010. -10.1109/TASL.2009.2026507.
-The polynomial order N
is limited to 4 because noise has been
-observed at very low freq
values. (LFO sawtooths should of course
-be generated using lf_sawpos
instead.)
(os.)sawNp
Same as (os.)sawN
but with a controllable waveform phase.
sawNp(N,freq,phase) : _
-
-where
-N
: waveform interpolation polynomial order 1 to 4 (constant integer expression)freq
: frequency in Hzphase
: waveform phase as a fraction of one period (rounded to nearest sample)The phase offset is implemented by delaying sawN(N,freq)
by
-round(phase*ma.SR/freq)
samples, for up to 8191 samples.
-The minimum sawtooth frequency that can be delayed a whole period
-is therefore ma.SR/8191
, which is well below audibility for normal
-audio sampling rates.
(os.)saw2, (os.)saw3, (os.)saw4
Alias-Suppressed Sawtooth Audio-Frequency Oscillators of order 2, 3, 4.
-saw2(freq) : _
-saw3(freq) : _
-saw4(freq) : _
-
-where
-freq
: frequency in HzSee sawN
above.
Presently, only saw2
uses the PTR method, while saw3
and saw4
use DPW.
-This is because PTR has been implemented and tested for the 2nd-order case only.
(os.)saw2ptr
Alias-Suppressed Sawtooth Audio-Frequency Oscillator -using Polynomial Transition Regions (PTR) for order 2.
-saw2ptr(freq) : _
-
-where
-freq
: frequency in HzPolynomial Transition Regions (PTR) method for aliasing suppression.
-Method PTR may be preferred because it requires less
-computation and is stateless which means that the frequency freq
-can be modulated arbitrarily fast over time without filtering
-artifacts. For this reason, saw2
is presently defined as saw2ptr
.
(os.)saw2dpw
Alias-Suppressed Sawtooth Audio-Frequency Oscillator -using the Differentiated Polynomial Waveform (DWP) method.
-saw2dpw(freq) : _
-
-where
-freq
: frequency in HzThis is the original Faust saw2
function using the DPW method.
-Since saw2
is now defined as saw2ptr
, the DPW version
-is now available as saw2dwp
.
(os.)sawtooth
Alias-suppressed aliasing-suppressed sawtooth oscillator, presently defined as saw2
.
-sawtooth
is a standard Faust function.
sawtooth(freq) : _
-
-with
-freq
: frequency in Hz(os.)saw2f2, (os.)saw2f4
Alias-Suppressed Sawtooth Audio-Frequency Oscillator with Order 2 or 4 Droop Correction Filtering.
-saw2f2(freq) : _
-saw2f4(freq) : _
-
-with
-freq
: frequency in HzIn return for aliasing suppression, there is some attenuation near half the sampling rate.
-This can be considered as beneficial, or it can be compensated with a high-frequency boost.
-The boost filter is second-order for saw2f2
and fourth-order for saw2f4
, and both are designed
-for the DWP case and therefore use saw2dpw
.
-See Figure 4(b) in the DPW reference for a plot of the slight droop in the DPW case.
Alias-Suppressed Pulse, Square and Impulse Trains.
-pulsetrainN
, pulsetrain
, squareN
, square
, imptrainN
, imptrain
,
-triangleN
, triangle
All are zero-mean and meant to oscillate in the audio frequency range.
-Use simpler sample-rounded lf_*
versions above for LFOs.
pulsetrainN(N,freq,duty) : _
-pulsetrain(freq, duty) : _ // = pulsetrainN(2)
-
-squareN(N,freq) : _
-square : _ // = squareN(2)
-
-imptrainN(N,freq) : _
-imptrain : _ // = imptrainN(2)
-
-triangleN(N,freq) : _
-triangle : _ // = triangleN(2)
-
-Where:
-N
: polynomial order, a constant numerical expressionfreq
: frequency in Hz(os.)impulse
One-time impulse generated when the Faust process is started.
-impulse
is a standard Faust function.
impulse : _
-
-(os.)pulsetrainN
Alias-suppressed pulse train oscillator.
-pulsetrainN(N,freq,duty) : _
-
-Where:
-N
: order, as a constant numerical expressionfreq
: frequency in Hzduty
: duty cycle between 0 and 1(os.)pulsetrain
Alias-suppressed pulse train oscillator. Based on pulsetrainN(2)
.
-pulsetrain
is a standard Faust function.
pulsetrain(freq,duty) : _
-
-Where:
-freq
: frequency in Hzduty
: duty cycle between 0 and 1(os.)squareN
Alias-suppressed square wave oscillator.
-squareN(N,freq) : _
-
-Where:
-N
: order, as a constant numerical expressionfreq
: frequency in Hz(os.)square
Alias-suppressed square wave oscillator. Based on squareN(2)
.
-square
is a standard Faust function.
square(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)imptrainN
Alias-suppressed impulse train generator.
-imptrainN(N,freq) : _
-
-Where:
-N
: order, as a constant numerical expressionfreq
: frequency in Hz(os.)imptrain
Alias-suppressed impulse train generator. Based on imptrainN(2)
.
-imptrain
is a standard Faust function.
imptrain(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)triangleN
Alias-suppressed triangle wave oscillator.
-triangleN(N,freq) : _
-
-Where:
-N
: order, as a constant numerical expressionfreq
: frequency in Hz(os.)triangle
Alias-suppressed triangle wave oscillator. Based on triangleN(2)
.
-triangle
is a standard Faust function.
triangle(freq) : _
-
-Where:
-freq
: frequency in HzFilter-Based Oscillators.
-osc[b|rq|rs|rc|s](freq), where freq = frequency in Hz.
-
-(os.)oscb
Sinusoidal oscillator based on the biquad.
-oscb(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)oscrq
Sinusoidal (sine and cosine) oscillator based on 2D vector rotation, - = undamped "coupled-form" resonator - = lossless 2nd-order normalized ladder filter.
-oscrq(freq) : _,_
-
-Where:
-freq
: frequency in Hz(os.)oscrs
Sinusoidal (sine) oscillator based on 2D vector rotation, - = undamped "coupled-form" resonator - = lossless 2nd-order normalized ladder filter.
-oscrs(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)oscrc
Sinusoidal (cosine) oscillator based on 2D vector rotation, - = undamped "coupled-form" resonator - = lossless 2nd-order normalized ladder filter.
-oscrc(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)oscs
Sinusoidal oscillator based on the state variable filter -= undamped "modified-coupled-form" resonator -= "magic circle" algorithm used in graphics.
-oscs(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)quadosc
Quadrature (cosine and sine) oscillator based on QuadOsc by Martin Vicanek.
-quadosc(freq) : _,_
-
-where
-freq
: frequency in Hz(os.)sidebands
Adds harmonics to quad oscillator.
- cos(x),sin(x) : sidebands(vs) : _,_
-
-Where:
-vs
: list of amplitudes cos(x),sin(x) : sidebands((10,20,30))
-
-outputs:
- 10*cos(x) + 20*cos(2*x) + 30*cos(3*x),
- 10*sin(x) + 20*sin(2*x) + 30*sin(3*x);
-
-The following:
- process = os.quadosc(F) : sidebands((10,20,30))
-
-is (modulo floating point issues) the same as:
- c = os.quadosc : _,!;
- s = os.quadosc : !,_;
- process =
- 10*c(F) + 20*c(2*F) + 30*c(F),
- 10*s(F) + 20*s(2*F) + 30*s(F);
-
-but much more efficient.
-This is based on the trivial trigonometric identities:
- cos((n + 1) x) = 2 cos(x) cos(n x) - cos((n - 1) x)
- sin((n + 1) x) = 2 cos(x) sin(n x) - sin((n - 1) x)
-
-Note that the calculation of the cosine/sine parts do not depend -on each other, so if you only need the sine part you can do:
- process = os.quadosc(F) : sidebands(vs) : !,_;
-
-and the compiler will discard the half of the calculations.
-(os.)sidebands_list
Creates the list of complex harmonics from quad oscillator.
-Similar to sidebands
but doesn't sum the harmonics, so it is more
-generic but less convenient for immediate usage.
cos(x),sin(x) : sidebands_list(N) : si.bus(2*N)
-
-Where:
-N
: number of harmonics, compile time constant > 1 cos(x),sin(x) : sidebands_list(3)
-
-outputs:
- cos(x),sin(x), cos(2*x),sin(2*x), cos(3*x),sin(3*x);
-
-The following:
- process = os.quadosc(F) : sidebands_list(3)
-
-is (modulo floating point issues) the same as:
- process = os.quadosc(F), os.quadosc(2*F), os.quadosc(3*F);
-
-but much more efficient.
-Sinusoidal oscillator based on the waveguide resonator wgr
.
(os.)oscwc
Sinusoidal oscillator based on the waveguide resonator wgr
. Unit-amplitude
-cosine oscillator.
oscwc(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)oscws
Sinusoidal oscillator based on the waveguide resonator wgr
. Unit-amplitude
-sine oscillator.
oscws(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)oscq
Sinusoidal oscillator based on the waveguide resonator wgr
.
-Unit-amplitude cosine and sine (quadrature) oscillator.
oscq(freq) : _,_
-
-Where:
-freq
: frequency in Hz(os.)oscw
Sinusoidal oscillator based on the waveguide resonator wgr
.
-Unit-amplitude cosine oscillator (default).
oscw(freq) : _
-
-Where:
-freq
: frequency in HzOscillators that mimic some of the Casio CZ oscillators.
-There are two sets:
-a set with an index parameter
-a set with a res parameter
-The "index oscillators" outputs a sine wave at index=0 and gets brighter with a higher index. -There are two versions of the "index oscillators":
-with P appended to the name: is phase aligned with fund:sin
without P appended to the name: has the phase of the original CZ oscillators
-The "res oscillators" have a resonant frequency. -"res" is the frequency of resonance as a factor of the fundamental pitch.
-For the fund
waveform, use a low-frequency oscillator without anti-aliasing such as os.lf_saw
.
(os.)CZsaw
Oscillator that mimics the Casio CZ saw oscillator.
-CZsaw
is a standard Faust function.
CZsaw(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 to 1. 0 = sine-wave, 1 = saw-wave(os.)CZsawP
Oscillator that mimics the Casio CZ saw oscillator,
-with it's phase aligned to fund:sin
.
-CZsawP
is a standard Faust function.
CZsawP(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 to 1. 0 = sine-wave, 1 = saw-wave(os.)CZsquare
Oscillator that mimics the Casio CZ square oscillator
-CZsquare
is a standard Faust function.
CZsquare(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 to 1. 0 = sine-wave, 1 = square-wave(os.)CZsquareP
Oscillator that mimics the Casio CZ square oscillator,
-with it's phase aligned to fund:sin
.
-CZsquareP
is a standard Faust function.
CZsquareP(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 to 1. 0 = sine-wave, 1 = square-wave(os.)CZpulse
Oscillator that mimics the Casio CZ pulse oscillator.
-CZpulse
is a standard Faust function.
CZpulse(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is closer to a pulse(os.)CZpulseP
Oscillator that mimics the Casio CZ pulse oscillator,
-with it's phase aligned to fund:sin
.
-CZpulseP
is a standard Faust function.
CZpulseP(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is closer to a pulse(os.)CZsinePulse
Oscillator that mimics the Casio CZ sine/pulse oscillator.
-CZsinePulse
is a standard Faust function.
CZsinePulse(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is a sine minus a pulse(os.)CZsinePulseP
Oscillator that mimics the Casio CZ sine/pulse oscillator,
-with it's phase aligned to fund:sin
.
-CZsinePulseP
is a standard Faust function.
CZsinePulseP(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is a sine minus a pulse(os.)CZhalfSine
Oscillator that mimics the Casio CZ half sine oscillator.
-CZhalfSine
is a standard Faust function.
CZhalfSine(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is somewhere between a saw and a square(os.)CZhalfSineP
Oscillator that mimics the Casio CZ half sine oscillator,
-with it's phase aligned to fund:sin
.
-CZhalfSineP
is a standard Faust function.
CZhalfSineP(fund,index) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves toindex
: the brightness of the oscillator, 0 gives a sine-wave, 1 is somewhere between a saw and a square(os.)CZresSaw
Oscillator that mimics the Casio CZ resonant sawtooth oscillator.
-CZresSaw
is a standard Faust function.
CZresSaw(fund,res) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves tores
: the frequency of resonance as a factor of the fundamental pitch.(os.)CZresTriangle
Oscillator that mimics the Casio CZ resonant triangle oscillator.
-CZresTriangle
is a standard Faust function.
CZresTriangle(fund,res) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves tores
: the frequency of resonance as a factor of the fundamental pitch.(os.)CZresTrap
Oscillator that mimics the Casio CZ resonant trapeze oscillator
-CZresTrap
is a standard Faust function.
CZresTrap(fund,res) : _
-
-Where:
-fund
: a saw-tooth waveform between 0 and 1 that the oscillator slaves tores
: the frequency of resonance as a factor of the fundamental pitch.(os.)polyblep
PolyBLEP residual function, used for smoothing steps in the audio signal.
-polyblep(Q,phase) : _
-
-Where:
-Q
: smoothing factor between 0 and 0.5. Determines how far from the ends of the phase interval the quadratic function is used.phase
: normalised phase (between 0 and 1)(os.)polyblep_saw
Sawtooth oscillator with suppressed aliasing (using polyblep
).
polyblep_saw(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)polyblep_square
Square wave oscillator with suppressed aliasing (using polyblep
).
polyblep_square(freq) : _
-
-Where:
-freq
: frequency in Hz(os.)polyblep_triangle
Triangle wave oscillator with suppressed aliasing (using polyblep
).
polyblep_triangle(freq) : _
-
-Where:
-freq
: frequency in HzWelcome to the documentation for oscillators.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Welcome to the documentation page for faust. Below you will find a list of libraries contributed by this user, along with links to their respective documentation.
-If you have any questions or need further assistance, feel free to reach out to us.
A library of phasor and flanger effects. Its official prefix is pf
.
(pf.)flanger_mono
Mono flanging effect.
-_ : flanger_mono(dmax,curdel,depth,fb,invert) : _
-
-Where:
-dmax
: maximum delay-line length (power of 2) - 10 ms typicalcurdel
: current dynamic delay (not to exceed dmax)depth
: effect strength between 0 and 1 (1 typical)fb
: feedback gain between 0 and 1 (0 typical)invert
: 0 for normal, 1 to invert sign of flanging sum(pf.)flanger_stereo
Stereo flanging effect.
-flanger_stereo
is a standard Faust function.
_,_ : flanger_stereo(dmax,curdel1,curdel2,depth,fb,invert) : _,_
-
-Where:
-dmax
: maximum delay-line length (power of 2) - 10 ms typicalcurdel1
: current dynamic delay for the left channel (not to exceed dmax)curdel2
: current dynamic delay for the right channel (not to exceed dmax)depth
: effect strength between 0 and 1 (1 typical)fb
: feedback gain between 0 and 1 (0 typical)invert
: 0 for normal, 1 to invert sign of flanging sum(pf.)phaser2_mono
Mono phasing effect.
-_ : phaser2_mono(Notches,phase,width,frqmin,fratio,frqmax,speed,depth,fb,invert) : _
-
-Where:
-Notches
: number of spectral notches (MACRO ARGUMENT - not a signal)phase
: phase of the oscillator (0-1)width
: approximate width of spectral notches in Hzfrqmin
: approximate minimum frequency of first spectral notch in Hzfratio
: ratio of adjacent notch frequenciesfrqmax
: approximate maximum frequency of first spectral notch in Hzspeed
: LFO frequency in Hz (rate of periodic notch sweep cycles)depth
: effect strength between 0 and 1 (1 typical) (aka "intensity")
- when depth=2, "vibrato mode" is obtained (pure allpass chain)fb
: feedback gain between -1 and 1 (0 typical)invert
: 0 for normal, 1 to invert sign of flanging sumReference:
-(pf.)phaser2_stereo
Stereo phasing effect.
-phaser2_stereo
is a standard Faust function.
_,_ : phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,depth,fb,invert) : _,_
-
-Where:
-Notches
: number of spectral notches (MACRO ARGUMENT - not a signal)width
: approximate width of spectral notches in Hzfrqmin
: approximate minimum frequency of first spectral notch in Hzfratio
: ratio of adjacent notch frequenciesfrqmax
: approximate maximum frequency of first spectral notch in Hzspeed
: LFO frequency in Hz (rate of periodic notch sweep cycles)depth
: effect strength between 0 and 1 (1 typical) (aka "intensity")
- when depth=2, "vibrato mode" is obtained (pure allpass chain)fb
: feedback gain between -1 and 1 (0 typical)invert
: 0 for normal, 1 to invert sign of flanging sumReference:
-Welcome to the documentation for phaflangers.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Faust physical modeling library. Its official prefix is pm
.
This library provides an environment to facilitate physical modeling of musical -instruments. It contains dozens of functions implementing low and high level -elements going from a simple waveguide to fully operational models with -built-in UI, etc.
-It is organized as follows:
-This library is part of the Faust Physical Modeling ToolKit. -More information on how to use this library can be found on this page or this video. Tutorials on how to make -physical models of musical instruments using Faust can be found -here as well.
-Useful pre-defined variables for physical modeling.
-(pm.)speedOfSound
Speed of sound in meters per second (340m/s).
-(pm.)maxLength
The default maximum length (3) in meters of strings and tubes used in this -library. This variable should be overriden to allow longer strings or tubes.
-Useful conversion tools for physical modeling.
-(pm.)f2l
Frequency to length in meters.
-f2l(freq) : distanceInMeters
-
-Where:
-freq
: the frequency(pm.)l2f
Length in meters to frequency.
-l2f(length) : freq
-
-Where:
-length
: length/distance in meters(pm.)l2s
Length in meters to number of samples.
-l2s(l) : numberOfSamples
-
-Where:
-l
: length in metersSet of fundamental functions to create bi-directional block diagrams in Faust. -These elements are used as the basis of this library to connect high level -elements (e.g., mouthpieces, strings, bridge, instrument body, etc.). Each -block has 3 inputs and 3 outputs. The first input/output carry left going -waves, the second input/output carry right going waves, and the third -input/output is used to carry any potential output signal to the end of the -algorithm.
-(pm.)basicBlock
Empty bidirectional block to be used with chain
: 3 signals ins
-and 3 signals out.
chain(basicBlock : basicBlock : etc.)
-
-(pm.)chain
Creates a chain of bidirectional blocks.
-Blocks must have 3 inputs and outputs. The first input/output carry left
-going waves, the second input/output carry right going waves, and the third
-input/output is used to carry any potential output signal to the end of the
-algorithm. The implied one sample delay created by the ~
operator is
-generalized to the left and right going waves. Thus, n
blocks in chain()
-will add an n
samples delay to both left and right going waves.
leftGoingWaves,rightGoingWaves,mixedOutput : chain( A : B ) : leftGoingWaves,rightGoingWaves,mixedOutput
-with{
- A = _,_,_;
-};
-
-(pm.)inLeftWave
Adds a signal to left going waves anywhere in a chain
of blocks.
model(x) = chain(A : inLeftWave(x) : B)
-
-Where A
and B
are bidirectional blocks and x
is the signal added to left
-going waves in that chain.
(pm.)inRightWave
Adds a signal to right going waves anywhere in a chain
of blocks.
model(x) = chain(A : inRightWave(x) : B)
-
-Where A
and B
are bidirectional blocks and x
is the signal added to right
-going waves in that chain.
(pm.)in
Adds a signal to left and right going waves anywhere in a chain
-of blocks.
model(x) = chain(A : in(x) : B)
-
-Where A
and B
are bidirectional blocks and x
is the signal added to
-left and right going waves in that chain.
(pm.)outLeftWave
Sends the signal of left going waves to the output channel of the chain
.
chain(A : outLeftWave : B)
-
-Where A
and B
are bidirectional blocks.
(pm.)outRightWave
Sends the signal of right going waves to the output channel of the chain
.
chain(A : outRightWave : B)
-
-Where A
and B
are bidirectional blocks.
(pm.)out
Sends the signal of right and left going waves to the output channel of the
-chain
.
chain(A : out : B)
-
-Where A
and B
are bidirectional blocks.
(pm.)terminations
Creates terminations on both sides of a chain
without closing
-the inputs and outputs of the bidirectional signals chain. As for
-chain
, this function adds a 1 sample delay to the bidirectional
-signal, both ways. Of course, this function can be nested within a
-chain
.
terminations(a,b,c)
-with{
-};
-
-(pm.)lTermination
Creates a termination on the left side of a chain
without
-closing the inputs and outputs of the bidirectional signals chain. This
-function adds a 1 sample delay near the termination and can be nested
-within another chain
.
lTerminations(a,b)
-with{
-};
-
-(pm.)rTermination
Creates a termination on the right side of a chain
without
-closing the inputs and outputs of the bidirectional signals chain. This
-function adds a 1 sample delay near the termination and can be nested
-within another chain
.
rTerminations(b,c)
-with{
-};
-
-(pm.)closeIns
Closes the inputs of a bidirectional chain in all directions.
-closeIns : chain(...) : _,_,_
-
-(pm.)closeOuts
Closes the outputs of a bidirectional chain in all directions except for the -main signal output (3d output).
-_,_,_ : chain(...) : _
-
-(pm.)endChain
Closes the inputs and outputs of a bidirectional chain in all directions -except for the main signal output (3d output).
-endChain(chain(...)) : _
-
-Basic elements for physical modeling (e.g., waveguides, specific filters, -etc.).
-(pm.)waveguideN
A series of waveguide functions based on various types of delays (see
-fdelay[n]
).
waveguideUd
: unit delay waveguidewaveguideFd
: fractional delay waveguidewaveguideFd2
: second order fractional delay waveguidewaveguideFd4
: fourth order fractional delay waveguidechain(A : waveguideUd(nMax,n) : B)
-
-Where:
-nMax
: the maximum length of the delays in the waveguiden
: the length of the delay lines in samples.(pm.)waveguide
Standard pm.lib
waveguide (based on waveguideFd4
).
chain(A : waveguide(nMax,n) : B)
-
-Where:
-nMax
: the maximum length of the delays in the waveguiden
: the length of the delay lines in samples.(pm.)bridgeFilter
Generic two zeros bridge FIR filter (as implemented in the -STK) that can be used to -implement the reflectance violin, guitar, etc. bridges.
-_ : bridge(brightness,absorption) : _
-
-Where:
-brightness
: controls the damping of high frequencies (0-1)absorption
: controls the absorption of the brige and thus the t60 of
-the string plugged to it (0-1) (1 = 20 seconds)(pm.)modeFilter
Resonant bandpass filter that can be used to implement a single resonance -(mode).
-_ : modeFilter(freq,t60,gain) : _
-
-Where:
-freq
: mode frequencyt60
: mode resonance duration (in seconds)gain
: mode gain (0-1)Low and high level string instruments parts. Most of the elements in -this section can be used in a bidirectional chain.
-(pm.)stringSegment
A string segment without terminations (just a simple waveguide).
-chain(A : stringSegment(maxLength,length) : B)
-
-Where:
-maxLength
: the maximum length of the string in meters (should be static)length
: the length of the string in meters(pm.)openString
A bidirectional block implementing a basic "generic" string with a -selectable excitation position. Lowpass filters are built-in and -allow to simulate the effect of dispersion on the sound and thus -to change the "stiffness" of the string.
-chain(... : openString(length,stiffness,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in metersstiffness
: the stiffness of the string (0-1) (1 for max stiffness)pluckPosition
: excitation position (0-1) (1 is bottom)excitation
: the excitation signal(pm.)nylonString
A bidirectional block implementing a basic nylon string with selectable
-excitation position. This element is based on openString
-and has a fix stiffness corresponding to that of a nylon string.
chain(... : nylonString(length,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in meterspluckPosition
: excitation position (0-1) (1 is bottom)excitation
: the excitation signal(pm.)steelString
A bidirectional block implementing a basic steel string with selectable
-excitation position. This element is based on openString
-and has a fix stiffness corresponding to that of a steel string.
chain(... : steelString(length,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in meterspluckPosition
: excitation position (0-1) (1 is bottom)excitation
: the excitation signal(pm.)openStringPick
A bidirectional block implementing a "generic" string with selectable -excitation position. It also has a built-in pickup whose position is the -same as the excitation position. Thus, moving the excitation position -will also move the pickup.
-chain(... : openStringPick(length,stiffness,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in metersstiffness
: the stiffness of the string (0-1) (1 for max stiffness)pluckPosition
: excitation position (0-1) (1 is bottom)excitation
: the excitation signal(pm.)openStringPickUp
A bidirectional block implementing a "generic" string with selectable -excitation position and stiffness. It also has a built-in pickup whose -position can be independenly selected. The only constraint is that the -pickup has to be placed after the excitation position.
-chain(... : openStringPickUp(length,stiffness,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in metersstiffness
: the stiffness of the string (0-1) (1 for max stiffness)pluckPosition
: pluck position between the top of the string and the
-pickup (0-1) (1 for same as pickup position)pickupPosition
: position of the pickup on the string (0-1) (1 is bottom)excitation
: the excitation signal(pm.)openStringPickDown
A bidirectional block implementing a "generic" string with selectable -excitation position and stiffness. It also has a built-in pickup whose -position can be independenly selected. The only constraint is that the -pickup has to be placed before the excitation position.
-chain(... : openStringPickDown(length,stiffness,pluckPosition,excitation) : ...)
-
-Where:
-length
: the length of the string in metersstiffness
: the stiffness of the string (0-1) (1 for max stiffness)pluckPosition
: pluck position on the string (0-1) (1 is bottom)pickupPosition
: position of the pickup between the top of the string
-and the excitation position (0-1) (1 is excitation position)excitation
: the excitation signal(pm.)ksReflexionFilter
The "typical" one-zero Karplus-strong feedforward reflexion filter. This -filter will be typically used in a termination (see below).
-terminations(_,chain(...),ksReflexionFilter)
-
-(pm.)rStringRigidTermination
Bidirectional block implementing a right rigid string termination (no damping, -just phase inversion).
-chain(rStringRigidTermination : stringSegment : ...)
-
-(pm.)lStringRigidTermination
Bidirectional block implementing a left rigid string termination (no damping, -just phase inversion).
-chain(... : stringSegment : lStringRigidTermination)
-
-(pm.)elecGuitarBridge
Bidirectional block implementing a simple electric guitar bridge. This
-block is based on bridgeFilter
. The bridge doesn't
-implement transmittance since it is not meant to be connected to a
-body (unlike acoustic guitar). It also partially sets the resonance
-duration of the string with the nuts used on the other side.
chain(... : stringSegment : elecGuitarBridge)
-
-(pm.)elecGuitarNuts
Bidirectional block implementing a simple electric guitar nuts. This
-block is based on bridgeFilter
and does essentially
-the same thing as elecGuitarBridge
, but on the
-other side of the chain. It also partially sets the resonance duration of
-the string with the bridge used on the other side.
chain(elecGuitarNuts : stringSegment : ...)
-
-(pm.)guitarBridge
Bidirectional block implementing a simple acoustic guitar bridge. This
-bridge damps more hight frequencies than
-elecGuitarBridge
and implements a transmittance
-filter. It also partially sets the resonance duration of the string with
-the nuts used on the other side.
chain(... : stringSegment : guitarBridge)
-
-(pm.)guitarNuts
Bidirectional block implementing a simple acoustic guitar nuts. This
-nuts damps more hight frequencies than
-elecGuitarNuts
and implements a transmittance
-filter. It also partially sets the resonance duration of the string with
-the bridge used on the other side.
chain(guitarNuts : stringSegment : ...)
-
-(pm.)idealString
An "ideal" string with rigid terminations and where the plucking position -and the pick-up position are the same. Since terminations are rigid, this -string will ring forever.
-1-1' : idealString(length,reflexion,xPosition,excitation)
-
-With:
-* length
: the length of the string in meters
-* pluckPosition
: the plucking position (0.001-0.999)
-* excitation
: the input signal for the excitation.
(pm.)ks
A Karplus-Strong string (in that case, the string is implemented as a -one dimension waveguide).
-ks(length,damping,excitation) : _
-
-Where:
-length
: the length of the string in metersdamping
: string damping (0-1)excitation
: excitation signal(pm.)ks_ui_MIDI
Ready-to-use, MIDI-enabled Karplus-Strong string with buil-in UI.
-ks_ui_MIDI : _
-
-(pm.)elecGuitarModel
A simple electric guitar model (without audio effects, of course) with -selectable pluck position. -This model implements a single string. Additional strings should be created -by making a polyphonic application out of this function. Pitch is changed by -changing the length of the string and not through a finger model.
-elecGuitarModel(length,pluckPosition,mute,excitation) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)mute
: mute coefficient (1 for no mute and 0 for instant mute)excitation
: excitation signal(pm.)elecGuitar
A simple electric guitar model with steel strings (based on
-elecGuitarModel
) implementing an excitation
-model.
-This model implements a single string. Additional strings should be created
-by making a polyphonic application out of this function.
elecGuitar(length,pluckPosition,trigger) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)mute
: mute coefficient (1 for no mute and 0 for instant mute)gain
: gain of the pluck (0-1)trigger
: trigger signal (1 for on, 0 for off)(pm.)elecGuitar_ui_MIDI
Ready-to-use MIDI-enabled electric guitar physical model with built-in UI.
-elecGuitar_ui_MIDI : _
-
-(pm.)guitarBody
WARNING: not implemented yet! -Bidirectional block implementing a simple acoustic guitar body.
-chain(... : guitarBody)
-
-(pm.)guitarModel
A simple acoustic guitar model with steel strings and selectable excitation -position. This model implements a single string. Additional strings should be created -by making a polyphonic application out of this function. Pitch is changed by -changing the length of the string and not through a finger model. -WARNING: this function doesn't currently implement a body (just strings and -bridge).
-guitarModel(length,pluckPosition,excitation) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)excitation
: excitation signal(pm.)guitar
A simple acoustic guitar model with steel strings (based on
-guitarModel
) implementing an excitation model.
-This model implements a single string. Additional strings should be created
-by making a polyphonic application out of this function.
guitar(length,pluckPosition,trigger) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)gain
: gain of the excitationtrigger
: trigger signal (1 for on, 0 for off)(pm.)guitar_ui_MIDI
Ready-to-use MIDI-enabled steel strings acoustic guitar physical model with -built-in UI.
-guitar_ui_MIDI : _
-
-(pm.)nylonGuitarModel
A simple acoustic guitar model with nylon strings and selectable excitation -position. This model implements a single string. Additional strings should be created -by making a polyphonic application out of this function. Pitch is changed by -changing the length of the string and not through a finger model. -WARNING: this function doesn't currently implement a body (just strings and -bridge).
-nylonGuitarModel(length,pluckPosition,excitation) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)excitation
: excitation signal(pm.)nylonGuitar
A simple acoustic guitar model with nylon strings (based on
-nylonGuitarModel
) implementing an excitation model.
-This model implements a single string. Additional strings should be created
-by making a polyphonic application out of this function.
nylonGuitar(length,pluckPosition,trigger) : _
-
-Where:
-length
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)gain
: gain of the excitation (0-1)trigger
: trigger signal (1 for on, 0 for off)(pm.)nylonGuitar_ui_MIDI
Ready-to-use MIDI-enabled nylon strings acoustic guitar physical model with -built-in UI.
-nylonGuitar_ui_MIDI : _
-
-(pm.)modeInterpRes
Modular string instrument resonator based on IR measurements made on 3D -printed models. The 2D space allowing for the control of the shape and the -scale of the model is enabled by interpolating between modes parameters. -More information about this technique/project can be found here: -* https://ccrma.stanford.edu/~rmichon/3dPrintingModeling/.
-_ : modeInterpRes(nModes,x,y) : _
-
-Where:
-nModes
: number of modeled modes (40 max)x
: shape of the resonator (0: square, 1: square with rounded corners, 2: round)y
: scale of the resonator (0: small, 1: medium, 2: large)(pm.)modularInterpBody
Bidirectional block implementing a modular string instrument resonator
-(see modeInterpRes
).
chain(... : modularInterpBody(nModes,shape,scale) : ...)
-
-Where:
-nModes
: number of modeled modes (40 max)shape
: shape of the resonator (0: square, 1: square with rounded corners, 2: round)scale
: scale of the resonator (0: small, 1: medium, 2: large)(pm.)modularInterpStringModel
String instrument model with a modular body (see
-modeInterpRes
and
-* https://ccrma.stanford.edu/~rmichon/3dPrintingModeling/).
modularInterpStringModel(length,pluckPosition,shape,scale,bodyExcitation,stringExcitation) : _
-
-Where:
-stringLength
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)shape
: shape of the resonator (0: square, 1: square with rounded corners, 2: round)scale
: scale of the resonator (0: small, 1: medium, 2: large)bodyExcitation
: excitation signal for the bodystringExcitation
: excitation signal for the string(pm.)modularInterpInstr
String instrument with a modular body (see
-modeInterpRes
and
-* https://ccrma.stanford.edu/~rmichon/3dPrintingModeling/).
modularInterpInstr(stringLength,pluckPosition,shape,scale,gain,tapBody,triggerString) : _
-
-Where:
-stringLength
: the length of the string in meterspluckPosition
: pluck position (0-1) (1 is on the bridge)shape
: shape of the resonator (0: square, 1: square with rounded corners, 2: round)scale
: scale of the resonator (0: small, 1: medium, 2: large)gain
: of the string excitationtapBody
: send an impulse in the body of the instrument where the string is connected (1 for on, 0 for off)triggerString
: trigger signal for the string (1 for on, 0 for off)(pm.)modularInterpInstr_ui_MIDI
Ready-to-use MIDI-enabled string instrument with a modular body (see
-modeInterpRes
and
-* https://ccrma.stanford.edu/~rmichon/3dPrintingModeling/)
-with built-in UI.
modularInterpInstr_ui_MIDI : _
-
-Low and high level basic string instruments parts. Most of the elements in -this section can be used in a bidirectional chain.
-(pm.)bowTable
Extremely basic bow table that can be used to implement a wide range of -bow types for many different bowed string instruments (violin, cello, etc.).
-excitation : bowTable(offeset,slope) : _
-
-Where:
-excitation
: an excitation signaloffset
: table offsetslope
: table slope(pm.)violinBowTable
Violin bow table based on bowTable
.
bowVelocity : violinBowTable(bowPressure) : _
-
-Where:
-bowVelocity
: velocity of the bow/excitation signal (0-1)bowPressure
: bow pressure on the string (0-1)(pm.)bowInteraction
Bidirectional block implementing the interaction of a bow in a
-chain
.
chain(... : stringSegment : bowInteraction(bowTable) : stringSegment : ...)
-
-Where:
-bowTable
: the bow table(pm.)violinBow
Bidirectional block implementing a violin bow and its interaction with -a string.
-chain(... : stringSegment : violinBow(bowPressure,bowVelocity) : stringSegment : ...)
-
-Where:
-bowVelocity
: velocity of the bow / excitation signal (0-1)bowPressure
: bow pressure on the string (0-1)(pm.)violinBowedString
Violin bowed string bidirectional block with controllable bow position. -Terminations are not implemented in this model.
-chain(nuts : violinBowedString(stringLength,bowPressure,bowVelocity,bowPosition) : bridge)
-
-Where:
-stringLength
: the length of the string in metersbowVelocity
: velocity of the bow / excitation signal (0-1)bowPressure
: bow pressure on the string (0-1)bowPosition
: the position of the bow on the string (0-1)(pm.)violinNuts
Bidirectional block implementing simple violin nuts. This function is
-based on bridgeFilter
.
chain(violinNuts : stringSegment : ...)
-
-(pm.)violinBridge
Bidirectional block implementing a simple violin bridge. This function is
-based on bridgeFilter
.
chain(... : stringSegment : violinBridge
-
-(pm.)violinBody
Bidirectional block implementing a simple violin body (just a simple -resonant lowpass filter).
-chain(... : stringSegment : violinBridge : violinBody)
-
-(pm.)violinModel
Ready-to-use simple violin physical model. This model implements a single -string. Additional strings should be created -by making a polyphonic application out of this function. Pitch is changed -by changing the length of the string (and not through a finger model).
-violinModel(stringLength,bowPressure,bowVelocity,bridgeReflexion,
-bridgeAbsorption,bowPosition) : _
-
-Where:
-stringLength
: the length of the string in metersbowVelocity
: velocity of the bow / excitation signal (0-1)bowPressure
: bow pressure on the string (0-1))bowPosition
: the position of the bow on the string (0-1)(pm.)violin_ui
Ready-to-use violin physical model with built-in UI.
-violinModel_ui : _
-
-(pm.)violin_ui_MIDI
Ready-to-use MIDI-enabled violin physical model with built-in UI.
-violin_ui_MIDI : _
-
-Low and high level basic wind instruments parts. Most of the elements in -this section can be used in a bidirectional chain.
-(pm.)openTube
A tube segment without terminations (same as stringSegment
).
chain(A : openTube(maxLength,length) : B)
-
-Where:
-maxLength
: the maximum length of the tube in meters (should be static)length
: the length of the tube in meters(pm.)reedTable
Extremely basic reed table that can be used to implement a wide range of -single reed types for many different instruments (saxophone, clarinet, etc.).
-excitation : reedTable(offeset,slope) : _
-
-Where:
-excitation
: an excitation signaloffset
: table offsetslope
: table slope(pm.)fluteJetTable
Extremely basic flute jet table.
-excitation : fluteJetTable : _
-
-Where:
-excitation
: an excitation signal(pm.)brassLipsTable
Simple brass lips/mouthpiece table. Since this implementation is very basic -and that the lips and tube of the instrument are coupled to each other, the -length of that tube must be provided here.
-excitation : brassLipsTable(tubeLength,lipsTension) : _
-
-Where:
-excitation
: an excitation signal (can be DC)tubeLength
: length in meters of the tube connected to the mouthpiecelipsTension
: tension of the lips (0-1) (default: 0.5)(pm.)clarinetReed
Clarinet reed based on reedTable
with controllable
-stiffness.
excitation : clarinetReed(stiffness) : _
-
-Where:
-excitation
: an excitation signalstiffness
: reed stiffness (0-1)(pm.)clarinetMouthPiece
Bidirectional block implementing a clarinet mouthpiece as well as the various -interactions happening with traveling waves. This element is ready to be -plugged to a tube...
-chain(clarinetMouthPiece(reedStiffness,pressure) : tube : etc.)
-
-Where:
-pressure
: the pressure of the air flow (DC) created by the virtual performer (0-1).
-This can also be any kind of signal that will directly injected in the mouthpiece
-(e.g., breath noise, etc.).reedStiffness
: reed stiffness (0-1)(pm.)brassLips
Bidirectional block implementing a brass mouthpiece as well as the various -interactions happening with traveling waves. This element is ready to be -plugged to a tube...
-chain(brassLips(tubeLength,lipsTension,pressure) : tube : etc.)
-
-Where:
-tubeLength
: length in meters of the tube connected to the mouthpiecelipsTension
: tension of the lips (0-1) (default: 0.5)pressure
: the pressure of the air flow (DC) created by the virtual performer (0-1).
-This can also be any kind of signal that will directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)fluteEmbouchure
Bidirectional block implementing a flute embouchure as well as the various -interactions happening with traveling waves. This element is ready to be -plugged between tubes segments...
-chain(... : tube : fluteEmbouchure(pressure) : tube : etc.)
-
-Where:
-pressure
: the pressure of the air flow (DC) created by the virtual
-performer (0-1).
-This can also be any kind of signal that will directly injected in the
-mouthpiece (e.g., breath noise, etc.).(pm.)wBell
Generic wind instrument bell bidirectional block that should be placed at
-the end of a chain
.
chain(... : wBell(opening))
-
-Where:
-opening
: the "opening" of bell (0-1)(pm.)fluteHead
Simple flute head implementing waves reflexion.
-chain(fluteHead : tube : ...)
-
-(pm.)fluteFoot
Simple flute foot implementing waves reflexion and dispersion.
-chain(... : tube : fluteFoot)
-
-(pm.)clarinetModel
A simple clarinet physical model without tone holes (pitch is changed by -changing the length of the tube of the instrument).
-clarinetModel(length,pressure,reedStiffness,bellOpening) : _
-
-Where:
-tubeLength
: the length of the tube in meterspressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will directly injected in the mouthpiece
-(e.g., breath noise, etc.).reedStiffness
: reed stiffness (0-1)bellOpening
: the opening of bell (0-1)(pm.)clarinetModel_ui
Same as clarinetModel
but with a built-in UI. This function
-doesn't implement a virtual "blower", thus pressure
remains an argument here.
clarinetModel_ui(pressure) : _
-
-Where:
-pressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will be directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)clarinet_ui
Ready-to-use clarinet physical model with built-in UI based on
-clarinetModel
.
clarinet_ui : _
-
-(pm.)clarinet_ui_MIDI
Ready-to-use MIDI compliant clarinet physical model with built-in UI.
-clarinet_ui_MIDI : _
-
-(pm.)brassModel
A simple generic brass instrument physical model without pistons -(pitch is changed by changing the length of the tube of the instrument). -This model is kind of hard to control and might not sound very good if -bad parameters are given to it...
-brassModel(tubeLength,lipsTension,mute,pressure) : _
-
-Where:
-tubeLength
: the length of the tube in meterslipsTension
: tension of the lips (0-1) (default: 0.5)mute
: mute opening at the end of the instrument (0-1) (default: 0.5)pressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)brassModel_ui
Same as brassModel
but with a built-in UI. This function
-doesn't implement a virtual "blower", thus pressure
remains an argument here.
brassModel_ui(pressure) : _
-
-Where:
-pressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will be directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)brass_ui
Ready-to-use brass instrument physical model with built-in UI based on
-brassModel
.
brass_ui : _
-
-(pm.)brass_ui_MIDI
Ready-to-use MIDI-controllable brass instrument physical model with built-in UI.
-brass_ui_MIDI : _
-
-(pm.)fluteModel
A simple generic flute instrument physical model without tone holes -(pitch is changed by changing the length of the tube of the instrument).
-fluteModel(tubeLength,mouthPosition,pressure) : _
-
-Where:
-tubeLength
: the length of the tube in metersmouthPosition
: position of the mouth on the embouchure (0-1) (default: 0.5)pressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)fluteModel_ui
Same as fluteModel
but with a built-in UI. This function
-doesn't implement a virtual "blower", thus pressure
remains an argument here.
fluteModel_ui(pressure) : _
-
-Where:
-pressure
: the pressure of the air flow created by the virtual performer (0-1).
-This can also be any kind of signal that will be directly injected in the mouthpiece
-(e.g., breath noise, etc.).(pm.)flute_ui
Ready-to-use flute physical model with built-in UI based on
-fluteModel
.
flute_ui : _
-
-(pm.)flute_ui_MIDI
Ready-to-use MIDI-controllable flute physical model with built-in UI.
-flute_ui_MIDI : _
-
-Various kind of excitation signal generators.
-(pm.)impulseExcitation
Creates an impulse excitation of one sample.
-gate = button('gate');
-impulseExcitation(gate) : chain;
-
-Where:
-gate
: a gate button(pm.)strikeModel
Creates a filtered noise excitation.
-gate = button('gate');
-strikeModel(LPcutoff,HPcutoff,sharpness,gain,gate) : chain;
-
-Where:
-HPcutoff
: highpass cutoff frequencyLPcutoff
: lowpass cutoff frequencysharpness
: sharpness of the attack and release (0-1)gain
: gain of the excitationgate
: a gate button/trigger signal (0/1)(pm.)strike
Strikes generator with controllable excitation position.
-gate = button('gate');
-strike(exPos,sharpness,gain,gate) : chain;
-
-Where:
-exPos
: excitation position wiht 0: for max low freqs and 1: for max high
-freqs. So, on membrane for example, 0 would be the middle and 1 the edgesharpness
: sharpness of the attack and release (0-1)gain
: gain of the excitationgate
: a gate button/trigger signal (0/1)(pm.)pluckString
Creates a plucking excitation signal.
-trigger = button('gate');
-pluckString(stringLength,cutoff,maxFreq,sharpness,trigger)
-
-Where:
-stringLength
: length of the string to pluckcutoff
: cutoff ratio (1 for default)maxFreq
: max frequency ratio (1 for default)sharpness
: sharpness of the attack and release (1 for default)gain
: gain of the excitation (0-1)trigger
: trigger signal (1 for on, 0 for off)(pm.)blower
A virtual blower creating a DC signal with some breath noise in it.
-blower(pressure,breathGain,breathCutoff) : _
-
-Where:
-pressure
: pressure (0-1)breathGain
: breath noise gain (0-1) (recommended: 0.005)breathCutoff
: breath cuttoff frequency (Hz) (recommended: 2000)(pm.)blower_ui
Same as blower
but with a built-in UI.
blower : somethingToBeBlown
-
-High and low level functions for modal synthesis of percussion instruments.
-(pm.)djembeModel
Dirt-simple djembe modal physical model. Mode parameters are empirically -calculated and don't correspond to any measurements or 3D model. They -kind of sound good though :).
-excitation : djembeModel(freq)
-
-Where:
-excitation
: excitation signalfreq
: fundamental frequency of the bar(pm.)djembe
Dirt-simple djembe modal physical model. Mode parameters are empirically -calculated and don't correspond to any measurements or 3D model. They -kind of sound good though :).
-This model also implements a virtual "exciter".
-djembe(freq,strikePosition,strikeSharpness,gain,trigger)
-
-Where:
-freq
: fundamental frequency of the modelstrikePosition
: strike position (0 for the middle of the membrane and
-1 for the edge)strikeSharpness
: sharpness of the strike (0-1, default: 0.5)gain
: gain of the striketrigger
: trigger signal (0: off, 1: on)(pm.)djembe_ui_MIDI
Simple MIDI controllable djembe physical model with built-in UI.
-djembe_ui_MIDI : _
-
-(pm.)marimbaBarModel
Generic marimba tone bar modal model.
-This model was generated using
-mesh2faust
from a 3D CAD model of a marimba tone bar
-(libraries/modalmodels/marimbaBar
). The corresponding CAD model is that
-of a C2 tone bar (original fundamental frequency: ~65Hz). While
-marimbaBarModel
allows to translate the harmonic content of the generated
-sound by providing a frequency (freq
), mode transposition has limits and
-the model will sound less and less like a marimba tone bar as it
-diverges from C2. To make an accurate model of a marimba, we'd want to have
-an independent model for each bar...
This model contains 5 excitation positions going linearly from the center
-bottom to the center top of the bar. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : marimbaBarModel(freq,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: excitation signalfreq
: fundamental frequency of the barexPos
: excitation position (0-4)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)marimbaResTube
Simple marimba resonance tube.
-marimbaResTube(tubeLength,excitation)
-
-Where:
-tubeLength
: the length of the tube in metersexcitation
: the excitation signal (audio in)(pm.)marimbaModel
Simple marimba physical model implementing a single tone bar connected to
-tube. This model is scalable and can be adapted to any size of bar/tube
-(see marimbaBarModel
to know more about the
-limitations of this type of system).
excitation : marimbaModel(freq,exPos) : _
-
-Where:
-freq
: the frequency of the bar/tube coupleexPos
: excitation position (0-4)(pm.)marimba
Simple marimba physical model implementing a single tone bar connected to
-tube. This model is scalable and can be adapted to any size of bar/tube
-(see marimbaBarModel
to know more about the
-limitations of this type of system).
This function also implement a virtual exciter to drive the model.
-excitation : marimba(freq,strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalfreq
: the frequency of the bar/tube couplestrikePosition
: strike position (0-4)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)marimba_ui_MIDI
Simple MIDI controllable marimba physical model with built-in UI
-implementing a single tone bar connected to
-tube. This model is scalable and can be adapted to any size of bar/tube
-(see marimbaBarModel
to know more about the
-limitations of this type of system).
marimba_ui_MIDI : _
-
-(pm.)churchBellModel
Generic church bell modal model generated by mesh2faust
from
-libraries/modalmodels/churchBell
.
Modeled after T. Rossing and R. Perrin, Vibrations of Bells, Applied -Acoustics 2, 1987.
-Model height is 301 mm.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : churchBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)churchBell
Generic church bell modal model.
-Modeled after T. Rossing and R. Perrin, Vibrations of Bells, Applied -Acoustics 2, 1987.
-Model height is 301 mm.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : churchBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)churchBell_ui
Church bell physical model based on churchBell
with
-built-in UI.
churchBell_ui : _
-
-(pm.)englishBellModel
English church bell modal model generated by mesh2faust
from
-libraries/modalmodels/englishBell
.
Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : englishBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)englishBell
English church bell modal model.
-Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : englishBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)englishBell_ui
English church bell physical model based on englishBell
with
-built-in UI.
englishBell_ui : _
-
-(pm.)frenchBellModel
French church bell modal model generated by mesh2faust
from
-libraries/modalmodels/frenchBell
.
Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : frenchBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)frenchBell
French church bell modal model.
-Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : frenchBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)frenchBell_ui
French church bell physical model based on frenchBell
with
-built-in UI.
frenchBell_ui : _
-
-(pm.)germanBellModel
German church bell modal model generated by mesh2faust
from
-libraries/modalmodels/germanBell
.
Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : germanBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)germanBell
German church bell modal model.
-Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 1 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : germanBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)germanBell_ui
German church bell physical model based on germanBell
with
-built-in UI.
germanBell_ui : _
-
-(pm.)russianBellModel
Russian church bell modal model generated by mesh2faust
from
-libraries/modalmodels/russianBell
.
Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 2 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : russianBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)russianBell
Russian church bell modal model.
-Modeled after D.Bartocha and Baron, Influence of Tin Bronze Melting and -Pouring Parameters on Its Properties and Bell' Tone, Archives of Foundry -Engineering, 2016.
-Model height is 2 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : russianBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)russianBell_ui
Russian church bell physical model based on russianBell
with
-built-in UI.
russianBell_ui : _
-
-(pm.)standardBellModel
Standard church bell modal model generated by mesh2faust
from
-libraries/modalmodels/standardBell
.
Modeled after T. Rossing and R. Perrin, Vibrations of Bells, Applied -Acoustics 2, 1987.
-Model height is 1.8 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
excitation : standardBellModel(nModes,exPos,t60,t60DecayRatio,t60DecaySlope)
-
-Where:
-excitation
: the excitation signalnModes
: number of synthesized modes (max: 50)exPos
: excitation position (0-6)t60
: T60 in seconds (recommended value: 0.1)t60DecayRatio
: T60 decay ratio (recommended value: 1)t60DecaySlope
: T60 decay slope (recommended value: 5)(pm.)standardBell
Standard church bell modal model.
-Modeled after T. Rossing and R. Perrin, Vibrations of Bells, Applied -Acoustics 2, 1987.
-Model height is 1.8 m.
-This model contains 7 excitation positions going linearly from the
-bottom to the top of the bell. Obviously, a model with more excitation
-position could be regenerated using mesh2faust
.
This function also implement a virtual exciter to drive the model.
-excitation : standardBell(strikePosition,strikeCutoff,strikeSharpness,gain,trigger) : _
-
-Where:
-excitation
: the excitation signalstrikePosition
: strike position (0-6)strikeCutoff
: cuttoff frequency of the strike genarator (recommended: ~7000Hz)strikeSharpness
: sharpness of the strike (recommended: ~0.25)gain
: gain of the strike (0-1)trigger
signal (0: off, 1: on)(pm.)standardBell_ui
Standard church bell physical model based on standardBell
with
-built-in UI.
standardBell_ui : _
-
-Vocal synthesizer functions (source/filter, fof, etc.).
-(pm.)formantValues
Formant data values.
-The formant data used here come from the CSOUND manual -* http://www.csounds.com/manual/html/.
-ba.take(j+1,formantValues.f(i)) : _
-ba.take(j+1,formantValues.g(i)) : _
-ba.take(j+1,formantValues.bw(i)) : _
-
-Where:
-i
: formant numberj
: (voiceType*nFormants)+vowelvoiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3:
-soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)(pm.)voiceGender
Calculate the gender for the provided voiceType
value. (0: male, 1: female)
voiceGender(voiceType) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)(pm.)skirtWidthMultiplier
Calculates value to multiply bandwidth to obtain skirtwidth
-for a Fof filter.
skirtWidthMultiplier(vowel,freq,gender) : _
-
-Where:
-vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)freq
: the fundamental frequency of the excitation signalgender
: gender of the voice used in the fof filter (0: male, 1: female)(pm.)autobendFreq
Autobends the center frequencies of formants 1 and 2 based on
-the fundamental frequency of the excitation signal and leaves
-all other formant frequencies unchanged. Ported from chant-lib
.
_ : autobendFreq(n,freq,voiceType) : _
-
-Where:
-n
: formant indexfreq
: the fundamental frequency of the excitation signalvoiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)(pm.)vocalEffort
Changes the gains of the formants based on the fundamental
-frequency of the excitation signal. Higher formants are
-reinforced for higher fundamental frequencies.
-Ported from chant-lib
.
_ : vocalEffort(freq,gender) : _
-
-Where:
-freq
: the fundamental frequency of the excitation signalgender
: the gender of the voice type (0: male, 1: female)(pm.)fof
Function to generate a single Formant-Wave-Function.
-_ : fof(fc,bw,a,g) : _
-
-Where:
-fc
: formant center frequency,bw
: formant bandwidth (Hz),sw
: formant skirtwidth (Hz)g
: linear scale factor (g=1 gives 0dB amplitude response at fc)(pm.)fofSH
FOF with sample and hold used on bw
and a parameter
-used in the filter-cycling FOF function fofCycle
.
_ : fofSH(fc,bw,a,g) : _
-
-Where: all parameters same as for fof
(pm.)fofCycle
FOF implementation where time-varying filter parameter noise is
-mitigated by using a cycle of n
sample and hold FOF filters.
_ : fofCycle(fc,bw,a,g,n) : _
-
-Where:
-n
: the number of FOF filters to cycle throughfof
(pm.)fofSmooth
FOF implementation where time-varying filter parameter
-noise is mitigated by lowpass filtering the filter
-parameters bw
and a
with smooth.
_ : fofSmooth(fc,bw,sw,g,tau) : _
-
-Where:
-tau
: the desired smoothing time constant in secondsfof
(pm.)formantFilterFofCycle
Formant filter based on a single FOF filter.
-Formant parameters are linearly interpolated allowing to go smoothly from
-one vowel to another. A cycle of n
fof filters with sample-and-hold is
-used so that the fof filter parameters can be varied in realtime.
-This technique is more robust but more computationally expensive than
-formantFilterFofSmooth
.Voice type can be
-selected but must correspond to
-the frequency range of the provided source to be realistic.
_ : formantFilterFofCycle(voiceType,vowel,nFormants,i,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor,
- 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)nFormants
: number of formant regions in frequency domain, typically 5i
: formant number (i.e. 0 - 4) used to index formant data value arraysfreq
: fundamental frequency of excitation signal. Used to calculate
- rise time of envelope(pm.)formantFilterFofSmooth
Formant filter based on a single FOF filter. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Fof filter parameters are lowpass filtered -to mitigate possible noise from varying them in realtime. -Voice type can be selected but must correspond to -the frequency range of the provided source to be realistic.
-_ : formantFilterFofSmooth(voiceType,vowel,nFormants,i,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor,
- 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)nFormants
: number of formant regions in frequency domain, typically 5i
: formant number (i.e. 1 - 5) used to index formant data value arraysfreq
: fundamental frequency of excitation signal. Used to calculate
- rise time of envelope(pm.)formantFilterBP
Formant filter based on a single resonant bandpass filter. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the provided source to be realistic.
-_ : formantFilterBP(voiceType,vowel,nFormants,i,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)nFormants
: number of formant regions in frequency domain, typically 5i
: formant index used to index formant data value arraysfreq
: fundamental frequency of excitation signal.(pm.)formantFilterbank
Formant filterbank which can use different types of filterbank -functions and different excitation signals. Formant parameters are -linearly interpolated allowing to go smoothly from one vowel to another. -Voice type can be selected but must correspond to the frequency range -of the provided source to be realistic.
-_ : formantFilterbank(voiceType,vowel,formantGen,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)formantGen
: the specific formant filterbank function
- (i.e. FormantFilterbankBP, FormantFilterbankFof,...)freq
: fundamental frequency of excitation signal. Needed for FOF
- version to calculate rise time of envelope(pm.)formantFilterbankFofCycle
Formant filterbank based on a bank of fof filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the provided source to be realistic.
-_ : formantFilterbankFofCycle(voiceType,vowel,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)freq
: the fundamental frequency of the excitation signal. Needed to calculate the skirtwidth
-of the FOF envelopes and for the autobendFreq and vocalEffort functions(pm.)formantFilterbankFofSmooth
Formant filterbank based on a bank of fof filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the provided source to be realistic.
-_ : formantFilterbankFofSmooth(voiceType,vowel,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)freq
: the fundamental frequency of the excitation signal. Needed to
-calculate the skirtwidth of the FOF envelopes and for the
-autobendFreq and vocalEffort functions(pm.)formantFilterbankBP
Formant filterbank based on a bank of resonant bandpass filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the provided source to be realistic.
-_ : formantFilterbankBP(voiceType,vowel,freq) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: u)freq
: the fundamental frequency of the excitation signal. Needed for the autobendFreq and vocalEffort functions(pm.)SFFormantModel
Simple formant/vocal synthesizer based on a source/filter model. The source
-and filterbank
must be specified by the user. filterbank
must take the same
-input parameters as formantFilterbank
(BP
/FofCycle
-/FofSmooth
).
-Formant parameters are linearly interpolated allowing to go smoothly from
-one vowel to another. Voice type can be selected but must correspond to
-the frequency range of the synthesized voice to be realistic.
SFFormantModel(voiceType,vowel,exType,freq,gain,source,filterbank,isFof) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: uexType
: voice vs. fricative sound ratio (0-1 where 1 is 100% fricative)freq
: the fundamental frequency of the source signalgain
: linear gain multiplier to multiply the source byisFof
: whether model is FOF based (0: no, 1: yes)(pm.)SFFormantModelFofCycle
Simple formant/vocal synthesizer based on a source/filter model. The source -is just a periodic impulse and the "filter" is a bank of FOF filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the synthesized voice to be realistic. This model -does not work with noise in the source signal so exType has been removed -and model does not depend on SFFormantModel function.
-SFFormantModelFofCycle(voiceType,vowel,freq,gain) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: ufreq
: the fundamental frequency of the source signalgain
: linear gain multiplier to multiply the source by(pm.)SFFormantModelFofSmooth
Simple formant/vocal synthesizer based on a source/filter model. The source -is just a periodic impulse and the "filter" is a bank of FOF filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the synthesized voice to be realistic.
-SFFormantModelFofSmooth(voiceType,vowel,freq,gain) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: ufreq
: the fundamental frequency of the source signalgain
: linear gain multiplier to multiply the source by(pm.)SFFormantModelBP
Simple formant/vocal synthesizer based on a source/filter model. The source -is just a sawtooth wave and the "filter" is a bank of resonant bandpass filters. -Formant parameters are linearly interpolated allowing to go smoothly from -one vowel to another. Voice type can be selected but must correspond to -the frequency range of the synthesized voice to be realistic.
-The formant data used here come from the CSOUND manual -* http://www.csounds.com/manual/html/.
-SFFormantModelBP(voiceType,vowel,exType,freq,gain) : _
-
-Where:
-voiceType
: the voice type (0: alto, 1: bass, 2: countertenor, 3: soprano, 4: tenor)vowel
: the vowel (0: a, 1: e, 2: i, 3: o, 4: uexType
: voice vs. fricative sound ratio (0-1 where 1 is 100% fricative)freq
: the fundamental frequency of the source signalgain
: linear gain multiplier to multiply the source by(pm.)SFFormantModelFofCycle_ui
Ready-to-use source-filter vocal synthesizer with built-in user interface.
-SFFormantModelFofCycle_ui : _
-
-(pm.)SFFormantModelFofSmooth_ui
Ready-to-use source-filter vocal synthesizer with built-in user interface.
-SFFormantModelFofSmooth_ui : _
-
-(pm.)SFFormantModelBP_ui
Ready-to-use source-filter vocal synthesizer with built-in user interface.
-SFFormantModelBP_ui : _
-
-(pm.)SFFormantModelFofCycle_ui_MIDI
Ready-to-use MIDI-controllable source-filter vocal synthesizer.
-SFFormantModelFofCycle_ui_MIDI : _
-
-(pm.)SFFormantModelFofSmooth_ui_MIDI
Ready-to-use MIDI-controllable source-filter vocal synthesizer.
-SFFormantModelFofSmooth_ui_MIDI : _
-
-(pm.)SFFormantModelBP_ui_MIDI
Ready-to-use MIDI-controllable source-filter vocal synthesizer.
-SFFormantModelBP_ui_MIDI : _
-
-Various miscellaneous functions.
-(pm.)allpassNL
Bidirectional block adding nonlinearities in both directions in a chain. -Nonlinearities are created by modulating the coefficients of a passive -allpass filter by the signal it is processing.
-chain(... : allpassNL(nonlinearity) : ...)
-
-Where:
-nonlinearity
: amount of nonlinearity to be added (0-1)(pm).modalModel
Implement multiple resonance modes using resonant bandpass filters.
-_ : modalModel(n, freqs, t60s, gains) : _
-
-Where:
-n
: number of given modesfreqs
: list of filter center freqenciest60s
: list of mode resonance durations (in seconds)gains
: list of mode gains (0-1)For example, to generate a model with 2 modes (440 Hz and 660 Hz, a -fifth) where the higher one decays faster and is attenuated:
-os.impulse : modalModel(2, (440, 660),
- (0.5, 0.25),
- (ba.db2linear(-1), ba.db2linear(-6)) : _
-
-Further reading: Grumiaux et. al., 2017: -Impulse-Response and CAD-Model-Based Physical Modeling in -Faust
Welcome to the documentation for physmodels.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library to handle platform specific code in Faust. Its official prefix is pl
.
(pl.)SR
Current sampling rate (between 1 and 192000Hz). Constant during -program execution. Setting this value to a constant will allow the -compiler to optimize the code by computing constant expressions at -compile time, and can be valuable for performance, especially on -embedded systems.
-(pl.)BS
Current block-size (between 1 and 16384 frames). Can change during the execution.
-(pl.)tablesize
Oscillator table size. This value is used to define the size of the -table used by the oscillators. It is usually a power of 2 and can be lowered -to save memory. The default value is 65536.
Welcome to the documentation for platform.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Faust Frequency Quantization Library. Its official prefix is qu
.
(qu.)quantize
Configurable frequency quantization tool. Output only the frequencies that are part of the specified scale. -Works for positive audio frequencies.
-_ : quantize(rf,nl) : _
-
-Where :
-rf
: frequency of the root note of the scalenl
: list of the ratio of the frequencies of each note in relation to the root frequency(qu.)quantizeSmoothed
Configurable frequency quantization tool. Output frequencies that are closer to the frequencies of the specified scale notes. -Works for positive audio frequencies.
-_ : quantizeSmoothed(rf,nl) : _
-nl = (1,1.2,1.4,1.7);
-
-Where :
-rf
: frequency of the root note of the scalenl
: list of the ratio of the frequencies of each note in relation to the root frequency(qu.)ionian
List of the frequency ratios of the notes of the ionian mode.
-_ : quantize(rf,ionian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)dorian
List of the frequency ratios of the notes of the dorian mode.
-_ : quantize(rf,dorian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)phrygian
List of the frequency ratios of the notes of the phrygian mode.
-_ : quantize(rf,phrygian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)lydian
List of the frequency ratios of the notes of the lydian mode.
-_ : quantize(rf,lydian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)mixo
List of the frequency ratios of the notes of the mixolydian mode.
-_ : quantize(rf,mixo) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)eolian
List of the frequency ratios of the notes of the eolian mode.
-_ : quantize(rf,eolian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)locrian
List of the frequency ratios of the notes of the locrian mode.
-_ : quantize(rf,locrian) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)pentanat
List of the frequency ratios of the notes of the pythagorean tuning for the minor pentatonic scale.
-_ : quantize(rf,pentanat) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)kumoi
List of the frequency ratios of the notes of the kumoijoshi, the japanese pentatonic scale.
-_ : quantize(rf,kumoi) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)natural
List of the frequency ratios of the notes of the natural major scale.
-_ : quantize(rf,natural) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)dodeca
List of the frequency ratios of the notes of the dodecaphonic scale.
-_ : quantize(rf,dodeca) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)dimin
List of the frequency ratios of the notes of the diminished scale.
-_ : quantize(rf,dimin) : _
-
-Where:
-rf
: frequency of the root note of the scale(qu.)penta
List of the frequency ratios of the notes of the minor pentatonic scale.
-_ : quantize(rf,penta) : _
-
-Where:
-rf
: frequency of the root note of the scaleWelcome to the documentation for quantizers.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library providing reduce/map operations in Faust. Its official prefix is
-rm
. The basic idea behind reduce operations is to combine several values
-into a single one by repeatedly applying a binary operation. A typical
-example is finding the maximum of a set of values by repeatedly applying the
-binary operation max
.
In this reducemaps library, you'll find two types of reduce, depending on -whether you want to reduce n consecutive samples of the same signal or a set -of n parallel signals.
-(rm.)parReduce
parReduce(op,N)
combines a set of N
parallel signals into a single one
-using a binary operation op
.
With parReduce
, this reduction process simultaneously occurs on each half
-of the incoming signals. In other words, parReduce(max,256)
is equivalent
-to parReduce(max,128),parReduce(max,128) : max
.
To be used with parReduce
, binary operation op
must be associative.
-Additionally, the concept of a binary operation extends to operations
-that have 2*n
inputs and n
outputs. For example, complex signals can be
-simulated using two signals for the real and imaginary parts. In
-such case, a binary operation would have 4 inputs and 2 outputs.
Please note also that parReduce
is faster than topReduce
or botReduce
-for large number of signals. It is therefore the recommended operation
-whenever op
is associative.
_,...,_ : parReduce(op, N) : _
-
-Where:
-op
: is a binary operation N
: is the number of incomming signals (N>0
). We use a capital letter
-here to indicate that the number of incomming signals must be constant and
-known at compile time.(rm.)topReduce
topReduce(op,N)
involves combining a set of N
parallel signals into a
-single one using a binary operation op
. With topReduce
, the reduction
-process starts from the top two incoming signals, down to the bottom. In
-other words, topReduce(max,256)
is equivalent to topReduce(max,255),_ : max
.
Contrary to parReduce
, the binary operation op
doesn't have to be
-associative here. Like with parReduce
the concept of a binary operation can be
-extended to operations that have 2*n inputs and n outputs. For example,
-complex signals can be simulated using two signals representing the real and
-imaginary parts. In such cases, a binary operation would have 4 inputs and 2
-outputs.
_,...,_ : topReduce(op, N) : _
-
-Where:
-op
: is a binary operationN
: is the number of incomming signals (N>0
). We use a capital letter
-here to indicate that the number of incomming signals must be constant and
-known at compile time.(rm.)botReduce
botReduce(op,N)
combines a set of N
parallel signals into a single one
-using a binary operation op
. With botReduce
, the reduction process starts
-from the bottom two incoming signals, up to the top. In other words,
-botReduce(max,256)
is equivalent to _,botReduce(max,255): max
.
Contrary to parReduce
, the binary operation op
doesn't have to be
-associative here. Like with parReduce
the concept of a binary operation can be
-extended to operations that have 2*n inputs and n outputs. For example,
-complex signals can be simulated using two signals representing the real and
-imaginary parts. In such cases, a binary operation would have 4 inputs and 2
-outputs.
_,...,_ : botReduce(op, N) : _
-
-Where:
-N>0
). We use a capital letter
-here to indicate that the number of incomming signals must be constant and
-known at compile time.(rm.)reduce
Reduce a block of n
consecutive samples of the incomming signal using a
-binary operation op
. For example: reduce(max,128)
will compute the
-maximun value of each block of 128 samples. Please note that the resulting
-value, while computed continuously, will be constant for the duration of a
-block. A new value is only produced at the end of a block. Note also that
-blocks should be of at least one sample (n>0).
_ : reduce(op, n) : _
-
-Where:
-op
: is a binary operationn
: is the number of consecutive samples in a block. (rm.)reducemap
Like reduce
but a foo
function is applied to the result. From
-a mathematical point of view:
-reducemap(op,foo,n)
is equivalent to reduce(op,n):foo
-but more efficient.
_ : reducemap(op, foo, n) : _
-
-Where:
-op
: is a binary operationfoo
: is a function applied to the result of the reductionn
: is the number of consecutive samples in a block. Welcome to the documentation for reducemaps.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of reverb effects. Its official prefix is re
.
(re.)jcrev
This artificial reverberator take a mono signal and output stereo
-(satrev
) and quad (jcrev
). They were implemented by John Chowning
-in the MUS10 computer-music language (descended from Music V by Max
-Mathews). They are Schroeder Reverberators, well tuned for their size.
-Nowadays, the more expensive freeverb is more commonly used (see the
-Faust examples directory).
jcrev
reverb below was made from a listing of "RV", dated April 14, 1972,
-which was recovered from an old SAIL DART backup tape.
-John Chowning thinks this might be the one that became the
-well known and often copied JCREV.
jcrev
is a standard Faust function.
_ : jcrev : _,_,_,_
-
-(re.)satrev
This artificial reverberator take a mono signal and output stereo
-(satrev
) and quad (jcrev
). They were implemented by John Chowning
-in the MUS10 computer-music language (descended from Music V by Max
-Mathews). They are Schroeder Reverberators, well tuned for their size.
-Nowadays, the more expensive freeverb is more commonly used (see the
-Faust examples directory).
satrev
was made from a listing of "SATREV", dated May 15, 1971,
-which was recovered from an old SAIL DART backup tape.
-John Chowning thinks this might be the one used on his
-often-heard brass canon sound examples, one of which can be found at
-* https://ccrma.stanford.edu/~jos/wav/FM-BrassCanon2.wav.
_ : satrev : _,_
-
-(re.)fdnrev0
Pure Feedback Delay Network Reverberator (generalized for easy scaling).
-fdnrev0
is a standard Faust function.
<1,2,4,...,N signals> <:
-fdnrev0(MAXDELAY,delays,BBSO,freqs,durs,loopgainmax,nonl) :>
-<1,2,4,...,N signals>
-
-Where:
-N
: 2, 4, 8, ... (power of 2)MAXDELAY
: power of 2 at least as large as longest delay-line lengthdelays
: N delay lines, N a power of 2, lengths preferably coprimeBBSO
: odd positive integer = order of bandsplit desired at freqsfreqs
: NB-1 crossover frequencies separating desired frequency bandsdurs
: NB decay times (t60) desired for the various bandsloopgainmax
: scalar gain between 0 and 1 used to "squelch" the reverbnonl
: nonlinearity (0 to 0.999..., 0 being linear)(re.)zita_rev_fdn
Internal 8x8 late-reverberation FDN used in the FOSS Linux reverb zita-rev1
-by Fons Adriaensen fons@linuxaudio.org. This is an FDN reverb with
-allpass comb filters in each feedback delay in addition to the
-damping filters.
si.bus(8) : zita_rev_fdn(f1,f2,t60dc,t60m,fsmax) : si.bus(8)
-
-Where:
-f1
: crossover frequency (Hz) separating dc and midrange frequenciesf2
: frequency (Hz) above f1 where T60 = t60m/2 (see below)t60dc
: desired decay time (t60) at frequency 0 (sec)t60m
: desired decay time (t60) at midrange frequencies (sec)fsmax
: maximum sampling rate to be used (Hz)(re.)zita_rev1_stereo
Extend zita_rev_fdn
to include zita_rev1
input/output mapping in stereo mode.
-zita_rev1_stereo
is a standard Faust function.
_,_ : zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax) : _,_
-
-Where:
-rdel
= delay (in ms) before reverberation begins (e.g., 0 to ~100 ms)
-(remaining args and refs as for zita_rev_fdn
above)
(re.)zita_rev1_ambi
Extend zita_rev_fdn
to include zita_rev1
input/output mapping in
-"ambisonics mode", as provided in the Linux C++ version.
_,_ : zita_rev1_ambi(rgxyz,rdel,f1,f2,t60dc,t60m,fsmax) : _,_,_,_
-
-Where:
-rgxyz
= relative gain of lanes 1,4,2 to lane 0 in output (e.g., -9 to 9)
- (remaining args and references as for zita_rev1_stereo above)
(re.)vital_rev
A port of the reverb from the Vital synthesizer. All input parameters -have been normalized to a continuous [0,1] range, making them easy to modulate. -The scaling of the parameters happens inside the function.
-_,_ : vital_rev(prelow, prehigh, lowcutoff, highcutoff, lowgain, highgain, chorus_amt, chorus_freq, predelay, time, size, mix) : _,_
-
-Where:
-prelow
: In the pre-filter, this is the cutoff frequency of a high-pass filter (hence a low value).prehigh
: In the pre-filter, this is the cutoff frequency of a low-pass filter (hence a high value).lowcutoff
: In the feedback filter stage, this is the cutoff frequency of a low-shelf filter.highcutoff
: In the feedback filter stage, this is the cutoff frequency of a high-shelf filter.lowgain
: In the feedback filter stage, this is the gain of a low-shelf filter.highgain
: In the feedback filter stage, this is the gain of a high-shelf filter.chorus_amt
: The amount of chorus modulation in the main delay lines.chorus_freq
: The LFO rate of chorus modulation in the main delay lines.predelay
: The amount of pre-delay time.time
: The decay time of the reverb.size
: The size of the room.mix
: A wetness value to use in a final dry/wet mixer.(re.)mono_freeverb
A simple Schroeder reverberator primarily developed by "Jezar at Dreampoint" that -is extensively used in the free-software world. It uses four Schroeder allpasses in -series and eight parallel Schroeder-Moorer filtered-feedback comb-filters for each -audio channel, and is said to be especially well tuned.
-mono_freeverb
is a standard Faust function.
_ : mono_freeverb(fb1, fb2, damp, spread) : _
-
-Where:
-fb1
: coefficient of the lowpass comb filters (0-1)fb2
: coefficient of the allpass comb filters (0-1)damp
: damping of the lowpass comb filter (0-1)spread
: spatial spread in number of samples (for stereo)While this version is licensed LGPL (with exception) along with other GRAME -library functions, the file freeverb.dsp in the examples directory of older -Faust distributions, such as faust-0.9.85, was released under the BSD license, -which is less restrictive.
-(re.)stereo_freeverb
A simple Schroeder reverberator primarily developed by "Jezar at Dreampoint" that -is extensively used in the free-software world. It uses four Schroeder allpasses in -series and eight parallel Schroeder-Moorer filtered-feedback comb-filters for each -audio channel, and is said to be especially well tuned.
-_,_ : stereo_freeverb(fb1, fb2, damp, spread) : _,_
-
-Where:
-fb1
: coefficient of the lowpass comb filters (0-1)fb2
: coefficient of the allpass comb filters (0-1)damp
: damping of the lowpass comb filter (0-1)spread
: spatial spread in number of samples (for stereo)(re.)dattorro_rev
Reverberator based on the Dattorro reverb topology. This implementation does -not use modulated delay lengths (excursion).
-_,_ : dattorro_rev(pre_delay, bw, i_diff1, i_diff2, decay, d_diff1, d_diff2, damping) : _,_
-
-Where:
-pre_delay
: pre-delay in samples (fixed at compile time)bw
: band-width filter (pre filtering); (0 - 1)i_diff1
: input diffusion factor 1; (0 - 1)i_diff2
: input diffusion factor 2;decay
: decay rate; (0 - 1); infinite decay = 1.0d_diff1
: decay diffusion factor 1; (0 - 1)d_diff2
: decay diffusion factor 2;damping
: high-frequency damping; no damping = 0.0(re.)dattorro_rev_default
Reverberator based on the Dattorro reverb topology with reverb parameters from the -original paper. -This implementation does not use modulated delay lengths (excursion) and -uses zero length pre-delay.
-_,_ : dattorro_rev_default : _,_
-
-(re.)jpverb
An algorithmic reverb (stereo in/out), inspired by the lush chorused sound -of certain vintage Lexicon and Alesis reverberation units. -Designed to sound great with synthetic sound sources, rather than sound like a realistic space.
-_,_ : jpverb(t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cutoff, high_cutoff) : _,_
-
-Where:
-t60
: approximate reverberation time in seconds ([0.1..60] sec) (T60 - the time for the reverb to decay by 60db when damp == 0 ). Does not effect early reflectionsdamp
: controls damping of high-frequencies as the reverb decays. 0 is no damping, 1 is very strong damping. Values should be in the range ([0..1])size
: scales size of delay-lines within the reverberator, producing the impression of a larger or smaller space. Values below 1 can sound metallic. Values should be in the range [0.5..5]early_diff
: controls shape of early reflections. Values of 0.707 or more produce smooth exponential decay. Lower values produce a slower build-up of echoes. Values should be in the range ([0..1])mod_depth
: depth ([0..1]) of delay-line modulation. Use in combination with mod_freq
to set amount of chorusing within the structuremod_freq
: frequency ([0..10] Hz) of delay-line modulation. Use in combination with mod_depth
to set amount of chorusing within the structurelow
: multiplier ([0..1]) for the reverberation time within the low bandmid
: multiplier ([0..1]) for the reverberation time within the mid bandhigh
: multiplier ([0..1]) for the reverberation time within the high bandlow_cutoff
: frequency (100..6000 Hz) at which the crossover between the low and mid bands of the reverb occurshigh_cutoff
: frequency (1000..10000 Hz) at which the crossover between the mid and high bands of the reverb occurs(re.)greyhole
A complex echo-like effect (stereo in/out), inspired by the classic Eventide effect of a similar name.
-The effect consists of a diffuser (like a mini-reverb, structurally similar to the one used in jpverb
)
-connected in a feedback system with a long, modulated delay-line.
-Excels at producing spacey washes of sound.
_,_ : greyhole(dt, damp, size, early_diff, feedback, mod_depth, mod_freq) : _,_
-
-Where:
-dt
: approximate reverberation time in seconds ([0.1..60 sec])damp
: controls damping of high-frequencies as the reverb decays. 0 is no damping, 1 is very strong damping. Values should be between ([0..1])size
: control of relative "room size" roughly in the range ([0.5..3])early_diff
: controls pattern of echoes produced by the diffuser. At very low values, the diffuser acts like a delay-line whose length is controlled by the 'size' parameter. Medium values produce a slow build-up of echoes, giving the sound a reversed-like quality. Values of 0.707 or greater than produce smooth exponentially decaying echoes. Values should be in the range ([0..1])feedback
: amount of feedback through the system. Sets the number of repeating echoes. A setting of 1.0 produces infinite sustain. Values should be in the range ([0..1])mod_depth
: depth ([0..1]) of delay-line modulation. Use in combination with mod_freq
to produce chorus and pitch-variations in the echoesmod_freq
: frequency ([0..10] Hz) of delay-line modulation. Use in combination with mod_depth
to produce chorus and pitch-variations in the echoesWelcome to the documentation for reverbs.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library to handle signal routing in Faust. Its official prefix is ro
.
(ro.)cross
Cross N signals: (x1,x2,..,xn) -> (xn,..,x2,x1)
.
-cross
is a standard Faust function.
cross(N)
-_,_,_ : cross(3) : _,_,_
-
-Where:
-N
: number of signals (int, as a constant numerical expression)Special case: cross2
:
cross2 = _,cross(2),_;
-
-(ro.)crossnn
Cross two bus(N)
s.
(si.bus(2*N)) : crossnn(N) : (si.bus(2*N))
-
-Where:
-N
: the number of signals in the bus
(int, as a constant numerical expression)(ro.)crossn1
Cross bus(N)
and bus(1)
.
(si.bus(N),_) : crossn1(N) : (_,si.bus(N))
-
-Where:
-N
: the number of signals in the first bus
(int, as a constant numerical expression)(ro.)cross1n
Cross bus(1)
and bus(N)
.
(_,si.bus(N)) : crossn1(N) : (si.bus(N),_)
-
-Where:
-N
: the number of signals in the second bus
(int, as a constant numerical expression)(ro.)crossNM
Cross bus(N)
and bus(M)
.
(si.bus(N),si.bus(M)) : crossNM(N,M) : (si.bus(M),si.bus(N))
-
-Where:
-N
: the number of signals in the first bus
(int, as a constant numerical expression)M
: the number of signals in the second bus
(int, as a constant numerical expression)(ro.)interleave
Interleave R x C cables from column order to row order. -input : x(0), x(1), x(2) ..., x(rowcol-1) -output: x(0+0row), x(0+1row), x(0+2row), ..., x(1+0row), x(1+1row), x(1+2*row), ...
-si.bus(R*C) : interleave(R,C) : si.bus(R*C)
-
-Where:
-R
: the number of row (int, as a constant numerical expression)C
: the number of column (int, as a constant numerical expression)(ro.)butterfly
Addition (first half) then substraction (second half) of interleaved signals.
-si.bus(N) : butterfly(N) : si.bus(N)
-
-Where:
-N
: size of the butterfly (N is int, even and as a constant numerical expression)(ro.)hadamard
Hadamard matrix function of size N = 2^k
.
si.bus(N) : hadamard(N) : si.bus(N)
-
-Where:
-N
: 2^k
, size of the matrix (int, as a constant numerical expression)(ro.)recursivize
Create a recursion from two arbitrary processors p
and q
.
_,_ : recursivize(p,q) : _,_
-
-
-Where:
-p
: the forward arbitrary processorq
: the feedback arbitrary processor(ro.)bubbleSort
Sort a set of N parallel signals in ascending order on-the-fly through -the Bubble Sort algorithm.
-Mechanism: having a set of N parallel signals indexed from 0 to N - 1, -compare the first pair of signals and swap them if sig[0] > sig[1]; -repeat the pair comparison for the signals sig[1] and sig[2], then again -recursively until reaching the signals sig[N - 2] and sig[N - 1]; by the end, -the largest element in the set will be placed last; repeat the process for -the remaining N - 1 signals until there is a single pair left.
-Note that this implementation will always perform the worst-case -computation, O(n^2).
-Even though the Bubble Sort algorithm is one of the least efficient ones, -it is a useful example of how automatic sorting can be implemented at the -signal level.
-si.bus(N) : bubbleSort(N) : si.bus(N)
-
-
-Where:
-N
: the number of signals to be sorted (must be an int >= 0, as a constant numerical expression)Welcome to the documentation for routes.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Welcome to the documentation for sf.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of basic elements to handle signals in Faust. Its official prefix is si
.
(si.)bus
Put N cables in parallel.
-bus
is a standard Faust function.
bus(N)
-bus(4) : _,_,_,_
-
-Where:
-N
: is an integer known at compile time that indicates the number of parallel cables(si.)block
Block - terminate N signals.
-block
is a standard Faust function.
si.bus(N) : block(N)
-
-Where:
-N
: the number of signals to be blocked known at compile time (si.)interpolate
Linear interpolation between two signals.
-_,_ : interpolate(i) : _
-
-Where:
-i
: interpolation control between 0 and 1 (0: first input; 1: second input)(si.)repeat
Repeat an effect N time(s) and take the parallel sum of all -intermediate buses.
-si.bus(inputs(FX)) : repeat(N, FX) : si.bus(outputs(FX))
-
-Where:
-N
: Number of repetitions, minimum of 1, a constant numerical expression FX
: an arbitrary effect (N inputs and N outputs) that will be repeatedExample 1:
-process = repeat(2, dm.zita_light) : _*.5,_*.5;
-
-Example 2:
-N = 4;
-C = 2;
-fx(i) = i+1, par(j, C, @(i*5000));
-process = 0, si.bus(C) : repeat(N, fx) : !, par(i, C, _*.2/N);
-
-(si.)smoo
Smoothing function based on smooth
ideal to smooth UI signals
-(sliders, etc.) down. Approximately, this is a 7 Hz one-pole
-low-pass considering the coefficient calculation:
- exp(-2pi*CF/SR).
smoo
is a standard Faust function.
hslider(...) : smoo;
-
-(si.)polySmooth
A smoothing function based on smooth
that doesn't smooth when a
-trigger signal is given. This is very useful when making
-polyphonic synthesizer to make sure that the value of the parameter
-is the right one when the note is started.
hslider(...) : polySmooth(g,s,d) : _
-
-Where:
-g
: the gate/trigger signal used when making polyphonic synthss
: the smoothness (see smooth
)d
: the number of samples to wait before the signal start being
- smoothed after g
switched to 1(si.)smoothAndH
A smoothing function based on smooth
that holds its output
-signal when a trigger is sent to it. This feature is convenient
-when implementing polyphonic instruments to prevent some
-smoothed parameter to change when a note-off event is sent.
hslider(...) : smoothAndH(g,s) : _
-
-Where:
-g
: the hold signal (0 for hold, 1 for bypass)s
: the smoothness (see smooth
)(si.)bsmooth
Block smooth linear interpolation during a block of samples (given by the ma.BS
value).
hslider(...) : bsmooth : _
-
-(si.)dot
Dot product for two vectors of size N.
-si.bus(N), si.bus(N) : dot(N) : _
-
-Where:
-N
: size of the vectors (int, must be known at compile time)(si.)smooth
Exponential smoothing by a unity-dc-gain one-pole lowpass.
-smooth
is a standard Faust function.
_ : si.smooth(ba.tau2pole(tau)) : _
-
-Where:
-tau
: desired smoothing time constant in seconds, orhslider(...) : smooth(s) : _
-
-Where:
-s
: smoothness between 0 and 1. s=0 for no smoothing, s=0.999 is "very smooth",
-s>1 is unstable, and s=1 yields the zero signal for all inputs.
-The exponential time-constant is approximately 1/(1-s) samples, when s is close to
-(but less than) 1.(si.)smoothq
Smoothing with continuously variable curves from Exponential to Linear, with a constant time.
-_ : smoothq(time, q) : _;
-
-Where:
-time
: seconds to reach targetq
: curve shape (between 0..1, 0 is Exponential, 1 is Linear)(si.)cbus
N parallel cables for complex signals.
-cbus
is a standard Faust function.
cbus(N)
-cbus(4) : (r0,i0), (r1,i1), (r2,i2), (r3,i3)
-
-Where:
-N
: is an integer known at compile time that indicates the number of parallel cables.(si.)cmul
Multiply two complex signals pointwise.
-cmul
is a standard Faust function.
(r1,i1) : cmul(r2,i2) : (_,_)
-
-Where:
-(r1,i1)
= real and imaginary parts of signal 1(r2,i2)
= real and imaginary parts of signal 2(si.)cconj
Complex conjugation of a (complex) signal.
-cconj
is a standard Faust function.
(r1,i1) : cconj : (_,_)
-
-Where:
-(r1,i1)
= real and imaginary parts of the input signal(r1,-i1)
= real and imaginary parts of the output signal(si.)onePoleSwitching
One pole filter with independent attack and release times.
-_ : onePoleSwitching(att,rel) : _
-
-Where:
-att
: the attack tau time constant in secondrel
: the release tau time constant in second(si.)rev
Reverse the input signal by blocks of n>0 samples. rev(1)
is the indentity
-function. rev(n)
has a latency of n-1
samples.
_ : rev(n) : _
-
-Where:
-n
: the block size in samples(si.)vecOp
This function is a generalisation of Faust's iterators such as prod
and
-sum
, and it allows to perform operations on an arbitrary number of
-vectors, provided that they all have the same length. Unlike Faust's
-iterators prod
and sum
where the vector size is equal to one and the
-vector space dimension must be specified by the user, this function will
-infer the vector space dimension and vector size based on the vectors list
-that we provide.
The outputs of the function are equal to the vector size, whereas the -number of inputs is dependent on whether the elements of the vectors -provided expect an incoming signal themselves or not. We will see a -clarifying example later; in general, the number of total inputs will -be the sum of the inputs in each input vector.
-Note that we must provide a list of at least two vectors, each with a size -that is greater or equal to one.
- si.bus(inputs(vectorsList)) : vecOp((vectorsList), op) : si.bus(outputs(ba.take(1, vectorsList)));
-
-vectorsList
: is a list of vectorsop
: is a two-input, one-output operatorFor example, consider the following vectors lists:
- v0 = (0 , 1 , 2 , 3);
- v1 = (4 , 5 , 6 , 7);
- v2 = (8 , 9 , 10 , 11);
- v3 = (12 , 13 , 14 , 15);
- v4 = (+(16) , _ , 18 , *(19));
- vv = (v0 , v1 , v2 , v3);
-
-Although Faust has limitations for list processing, these vectors can be -combined or processed individually.
-If we do:
- process = vecOp(v0, +);
-
-the function will deduce a vector space of dimension equal to four and -a vector length equal to one. Note that this is equivalent to writing:
- process = v0 : sum(i, 4, _);
-
-Similarly, we can write:
- process = vecOp((v0 , v1), *) :> _;
-
-and we have a dimension-two space and length-four vectors. This is the dot -product between vectors v0 and v1, which is equivalent to writing:
- process = v0 , v1 : dot(4);
-
-The examples above have no inputs, as none of the elements of the vectors -expect inputs. On the other hand, we can write:
- process = vecOp((v4 , v4), +);
-
-and the function will have six inputs and four outputs, as each vector -has three of the four elements expecting an input, times two, as the two -input vectors are identical.
-Finally, we can write:
- process = vecOp(vv, &);
-
-to perform the bitwise AND on all the elements at the same position in -each vector, having dimension equal to the vector length equal to four.
-Or even:
- process = vecOp((vv , vv), &);
-
-which gives us a dimension equal to two, and a vector size equal to sixteen.
-For a more practical use-case, this is how we can implement a time-invariant -feedback delay network with Hadamard matrix:
- N = 4;
- normalisation = 1.0 / sqrt(N);
- coeffVec = par(i, N, .99 * normalisation);
- delVec = par(i, N, (i + 1) * 3);
- process = vecOp((si.bus(N) , si.bus(N)), +) ~
- vecOp((vecOp((ro.hadamard(N) , coeffVec), *) , delVec), @);
-
-(si.)bpar
Balanced par
where the repeated expression doesn't depend on a variable.
-The built-in par
is implemented as an unbalanced tree, and also has
-to substitute the variable into the repeated expression, which is expensive
-even when the variable doesn't appear. This version is implemented as a
-balanced tree (which allows node reuse during tree traversal) and also
-doesn't search for the variable. This can be much faster than par
to compile.
si.bus(N * inputs(f)) : bpar(N, f) : si.bus(N * outputs(f))
-
-Where:
-N
: number of repetitions, minimum 1, a constant numerical expressionf
: an arbitrary expressionExample:
-// square each of 4000 inputs
-process = si.bpar(4000, (_ <: _, _ : *));
-
-(si.)bsum
Balanced sum
, see si.bpar
.
si.bus(N * inputs(f)) : bsum(N, f) : _
-
-Where:
-N
: number of repetitions, minimum 1, a constant numerical expressionf
: an arbitrary expression with 1 output.Example:
-// square each of 1000 inputs and add the results
-process = si.bsum(1000, (_ <: _, _ : *));
-
-(si.)bprod
Balanced prod
, see si.bpar
.
si.bus(N * inputs(f)) : bprod(N, f) : _
-
-Where:
-N
: number of repetitions, minimum 1, a constant numerical expressionf
: an arbitrary expression with 1 output.Example:
-// Add 8000 consecutive inputs (in pairs) and multiply the results
-process = si.bprod(4000, +);
-
Welcome to the documentation for signals.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library to handle soundfiles in Faust. Its official prefix is so
.
(so.)loop
Play a soundfile in a loop taking into account its sampling rate.
-loop
is a standard Faust function.
loop(sf, part) : si.bus(outputs(sf))
-
-Where:
-sf
: the soundfilepart
: the part in the soundfile list of sounds(so.)loop_speed
Play a soundfile in a loop taking into account its sampling rate, with speed control.
-loop_speed
is a standard Faust function.
loop_speed(sf, part, speed) : si.bus(outputs(sf))
-
-Where:
-sf
: the soundfilepart
: the part in the soundfile list of soundsspeed
: the speed between 0 and n(so.)loop_speed_level
Play a soundfile in a loop taking into account its sampling rate, with speed and level controls.
-loop_speed_level
is a standard Faust function.
loop_speed_level(sf, part, speed, level) : si.bus(outputs(sf))
-
-Where:
-sf
: the soundfilepart
: the part in the soundfile list of soundsspeed
: the speed between 0 and nlevel
: the volume between 0 and nWelcome to the documentation for soundfiles.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a collection of tools for sound spatialization.
-Its official prefix is sp
.
(sp.)panner
A simple linear stereo panner.
-panner
is a standard Faust function.
_ : panner(g) : _,_
-
-Where:
-g
: the panning (0-1)(sp.)constantPowerPan
Apply the constant power pan rule to a stereo signal. -The channels are not respatialized. Their gains are simply -adjusted. A pan of 0 preserves the left channel and silences -the right channel. A pan of 1 has the opposite effect. -A pan value of 0.5 applies a gain of 0.5 to both channels.
-_,_ : constantPowerPan(p) : _,_
-
-Where:
-p
: the panning (0-1)(sp.)spat
GMEM SPAT: n-outputs spatializer.
-spat
is a standard Faust function.
_ : spat(N,r,d) : si.bus(N)
-
-Where:
-N
: number of outputs (a constant numerical expression)r
: rotation (between 0 et 1)d
: distance of the source (between 0 et 1)(sp.)stereoize
Transform an arbitrary processor p
into a stereo processor with 2 inputs
-and 2 outputs.
_,_ : stereoize(p) : _,_
-
-Where:
-p
: the arbitrary processorWelcome to the documentation for spats.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-The purpose of this library is to give access to all the Faust standard libraries -through a series of environments.
Welcome to the documentation for stdfaust.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library contains a collection of synthesizers. Its official prefix is sy
.
(sy.)popFilterDrum
A simple percussion instrument based on a "popped" resonant bandpass filter.
-popFilterDrum
is a standard Faust function.
popFilterDrum(freq,q,gate) : _
-
-Where:
-freq
: the resonance frequency of the instrument in Hzq
: the q of the res filter (typically, 5 is a good value)gate
: the trigger signal (0 or 1)(sy.)dubDub
A simple synth based on a sawtooth wave filtered by a resonant lowpass.
-dubDub
is a standard Faust function.
dubDub(freq,ctFreq,q,gate) : _
-
-Where:
-freq
: frequency of the sawtooth in HzctFreq
: cutoff frequency of the filterq
: Q of the filtergate
: the trigger signal (0 or 1)(sy.)sawTrombone
A simple trombone based on a lowpassed sawtooth wave.
-sawTrombone
is a standard Faust function.
sawTrombone(freq,gain,gate) : _
-
-Where:
-freq
: the frequency in Hzgain
: the gain (0-1)gate
: the gate (0 or 1)(sy.)combString
Simplest string physical model ever based on a comb filter.
-combString
is a standard Faust function.
combString(freq,res,gate) : _
-
-Where:
-freq
: the frequency of the string in Hzres
: string T60 (resonance time) in secondgate
: trigger signal (0 or 1)(sy.)additiveDrum
A simple drum using additive synthesis.
-additiveDrum
is a standard Faust function.
additiveDrum(freq,freqRatio,gain,harmDec,att,rel,gate) : _
-
-Where:
-freq
: the resonance frequency of the drum in HzfreqRatio
: a list of ratio to choose the frequency of the mode in
- function of freq
e.g.(1 1.2 1.5 ...). The first element should always
- be one (fundamental).gain
: the gain of each mode as a list (1 0.9 0.8 ...). The first element
- is the gain of the fundamental.harmDec
: harmonic decay ratio (0-1): configure the speed at which
- higher modes decay compare to lower modes.att
: attack duration in secondrel
: release duration in secondgate
: trigger signal (0 or 1)(sy.)fm
An FM synthesizer with an arbitrary number of modulators connected as a sequence.
-fm
is a standard Faust function.
freqs = (300,400,...);
-indices = (20,...);
-fm(freqs,indices) : _
-
-Where:
-freqs
: a list of frequencies where the first one is the frequency of the carrier
- and the others, the frequency of the modulator(s)indices
: the indices of modulation (Nfreqs-1)Drum Synthesis ported in Faust from a version written in Elementary -and JavaScript by Nick Thompson.
-(sy.)kick
Kick drum synthesis via a pitched sine sweep.
-kick(pitch, click, attack, decay, drive, gate) : _
-
-Where:
-pitch
: the base frequency of the kick drum in Hzclick
: the speed of the pitch envelope, tuned for [0.005s, 1s]attack
: attack time in seconds, tuned for [0.005s, 0.4s]decay
: decay time in seconds, tuned for [0.005s, 4.0s]drive
: a gain multiplier going into the saturator. Tuned for [1, 10]gate
: the gate which triggers the amp envelope(sy.)clap
Clap synthesis via filtered white noise.
-clap(tone, attack, decay, gate) : _
-
-Where:
-tone
: bandpass filter cutoff frequency, tuned for [400Hz, 3500Hz]attack
: attack time in seconds, tuned for [0s, 0.2s]decay
: decay time in seconds, tuned for [0s, 4.0s]gate
: the gate which triggers the amp envelope(sy.)hat
Hi hat drum synthesis via phase modulation.
-hat(pitch, tone, attack, decay, gate): _
-
-Where:
-pitch
: base frequency in the range [317Hz, 3170Hz]tone
: bandpass filter cutoff frequency, tuned for [800Hz, 18kHz]attack
: attack time in seconds, tuned for [0.005s, 0.2s]decay
: decay time in seconds, tuned for [0.005s, 4.0s]gate
: the gate which triggers the amp envelopeWelcome to the documentation for synths.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Welcome to the documentation for tonestacks.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Welcome to the documentation for tubes.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of virtual analog filter effects. Its official prefix is ve
.
(ve.)moog_vcf
Moog "Voltage Controlled Filter" (VCF) in "analog" form. Moog VCF
-implemented using the same logical block diagram as the classic
-analog circuit. As such, it neglects the one-sample delay associated
-with the feedback path around the four one-poles.
-This extra delay alters the response, especially at high frequencies
-(see reference [1] for details).
-See moog_vcf_2b
below for a more accurate implementation.
_ : moog_vcf(res,fr) : _
-
-Where:
-res
: normalized amount of corner-resonance between 0 and 1
-(0 is no resonance, 1 is maximum)fr
: corner-resonance frequency in Hz (less than SR/6.3 or so)(ve.)moog_vcf_2b[n]
Moog "Voltage Controlled Filter" (VCF) as two biquads. Implementation
-of the ideal Moog VCF transfer function factored into second-order
-sections. As a result, it is more accurate than moog_vcf
above, but
-its coefficient formulas are more complex when one or both parameters
-are varied. Here, res is the fourth root of that in moog_vcf
, so, as
-the sampling rate approaches infinity, moog_vcf(res,fr)
becomes equivalent
-to moog_vcf_2b[n](res^4,fr)
(when res and fr are constant).
-moog_vcf_2b
uses two direct-form biquads (tf2
).
-moog_vcf_2bn
uses two protected normalized-ladder biquads (tf2np
).
_ : moog_vcf_2b(res,fr) : _
-_ : moog_vcf_2bn(res,fr) : _
-
-Where:
-res
: normalized amount of corner-resonance between 0 and 1
- (0 is min resonance, 1 is maximum)fr
: corner-resonance frequency in Hz(ve.)moogLadder
Virtual analog model of the 4th-order Moog Ladder, which is arguably the -most well-known ladder filter in analog synthesizers. Several -1st-order filters are cascaded in series. Feedback is then used, in part, to -control the cut-off frequency and the resonance.
-[Zavalishin 2012] (revision 2.1.2, February 2020):
- -This fix is based on Lorenzo Della Cioppa's correction to Pirkle's implementation; see this post: -https://www.kvraudio.com/forum/viewtopic.php?f=33&t=571909
-_ : moogLadder(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: quality factor between .707 (0 feedback coefficient) to 25 (feedback = 4, which is the self-oscillating threshold).(ve.)moogHalfLadder
Virtual analog model of the 2nd-order Moog Half Ladder (simplified version of
-(ve.)moogLadder
). Several 1st-order filters are cascaded in series.
-Feedback is then used, in part, to control the cut-off frequency and the
-resonance.
This filter was implemented in Faust by Eric Tarr during the -2019 Embedded DSP With Faust Workshop.
-_ : moogHalfLadder(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)diodeLadder
4th order virtual analog diode ladder filter. In addition to the individual
-states used within each independent 1st-order filter, there are also additional
-feedback paths found in the block diagram. These feedback paths are labeled
-as connecting states. Rather than separately storing these connecting states
-in the Faust implementation, they are simply implicitly calculated by
-tracing back to the other states (s1
,s2
,s3
,s4
) each recursive step.
This filter was implemented in Faust by Eric Tarr during the -2019 Embedded DSP With Faust Workshop.
-_ : diodeLadder(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: qThe following filters are virtual analog models of the Korg 35 low-pass -filter and high-pass filter found in the MS-10 and MS-20 synthesizers. -The virtual analog models for the LPF and HPF are different, making these -filters more interesting than simply tapping different states of the same -circuit.
-These filters were implemented in Faust by Eric Tarr during the -2019 Embedded DSP With Faust Workshop.
-(ve.)korg35LPF
Virtual analog models of the Korg 35 low-pass filter found in the MS-10 and -MS-20 synthesizers.
-_ : korg35LPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)korg35HPF
Virtual analog models of the Korg 35 high-pass filter found in the MS-10 and -MS-20 synthesizers.
-_ : korg35HPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: qThe following filter (4 types) is an implementation of the virtual analog -model described in Section 7.2 of the Will Pirkle book, "Designing Software -Synthesizer Plug-ins in C++". It is based on the block diagram in Figure 7.5.
-The Oberheim filter is a state-variable filter with soft-clipping distortion -within the circuit.
-In many VA filters, distortion is accomplished using the "tanh" function.
-For this Faust implementation, that distortion function was replaced with
-the (ef.)cubicnl
function.
(ve.)oberheim
Generic multi-outputs Oberheim filter that produces the BSF, BPF, HPF and LPF outputs (see description above).
-_ : oberheim(normFreq,Q) : _,_,_,_
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)oberheimBSF
Band-Stop Oberheim filter (see description above). -Specialize the generic implementation: keep the first BSF output, -the compiler will only generate the needed code.
-_ : oberheimBSF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)oberheimBPF
Band-Pass Oberheim filter (see description above). -Specialize the generic implementation: keep the second BPF output, -the compiler will only generate the needed code.
-_ : oberheimBPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)oberheimHPF
High-Pass Oberheim filter (see description above). -Specialize the generic implementation: keep the third HPF output, -the compiler will only generate the needed code.
-_ : oberheimHPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)oberheimLPF
Low-Pass Oberheim filter (see description above). -Specialize the generic implementation: keep the fourth LPF output, -the compiler will only generate the needed code.
-_ : oberheimLPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: qThe following filters were implemented based on VA models of synthesizer -filters.
-The modeling approach is based on a Topology Preserving Transform (TPT) to -resolve the delay-free feedback loop in the corresponding analog filters.
-The primary processing block used to build other filters (Moog, Korg, etc.) is -based on a 1st-order Sallen-Key filter.
-The filters included in this script are 1st-order LPF/HPF and 2nd-order -state-variable filters capable of LPF, HPF, and BPF.
-(ve.)sallenKeyOnePole
Sallen-Key generic One Pole filter that produces the LPF and HPF outputs (see description above).
-For the Faust implementation of this filter, recursion (letrec
) is used
-for storing filter "states". The output (e.g. y
) is calculated by using
-the input signal and the previous states of the filter.
-During the current recursive step, the states of the filter (e.g. s
) for
-the next step are also calculated.
-Admittedly, this is not an efficient way to implement a filter because it
-requires independently calculating the output and each state during each
-recursive step. However, it works as a way to store and use "states"
-within the constraints of Faust.
-The simplest example is the 1st-order LPF (shown on the cover of Zavalishin
-* 2018 and Fig 4.3 of https://www.willpirkle.com/706-2/). Here, the input
-signal is split in parallel for the calculation of the output signal, y
, and
-the state s
. The value of the state is only used for feedback to the next
-step of recursion. It is blocked (!) from also being routed to the output.
-A trick used for calculating the state s
is to observe that the input to
-the delay block is the sum of two signal: what appears to be a feedforward
-path and a feedback path. In reality, the signals being summed are identical
-(signal*2) plus the value of the current state.
_ : sallenKeyOnePole(normFreq) : _,_
-
-Where:
-normFreq
: normalized frequency (0-1)(ve.)sallenKeyOnePoleLPF
Sallen-Key One Pole lowpass filter (see description above). -Specialize the generic implementation: keep the first LPF output, -the compiler will only generate the needed code.
-_ : sallenKeyOnePoleLPF(normFreq) : _
-
-Where:
-normFreq
: normalized frequency (0-1)(ve.)sallenKeyOnePoleHPF
Sallen-Key One Pole Highpass filter (see description above). The dry input -signal is routed in parallel to the output. The LPF'd signal is subtracted -from the input so that the HPF remains. -Specialize the generic implementation: keep the second HPF output, -the compiler will only generate the needed code.
-_ : sallenKeyOnePoleHPF(normFreq) : _
-
-Where:
-normFreq
: normalized frequency (0-1)(ve.)sallenKey2ndOrder
Sallen-Key generic 2nd order filter that produces the LPF, BPF and HPF outputs.
-This is a 2nd-order Sallen-Key state-variable filter. The idea is that by -"tapping" into different points in the circuit, different filters -(LPF,BPF,HPF) can be achieved. See Figure 4.6 of -* https://www.willpirkle.com/706-2/
-This is also a good example of the next step for generalizing the Faust
-programming approach used for all these VA filters. In this case, there are
-three things to calculate each recursive step (y
,s1
,s2
). For each thing, the
-circuit is only calculated up to that point.
Comparing the LPF to BPF, the output signal (y
) is calculated similarly.
-Except, the output of the BPF stops earlier in the circuit. Similarly, the
-states (s1
and s2
) only differ in that s2
includes a couple more terms
-beyond what is used for s1
.
_ : sallenKey2ndOrder(normFreq,Q) : _,_,_
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)sallenKey2ndOrderLPF
Sallen-Key 2nd order lowpass filter (see description above). -Specialize the generic implementation: keep the first LPF output, -the compiler will only generate the needed code.
-_ : sallenKey2ndOrderLPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)sallenKey2ndOrderBPF
Sallen-Key 2nd order bandpass filter (see description above). -Specialize the generic implementation: keep the second BPF output, -the compiler will only generate the needed code.
-_ : sallenKey2ndOrderBPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)sallenKey2ndOrderHPF
Sallen-Key 2nd order highpass filter (see description above). -Specialize the generic implementation: keep the third HPF output, -the compiler will only generate the needed code.
-_ : sallenKey2ndOrderHPF(normFreq,Q) : _
-
-Where:
-normFreq
: normalized frequency (0-1)Q
: q(ve.)wah4
Wah effect, 4th order.
-wah4
is a standard Faust function.
_ : wah4(fr) : _
-
-Where:
-fr
: resonance frequency in Hz(ve.)autowah
Auto-wah effect.
-autowah
is a standard Faust function.
_ : autowah(level) : _
-
-Where:
-level
: amount of effect desired (0 to 1).(ve.)crybaby
Digitized CryBaby wah pedal.
-crybaby
is a standard Faust function.
_ : crybaby(wah) : _
-
-Where:
-wah
: "pedal angle" from 0 to 1(ve.)vocoder
A very simple vocoder where the spectrum of the modulation signal
-is analyzed using a filter bank.
-vocoder
is a standard Faust function.
_ : vocoder(nBands,att,rel,BWRatio,source,excitation) : _
-
-Where:
-nBands
: Number of vocoder bandsatt
: Attack time in secondsrel
: Release time in secondsBWRatio
: Coefficient to adjust the bandwidth of each band (0.1 - 2)source
: Modulation signalexcitation
: Excitation/Carrier signalWelcome to the documentation for vaeffects.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-Semantic versioning for the Faust libraries. Its official prefix is vl
.
(vl.)version
Return the version number of the Faust standard libraries as a MAJOR, MINOR, PATCH versioning triplet.
-version : _,_,_
-
Welcome to the documentation for version.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-A library of basic adaptors and methods to help construct Wave Digital Filter models in Faust. Its official prefix is wd
.
This library is intended for use for creating Wave Digital (WD) based models of audio circuitry for real-time audio processing within the Faust programming language. The goal is to provide a framework to create real-time virtual-analog audio effects and synthesizers using WD models without the use of C++. Furthermore, we seek to provide access to the technique of WD modeling to those without extensive knowledge of advanced digital signal processing techniques. Finally, we hope to provide a library which can integrate with all aspects of Faust, thus creating a platform for virtual circuit bending. -The library itself is written in Faust to maintain portability.
-This library is heavily based on Kurt Werner's Dissertation, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters." I have tried to maintain consistent notation between the adaptors appearing within thesis and my adaptor code. The majority of the adaptors found in chapter 1 and chapter 3 are currently supported.
-For inquires about use of this library in a commercial product, please contact dirk [dot] roosenburg [dot] 30 [at] gmail [dot] com. -This documentation is taken directly from the readme. Please refer to it for a more updated version.
-Many of the more in depth comments within the library include jargon. I plan to create videos detailing the theory of WD models.
-For now I recommend Kurt Werner's PhD, Virtual analog modeling of Audio circuitry using Wave Digital Filters.
-I have tried to maintain consistent syntax and notation to the thesis.
-This library currently includes the majority of the adaptors covered in chapter 1 and some from chapter 3.
Use of this library expects some level of familiarity with WDF techniques, especially simplification and decomposition of electronic circuits into WDF connection trees. I plan to create video to cover both these techniques and use of the library.
-To get a quick overview of the library, start with the secondOrderFilters.dsp
code found in examples.
-Note that the wdmodels.lib
library is now embedded in the online Faust IDE.
Creating a model using this library consists fo three steps. First, declare a set of components. -Second, model the relationship between them using a tree. Finally, build the tree using the libraries build functions.
-First, a set of components is declared using adaptors from the library. -This list of components is created based on analysis of the circuit using WDF techniques, -though generally each circuit element (resistor, capacitor, diode, etc.) can be expected to appear -within the component set. For example, first order RC lowpass filter would require an unadapted voltage source, -a 47k resistor, and a 10nF capacitor which outputs the voltage across itself. These can be declared with:
-vs1(i) = wd.u_voltage(i, no.noise);
-r1(i) = wd.resistor(i, 47*10^3);
-c1(i) = wd.capacitor_Vout(i, 10*10^-9);
-
-Note that the first argument, i, is left un-parametrized. Components must be declared in this form, as the build algorithm expects to receive adaptors which have exactly one parameter.
-Also note that we have chosen to declare a white noise function as the input to our voltage source. -We could potentially declare this as a direct input to our model, but to do so is more complicated -process which cannot be covered within this tutorial. For information on how to do this see -Declaring Model Parameters as Inputs or see various implementations -in examples.
-Second, the declared components and interconnection/structural adaptors (i.e. series, parallel, etc) are arranged -into the connection tree which is produced from performing WD analysis on the modeled circuit. -For example, to produce our first order RC lowpass circuit model, the following tree is declared:
-tree_lowpass = vs1 : wd.series : (r1, c1);
For more information on how to represent trees in Faust, see Trees in Faust.
-Finally, the tree is built using the the buildtree
function. To build and compute our first order
-RC lowpass circuit model, we use:
process = wd.buildtree(tree_lowpass);
More information about build functions, see Model Building Functions.
-After creating a connection tree which consists of WD adaptors, the connection tree must be passed -to a build function in order to build the model.
-buildtree(connection_tree)
The simplest build function for use with basic models. This automatically implements buildup
, builddown
,
-and buildout
to create a working model. However, it gives minimum control to the user and cannot
-currently be used on trees which have parameters declared as inputs.
Wave Digital Filters are an explicit state-space model, meaning they use a previous system state
-in order to calculate the current output. This is achieved in Faust by using a single global feedback operator.
-The models feed-forward terms are generated using builddown
and the models feedback terms are generated
-using buildup
. Thus, the most common model implementation (the method used by buildtree
) is:
builddown(connection_tree)~buildup(connection_tree) : buildout(connection_tree)
Since the ~
operator in Faust will leave feedback terms hanging as outputs, buildout
is a function provided for convenience.
-It automatically truncates the hanging outputs by identifying leaf components which have an intended output
-and generating an output matrix.
Building the model manually allows for greater user control and is often very helpful in testing.
-Also provided for testing are the getres
and parres
functions, which can be used to determine
-the upward-facing port resistance of an element.
When possible, parameters of components should be declared explicitly, meaning they are dependent on a function with no inputs. -This might be something as simple as integer(declaring a static component), a function dependent on a UI input (declaring a component with variable value), -or even a time-dependent function like an oscillator (declaring an audio input or circuit bending).
-However, it is often necessary to declare parameters as input. To achieve this there are two possible methods. -The first and recommended option is to create a separate model function and declare parameters which will later -be implemented as inputs. This allows inputs to be explicitly declared as component parameters. -For example, one might use:
-model(in1) = buildtree(tree)
-with {
- ...
- vin(i) = wd.u_voltage(i, in1);
- ...
- tree = vin : ...;
-};
-
-In order to simulate an audio input to the circuit.
-Note that the tree and components must be declared inside a with {...}
statement, or the model's parameters will not be accessible.
The Empty signal operator, _
should NEVER be used to declare a parameter as in input in a wave-digital model.
Using it will result on breaking the internal routing of the model and thus breaks the model. -Instead, use explicit declaration as shown directly above.
-Since WD models use connection trees to represent relationships of elements, a comprehensive way to represent trees is critical. - As there is no current convention for creating trees in Faust, I've developed a method using the existing series and parallel/list -methods in Faust.
-The series operator :
is used to separate parent and child elements. For example the tree:
A
- |
- B
-
-is represented by A : B
in Faust.
To denote a parent element with multiple child elements, simply use a list (a1, a2, ... an)
of children connected to a single parent. `
-For example the tree:
A
- / \
- B C
-
-
-is represented by:
-A : (B, C)
Finally, for a tree with many levels, simply break the tree into subtrees following the above rules and connect -the subtree as if it was an individual node. For example the tree:
- A
- / \
- B C
- / / \
- X Y Z
-
-can be represented by:
-B_sub = B : X; //B subtree
-C_sub = C : (Y, Z); //C subtree
-tree = A : (B_sub, C_sub); //full tree
-
-or more simply, using parentheses:
-A : ((B : X), (C : (Y, Z)))
In wave digital filters, adaptors can be described by the form b = Sa
where b
is a vector of output waves b = (b0, b1, b2, ... bn)
, a
is a vector of input wavesa = (a0, a1, a2, ... an)
, and S
is an n x n scattering matrix.
-S
is dependent on R
, a list of port resistances (R0, R1, R2, ... Rn)
.
The output wave vector b
can be divided into downward-going and upward-going waves
-(downward-going waves travel down the connection tree, upward-going waves travel up).
-For adapted adaptors, with the zeroth port being the upward-facing port, the downward-going wave vector is (b1, b2, ... bn)
and the upward-going wave vector is (b0)
.
-For unadapted adaptors, there are no upward-going waves, so the downward-going wave vector is simply b = (b0, b1, b2, ... bn)
.
In order for adaptors to be interpretable by the compiler, they must be structured in a specific way. -Each adaptor is divided into three cases by their first parameter. This parameter, while accessible by the user, should only be set by the compiler/builder.
-All other parameters are value declarations (for components), inputs (for voltage or current ins), or parameter controls (for potentiometers/variable capacitors/variable inductors).
-(0, params) => downward-going(R1, ... Rn, a0, a1, ... an)
-outputs: (b1, b2, ... bn)
-this function takes any number of port resistances, the downward going wave, and any number of upward going waves as inputs.
-These values/waves are used to calculate the downward going waves coming from this adaptor.
(1, params) => upward-going(R1, ... Rn, a1, ... an)
-outputs : (b0)
-this function takes any number of port resistances and any number of upward going waves as inputs.
-These values/waves are used to calculate the upward going wave coming from this adaptor.
(2, params) => port-resistance(R1, ... Rn)
-outputs: (R0)
-this function takes any number of port resistances as inputs.
-These values are used to calculate the upward going port resistance of the element.
Unadapted adaptor's names will always begin u_
-An unadapted adaptor MUST be used as the root of the WD connection tree.
-Unadapted adaptors can ONLY be used as a root of the WD connection tree.
-While unadapted adaptors contain all three cases, the second and third are purely structural.
-Only the first case should contain computational information.
Expect this section to be added soon! It's currently in progress.
-Many thanks to Kurt Werner for helping me to understand wave digital filter models. Without his publications and consultations, the library would not exist. -Thanks also to my advisors, Rob Owen and Eli Stine whose input was critical to the development of the library. -Finally, thanks to Romain Michon, Stephane Letz, and the Faust Slack for contributing to testing, development, and inspiration when creating the library.
-(wd.)resistor
Adapted Resistor.
-A basic node implementing a resistor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree.
-r1(i) = resistor(i, R);
-buildtree( A : r1 );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms. Note: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
-(wd.)resistor_Vout
Adapted Resistor + voltage Out.
-A basic adaptor implementing a resistor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -The resistor will also pass the voltage across itself as an output of the model.
-rout(i) = resistor_Vout(i, R);
-buildtree( A : rout ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms. Note: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
-(wd.)resistor_Iout
Resistor + current Out.
-A basic adaptor implementing a resistor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -The resistor will also pass the current through itself as an output of the model.
-rout(i) = resistor_Iout(i, R);
-buildtree( A : rout ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the resistor being modeled in Ohms. Note: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.1
-(wd.)u_voltage
Unadapted Ideal Voltage Source.
-An adaptor implementing an ideal voltage source within Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree. -Can be used for either DC (constant) or AC (signal) voltage sources.
-v1(i) = u_Voltage(i, ein);
-buildtree( v1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.ein
: Voltage/Potential across ideal voltage source in VoltsNote: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.2
-(wd.)u_current
Unadapted Ideal Current Source.
-An unadapted adaptor implementing an ideal current source within Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree. -Can be used for either DC (constant) or AC (signal) current sources.
-i1(i) = u_current(i, jin);
-buildtree( i1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.jin
: Current through the ideal current source in AmpsNote: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.3
-(wd.)resVoltage
Adapted Resistive Voltage Source.
-An adaptor implementing a resistive voltage source within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -It is comprised of an ideal voltage source in series with a resistor. -Can be used for either DC (constant) or AC (signal) voltage sources.
-v1(i) = resVoltage(i, R, ein);
-buildtree( A : v1 );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Resistance/Impedance of the series resistor in Ohmsein
: Voltage/Potential of the ideal voltage source in VoltsNote: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
-(wd.)resVoltage_Vout
Adapted Resistive Voltage Source + voltage output.
-An adaptor implementing an adapted resistive voltage source within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -It is comprised of an ideal voltage source in series with a resistor. -Can be used for either DC (constant) or AC (signal) voltage sources. -The resistive voltage source will also pass the voltage across it as an output of the model.
-vout(i) = resVoltage_Vout(i, R, ein);
-buildtree( A : vout ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Resistance/Impedance of the series resistor in Ohmsein
: Voltage/Potential across ideal voltage source in VoltsNote: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
-(wd.)u_resVoltage
Unadapted Resistive Voltage Source.
-An unadapted adaptor implementing a resistive voltage source within Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree. -It is comprised of an ideal voltage source in series with a resistor. -Can be used for either DC (constant) or AC (signal) voltage sources.
-v1(i) = u_resVoltage(i, R, ein);
-buildtree( v1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Resistance/Impedance of the series resistor in Ohmsein
: Voltage/Potential across ideal voltage source in VoltsNote: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.4
-(wd.)resCurrent
Adapted Resistive Current Source.
-An adaptor implementing a resistive current source within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -It is comprised of an ideal current source in parallel with a resistor. -Can be used for either DC (constant) or AC (signal) current sources.
-i1(i) = resCurrent(i, R, jin);
-buildtree( A : i1 );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the parallel resistor in Ohmsjin
: Current through the ideal current source in AmpsNote: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.5
-(wd.)u_resCurrent
Unadapted Resistive Current Source.
-An unadapted adaptor implementing a resistive current source within Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree. -It is comprised of an ideal current source in parallel with a resistor. -Can be used for either DC (constant) or AC (signal) current sources.
-i1(i) = u_resCurrent(i, R, jin);
-buildtree( i1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Resistance/Impedance of the series resistor in Ohmsjin
: Current through the ideal current source in AmpsNote: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.5
-(wd.)u_switch
Unadapted Ideal Switch.
-An unadapted adaptor implementing an ideal switch for Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree
-s1(i) = u_resCurrent(i, lambda);
-buildtree( s1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declared.lambda
: switch state control. -1 for closed switch, 1 for open switch.Note: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.2.8
-(wd.)capacitor
Adapted Capacitor.
-A basic adaptor implementing a capacitor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -This capacitor model was digitized using the bi-linear transform.
-c1(i) = capacitor(i, R);
-buildtree( A : c1 ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declared.R
: Capacitance/Impedance of the capacitor being modeled in Farads. Note: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.1
-(wd.)capacitor_Vout
Adapted Capacitor + voltage out.
-A basic adaptor implementing a capacitor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -The capacitor will also pass the voltage across itself as an output of the model. -This capacitor model was digitized using the bi-linear transform.
-cout(i) = capacitor_Vout(i, R);
-buildtree( A : cout ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Capacitance/Impedence of the capacitor being modeled in FaradsNote: the adaptor must be declared as a seperate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.1
-(wd.)inductor
Unadapted Inductor.
-A basic adaptor implementing an inductor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -This inductor model was digitized using the bi-linear transform.
-l1(i) = inductor(i, R);
-buildtree( A : l1 );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Inductance/Impedance of the inductor being modeled in HenriesNote: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.2
-(wd.)inductor_Vout
Unadapted Inductor + Voltage out.
-A basic adaptor implementing an inductor for use within Wave Digital Filter connection trees.
-It should be used as a leaf/terminating element of the connection tree. -The inductor will also pass the voltage across itself as an output of the model. -This inductor model was digitized using the bi-linear transform.
-lout(i) = inductor_Vout(i, R);
-buildtree( A : lout ) : _
-
-Where:
-i
: index used by model-building functions. Should never be user declaredR
: Inductance/Impedance of the inductor being modeled in HenriesNote: the adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.3.2
-(wd.)u_idealDiode
Unadapted Ideal Diode.
-An unadapted adaptor implementing an ideal diode for Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree.
-buildtree( u_idealDiode : B );
-
-Note: only usable as the root of a tree. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 3.2.3
-(wd.)u_chua
Unadapted Chua Diode.
-An adaptor implementing the chua diode / non-linear resistor within Wave Digital Filter connection trees.
-It should be used as the root/top element of the connection tree.
-chua1(i) = u_chua(i, G1, G2, V0);
-buildtree( chua1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredG1
: resistance parameter 1 of the chua diodeG2
: resistance parameter 2 of the chua diodeV0
: voltage parameter of the chua diodeNote: only usable as the root of a tree. -The adaptor must be declared as a separate function before integration into the connection tree. -Correct implementation is shown above.
-Meerkotter and Scholz, "Digital Simulation of Nonlinear Circuits by Wave Digital Filter Principles"
-(wd.)lambert
An implementation of the lambert function. -It uses Halley's method of iteration to approximate the output. -Included in the WD library for use in non-linear diode models. -Adapted from K M Brigg's c++ lambert function approximation.
-lambert(n, itr) : _
-
-Where:
-* n
: value at which the lambert function will be evaluated
-* itr
: number of iterations before output
(wd.)u_diodePair
Unadapted pair of diodes facing in opposite directions.
-An unadapted adaptor implementing two antiparallel diodes for Wave Digital Filter connection trees. -The behavior is approximated using Schottkey's ideal diode law.
-d1(i) = u_diodePair(i, Is, Vt);
-buildtree( d1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredIs
: saturation current of the diodesVt
: thermal resistances of the diodesNote: only usable as the root of a tree. -Correct implementation is shown above.
-K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
-(wd.)u_diodeSingle
Unadapted single diode.
-An unadapted adaptor implementing a single diode for Wave Digital Filter connection trees. -The behavior is approximated using Schottkey's ideal diode law.
-d1(i) = u_diodeSingle(i, Is, Vt);
-buildtree( d1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredIs
: saturation current of the diodesVt
: thermal resistances of the diodesNote: only usable as the root of a tree. -Correct implementation is shown above.
-K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
-(wd.)u_diodeAntiparallel
Unadapted set of antiparallel diodes with M diodes facing forwards and N diodes facing backwards.
-An unadapted adaptor implementing antiparallel diodes for Wave Digital Filter connection trees. -The behavior is approximated using Schottkey's ideal diode law.
-d1(i) = u_diodeAntiparallel(i, Is, Vt);
-buildtree( d1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredIs
: saturation current of the diodesVt
: thermal resistances of the diodesNote: only usable as the root of a tree. -Correct implementation is shown above.
-K. Werner et al. "An Improved and Generalized Diode Clipper Model for Wave Digital Filters"
-(wd.)u_parallel2Port
Unadapted 2-port parallel connection.
-An unadapted adaptor implementing a 2-port parallel connection between adaptors for Wave Digital Filter connection trees. -Elements connected to this adaptor will behave as if connected in parallel in circuit.
-buildtree( u_parallel2Port : (A, B) );
-
-Note: only usable as the root of a tree. -This adaptor has no user-accessible parameters. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
-(wd.)parallel2Port
Adapted 2-port parallel connection.
-An adaptor implementing a 2-port parallel connection between adaptors for Wave Digital Filter connection trees. -Elements connected to this adaptor will behave as if connected in parallel in circuit.
-buildtree( A : parallel2Port : B );
-
-Note: this adaptor has no user-accessible parameters. -It should be used within the connection tree with one previous and one forward adaptor. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
-(wd.)u_series2Port
Unadapted 2-port series connection.
-An unadapted adaptor implementing a 2-port series connection between adaptors for Wave Digital Filter connection trees. -Elements connected to this adaptor will behave as if connected in series in circuit.
-buildtree( u_series2Port : (A, B) );
-
-Note: only usable as the root of a tree. -This adaptor has no user-accessible parameters. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
-(wd.)series2Port
Adapted 2-port series connection.
-An adaptor implementing a 2-port series connection between adaptors for Wave Digital Filter connection trees. -Elements connected to this adaptor will behave as if connected in series in circuit.
-buildtree( A : series2Port : B );
-
-Note: this adaptor has no user-accessible parameters. -It should be used within the connection tree with one previous and one forward adaptor. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.1
-(wd.)parallelCurrent
Adapted 2-port parallel connection + ideal current source.
-An adaptor implementing a 2-port series connection and internal idealized current source between adaptors for Wave Digital Filter connection trees. -This adaptor connects the two connected elements and an additional ideal current source in parallel.
-i1(i) = parallelCurrent(i, jin);
-buildtree(A : i1 : B);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredjin
: Current through the ideal current source in AmpsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It should be used within a connection tree with one previous and one forward adaptor. -Correct implementation is shown above.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.2
-(wd.)seriesVoltage
Adapted 2-port series connection + ideal voltage source.
-An adaptor implementing a 2-port series connection and internal ideal voltage source between adaptors for Wave Digital Filter connection trees. -This adaptor connects the two connected adaptors and an additional ideal voltage source in series.
-v1(i) = seriesVoltage(i, vin)
-buildtree( A : v1 : B );
-
-Where:
-i
: index used by model-building functions. Should never be user declaredvin
: voltage across the ideal current source in VoltsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It should be used within the connection tree with one previous and one forward adaptor.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.2
-(wd.)u_transformer
Unadapted ideal transformer.
-An adaptor implementing an ideal transformer for Wave Digital Filter connection trees. -The first downward-facing port corresponds to the primary winding connections, and the second downward-facing port to the secondary winding connections.
-t1(i) = u_transformer(i, tr);
-buildtree(t1 : (A , B));
-
-Where:
-i
: index used by model-building functions. Should never be user declaredtr
: the turn ratio between the windings on the primary and secondary coilsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It may only be used as the root of the connection tree with two forward nodes.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.3
-(wd.)transformer
Adapted ideal transformer.
-An adaptor implementing an ideal transformer for Wave Digital Filter connection trees. -The upward-facing port corresponds to the primary winding connections, and the downward-facing port to the secondary winding connections
-t1(i) = transformer(i, tr);
-buildtree(A : t1 : B);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredtr
: the turn ratio between the windings on the primary and secondary coilsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It should be used within the connection tree with one backward and one forward nodes.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.3
-(wd.)u_transformerActive
Unadapted ideal active transformer.
-An adaptor implementing an ideal transformer for Wave Digital Filter connection trees. -The first downward-facing port corresponds to the primary winding connections, and the second downward-facing port to the secondary winding connections.
-t1(i) = u_transformerActive(i, gamma1, gamma2);
-buildtree(t1 : (A , B));
-
-Where:
-i
: index used by model-building functions. Should never be user declaredgamma1
: the turn ratio describing the voltage relationship between the primary and secondary coilsgamma2
: the turn ratio describing the current relationship between the primary and secondary coilsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It may only be used as the root of the connection tree with two forward nodes.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.3
-(wd.)transformerActive
Adapted ideal active transformer.
-An adaptor implementing an ideal active transformer for Wave Digital Filter connection trees. -The upward-facing port corresponds to the primary winding connections, and the downward-facing port to the secondary winding connections
-t1(i) = transformerActive(i, gamma1, gamma2);
-buildtree(A : t1 : B);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredgamma1
: the turn ratio describing the voltage relationship between the primary and secondary coilsgamma2
: the turn ratio describing the current relationship between the primary and secondary coilsNote: the adaptor must be declared as a separate function before integration into the connection tree. -It should be used within the connection tree with two forward nodes.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.4.3
-(wd.)parallel
Adapted 3-port parallel connection.
-An adaptor implementing a 3-port parallel connection between adaptors for Wave Digital Filter connection trees. -This adaptor is used to connect adaptors simulating components connected in parallel in the circuit.
-buildtree( A : parallel : (B, C) );
-
-Note: this adaptor has no user-accessible parameters. -It should be used within the connection tree with one previous and two forward adaptors.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.5.1
-(wd.)series
Adapted 3-port series connection.
-An adaptor implementing a 3-port series connection between adaptors for Wave Digital Filter connection trees. -This adaptor is used to connect adaptors simulating components connected in series in the circuit.
-
-tree = A : (series : (B, C));
-
-Note: this adaptor has no user-accessible parameters. -It should be used within the connection tree with one previous and two forward adaptors.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 1.5.2
-(wd.)u_sixportPassive
Unadapted six-port rigid connection.
-An adaptor implementing a six-port passive rigid connection between elements. -It implements the simplest possible rigid connection found in the Fender Bassman Tonestack circuit.
-
-tree = u_sixportPassive : (A, B, C, D, E, F));
-
-Note: this adaptor has no user-accessible parameters. -It should be used within the connection tree with six forward adaptors.
-K. Werner, "Virtual Analog Modeling of Audio Circuitry Using Wave Digital Filters", 2.1.5
-(wd.)genericNode
Function for generating an adapted node from another faust function or scattering matrix.
-This function generates a node which is suitable for use in the connection tree structure.
-genericNode
separates the function that it is passed into upward-going and downward-going waves.
n1(i) = genericNode(i, scatter, upRes);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredscatter
: the function which describes the the node's scattering behaviorupRes
: the function which describes the node's upward-facing port-resistanceNote: scatter
must be a function with n inputs, n outputs, and n-1 parameter inputs.
- input/output 1 will be used as the adapted upward-facing port of the node, ports 2 to n will all be downward-facing.
- The first input/output pair is assumed to already be adapted - i.e. the output 1 is not dependent on input 1.
- The parameter inputs will receive the port resistances of the downward-facing ports.
upRes
must be a function with n-1 parameter inputs and 1 output.
- The parameter inputs will receive the port resistances of the downward-facing ports.
- The output should give the upward-facing port resistance of the node based on the upward-facing port resistances of the input.
If used on a leaf element (n=1), the model will automatically introduce a one-sample delay. - Thus, the output of the node at sample t based on the input, a[t], should be the output one sample ahead, b[t+1]. - This may require transformation of the output signal.
-(wd.)genericNode_Vout
Function for generating a terminating/leaf node which gives the voltage across itself as a model output.
-This function generates a node which is suitable for use in the connection tree structure. -It also calculates the voltage across the element and gives it as a model output.
-n1(i) = genericNode_Vout(i, scatter, upRes);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredscatter
: the function which describes the the node's scattering behaviorupRes
: the function which describes the node's upward-facing port-resistanceNote: scatter
must be a function with 1 input and 1 output.
- It should give the output from the node based on the incident wave.
The model will automatically introduce a one-sample delay to the output of the function - Thus, the output of the node at sample t based on the input, a[t], should be the output one sample ahead, b[t+1]. - This may require transformation of the output signal.
-upRes
must be a function with no inputs and 1 output.
- The output should give the upward-facing port resistance of the node.
(wd.)genericNode_Iout
Function for generating a terminating/leaf node which gives the current through itself as a model output.
-This function generates a node which is suitable for use in the connection tree structure. -It also calculates the current through the element and gives it as a model output.
-n1(i) = genericNode_Iout(i, scatter, upRes);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredscatter
: the function which describes the the node's scattering behaviorupRes
: the function which describes the node's upward-facing port-resistanceNote: scatter
must be a function with 1 input and 1 output.
- It should give the output from the node based on the incident wave.
The model will automatically introduce a one-sample delay to the output of the function. - Thus, the output of the node at sample t based on the input, a[t], should be the output one sample ahead, b[t+1]. - This may require transformation of the output signal.
-upRes
must be a function with no inputs and 1 output.
- The output should give the upward-facing port resistance of the node.
(wd.)u_genericNode
Function for generating an unadapted node from another Faust function or scattering matrix.
-This function generates a node which is suitable for use as the root of the connection tree structure.
-n1(i) = u_genericNode(i, scatter);
-
-Where:
-i
: index used by model-building functions. Should never be user declaredscatter
: the function which describes the the node's scattering behaviorNote:
-scatter
must be a function with n inputs, n outputs, and n parameter inputs.
- each input/output pair will be used as a downward-facing port of the node
- the parameter inputs will receive the port resistances of the downward-facing ports.
(wd.)builddown
Function for building the structure for calculating waves traveling down the WD connection tree.
-It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm. -It is used in conjunction with the buildup() function to create a model.
-builddown(A : B)~buildup(A : B);
-
-Where:
- (A : B)
: is a connection tree composed of WD adaptors
(wd.)buildup
Function for building the structure for calculating waves traveling up the WD connection tree.
-It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm. -It is used in conjunction with the builddown() function to create a full structure.
-builddown(A : B)~buildup(A : B);
-
-Where:
-(A : B)
: is a connection tree composed of WD adaptors
(wd.)getres
Function for determining the upward-facing port resistance of a partial WD connection tree.
-It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm. -It is used by the buildup and builddown functions but is also helpful in testing.
-getres(A : B)~getres(A : B);
-
-Where:
-(A : B)
: is a partial connection tree composed of WD adaptors
Note: -This function cannot be used on a complete WD tree. When called on an unadapted adaptor (u_ prefix), it will create errors.
-(wd.)parres
Function for determining the upward-facing port resistance of a partial WD connection tree.
-It recursively steps through the given tree, parametrizes the adaptors, and builds an algorithm.
-It is used by the buildup and builddown functions but is also helpful in testing.
-This function is a parallelized version of getres
.
parres((A , B))~parres((A , B));
-
-Where:
-(A , B)
: is a partial connection tree composed of WD adaptors
Note: this function cannot be used on a complete WD tree. When called on an unadapted adaptor (u_ prefix), it will create errors.
-(wd.)buildout
Function for creating the output matrix for a WD model from a WD connection tree.
-It recursively steps through the given tree and creates an output matrix passing only outputs.
-buildout( A : B );
-
-Where:
-(A : B)
: is a connection tree composed of WD adaptors
(wd.)buildtree
Function for building the DSP model from a WD connection tree structure.
-It recursively steps through the given tree, parametrizes the adaptors, and builds the algorithm.
-buildtree(A : B);
-
-Where:
-(A : B)
: a connection tree composed of WD adaptors
Welcome to the documentation for wdmodels.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-This library implement WebAudio filters, using their C++ version as a starting point, -taken from Mozilla Firefox implementation.
-(wa.)lowpass2
Standard second-order resonant lowpass filter with 12dB/octave rolloff. -Frequencies below the cutoff pass through, frequencies above it are attenuated.
-_ : lowpass2(f0, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in HzQ
: the quality factordtune
: detuning of the frequency in cents(wa.)highpass2
Standard second-order resonant highpass filter with 12dB/octave rolloff. -Frequencies below the cutoff are attenuated, frequencies above it pass through.
-_ : highpass2(f0, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in HzQ
: the quality factordtune
: detuning of the frequency in cents(wa.)bandpass2
Standard second-order bandpass filter. -Frequencies outside the given range of frequencies are attenuated, the frequencies inside it pass through.
-_ : bandpass2(f0, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in HzQ
: the quality factordtune
: detuning of the frequency in cents(wa.)notch2
Standard notch filter, also called a band-stop or band-rejection filter. -It is the opposite of a bandpass filter: frequencies outside the give range of frequencies -pass through, frequencies inside it are attenuated.
-_ : notch2(f0, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in HzQ
: the quality factordtune
: detuning of the frequency in cents(wa.)allpass2
Standard second-order allpass filter. It lets all frequencies through, -but changes the phase-relationship between the various frequencies.
-_ : allpass2(f0, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in HzQ
: the quality factordtune
: detuning of the frequency in cents(wa.)peaking2
Frequencies inside the range get a boost or an attenuation, frequencies outside it are unchanged.
-_ : peaking2(f0, gain, Q, dtune) : _
-
-Where:
-f0
: cutoff frequency in Hzgain
: the gain in dBQ
: the quality factordtune
: detuning of the frequency in cents(wa.)lowshelf2
Standard second-order lowshelf filter. -Frequencies lower than the frequency get a boost, or an attenuation, frequencies over it are unchanged.
-_ : lowshelf2(f0, gain, dtune) : _
-
-Where:
-f0
: cutoff frequency in Hzgain
: the gain in dBdtune
: detuning of the frequency in cents(wa.)highshelf2
Standard second-order highshelf filter. -Frequencies higher than the frequency get a boost or an attenuation, frequencies lower than it are unchanged.
-_ : highshelf2(f0, gain, dtune) : _
-
-Where:
-f0
: cutoff frequency in Hzgain
: the gain in dBdtune
: detuning of the frequency in centsWelcome to the documentation for webaudio.lib. Below you will find an overview of the different versions of this library, along with links to their respective documentation.
-The Faust libraries implement hundreds of DSP functions for audio processing and synthesis. They are organized by types in a set of .lib
files (e.g., envelopes.lib
, filters.lib
, etc.). Librairies use semantic versioning, so may evolve in a manner where newer versions break compatibility with older ones. The recommended way to solve this issue is to keep self-contained versions of the DSP code (that is the DSP program with all needed libraries) as explained in Goals of the Mathdoc.
This website serves as the main documentation of the Faust libraries. The main Faust website can be found at the following URL:
-The easiest and most standard way to use the Faust libraries is to import stdfaust.lib
in your Faust code:
import("stdfaust.lib");
-
-This will give you access to all the Faust libraries through a series of environments:
-sf
: all.lib
aa
: aanl.lib
an
: analyzers.lib
ba
: basics.lib
co
: compressors.lib
de
: delays.lib
dm
: demos.lib
dx
: dx7.lib
en
: envelopes.lib
fd
: fds.lib
fi
: filters.lib
ho
: hoa.lib
it
: interpolators.lib
ma
: maths.lib
mi
: mi.lib
ef
: misceffects.lib
os
: oscillators.lib
no
: noises.lib
pf
: phaflangers.lib
pm
: physmodels.lib
qu
: quantizers.lib
rm
: reducemaps.lib
re
: reverbs.lib
ro
: routes.lib
si
: signals.lib
so
: soundfiles.lib
sp
: spats.lib
sy
: synths.lib
ve
: vaeffects.lib
vl
: version.lib
wa
: webaudio.lib
wd
: wdmodels.lib
Environments can then be used as follows in your Faust code:
-import("stdfaust.lib");
-process = os.osc(440);
-
-In this case, we're calling the osc
function from oscillators.lib
.
You can also access all the functions of all the libraries directly using the sf
environment:
import("stdfaust.lib");
-process = sf.osc(440);
-
-Alternatively, environments can be created by hand:
-os = library("oscillators.lib");
-process = os.osc(440);
-
-Finally, libraries can be simply imported in the Faust code (not recommended):
-import("oscillators.lib");
-process = osc(440);
-
-The Overview
tab in the upper menu provides additional information about the general organization of the libraries, licensing/copyright, and guidelines on how to contribute to the Faust libraries.
The Libraries
tab contain the actual documentation of the Faust libraries.