# signals.lib

A library of basic elements to handle signals in Faust. Its official prefix is `si`

.

## Functions Reference

`(si.)bus`

Put n cables in parallel.
`bus`

is a standard Faust function.

#### Usage

```
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.

#### Usage

```
_,_,... : block(n) : _,...
```

Where:

`N`

: the number of signals to be blocked known at compile time

`(si.)interpolate`

Linear interpolation between two signals.

#### Usage

```
_,_ : interpolate(i) : _
```

Where:

`i`

: interpolation control between 0 and 1 (0: first input; 1: second input)

`(si.)smoo`

Smoothing function based on `smooth`

ideal to smooth UI signals
(sliders, etc.) down.
`smoo`

is a standard Faust function.

#### Usage

```
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.

#### Usage

```
hslider(...) : polySmooth(g,s,d) : _
```

Where:

`g`

: the gate/trigger signal used when making polyphonic synths`s`

: 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.

#### Usage

```
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.

#### Usage

```
hslider(...) : bsmooth : _
```

`(si.)dot`

Dot product for two vectors of size N.

#### Usage

```
_,_,_,_,_,_ : 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.

#### Usage:

```
_ : smooth(tau2pole(tau)) : _
```

Where:

`tau`

: desired smoothing time constant in seconds, or

```
hslider(...) : 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.

#### Reference:

`(si.)cbus`

n parallel cables for complex signals.
`cbus`

is a standard Faust function.

#### Usage

```
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.- each complex number is represented by two real signals as (real,imag)

`(si.)cmul`

multiply two complex signals pointwise.
`cmul`

is a standard Faust function.

#### Usage

```
(r1,i1) : cmul(r2,i2) : (_,_);
```

Where:

- Each complex number is represented by two real signals as (real,imag), so
`(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.

#### Usage

```
(r1,i1) : cconj : (_,_);
```

Where:

- Each complex number is represented by two real signals as (real,imag), so
`(r1,i1)`

= real and imaginary parts of the input signal`(r1,-i1)`

= real and imaginary parts of the output signal

`(si.)lag_ud`

Lag filter with separate times for up and down.

#### Usage

```
_ : lag_ud(up, dn) : _;
```

`(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.

#### Usage

```
_ : rev(N) : _;
```

Where:

`N`

: the block size