[][src]Struct twang::Signal

pub struct Signal(_);

A signed digital audio signal that can be routed through processing components. This differs from Mono64 in that the values are not clamped between -1 and 1.

Implementations

impl Signal[src]

pub fn sine(self) -> Self[src]

Sine wave generator component - takes a sawtooth (Fc) wave.

pub fn triangle(self) -> Self[src]

Triangle wave generator component - takes a sawtooth (Fc) wave.

pub fn pulse<S: Into<Self>>(self, half_duty: S) -> Self[src]

Pulse wave generator component - takes a sawtooth (Fc) wave.

  • half_duty: ½ Duty cycle - range: 0~1 (1.0 for square wave)

pub fn shift<S: Into<Self>>(self, amount: S) -> Self[src]

Shift signal. Takes a signal and adds an amount to it, wrapping to -1 if it goes over 1, and to 1 if it goes under -1.

pub fn gain<S: Into<Self>>(self, volume: S) -> Self[src]

Increase (amplify) or decrease the gain of the signal.

pub fn invert(self) -> Self[src]

Invert (negate) signal.

pub fn abs(self) -> Self[src]

Absolute value of signal.

pub fn min<S: Into<Self>>(self, limit: S) -> Self[src]

The minimum of two signals.

pub fn max<S: Into<Self>>(self, limit: S) -> Self[src]

The maximum of two signals.

pub fn gate<S: Into<Self>>(self, limit: S) -> Self[src]

Apply noise gate by side-chaining a the cutoff signal level

pub fn pow<S: Into<Self>>(self, exp: S) -> Self[src]

Raise a signal to a power. This can be used to get the x root of a signal as well with 1 / x.

pub fn clip_soft<S: Into<Self>>(self, volume: S) -> Self[src]

Amplify a signal with soft clipping.

pub fn clamp(self) -> Self[src]

Clamp a signal -1 to 1 (hard clipping)

pub fn to_mono(self) -> Mono<Ch64>[src]

Convert signal into Mono channel.

Trait Implementations

impl Clone for Signal[src]

impl Copy for Signal[src]

impl Debug for Signal[src]

impl From<Signal> for f64[src]

impl From<f64> for Signal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.