Function dsp::signal::saw [] [src]

pub fn saw<S>(phase: Phase<S>) -> Saw<S>

Produces a Signal that yields a saw wave oscillating at the given hz.

Example

extern crate sample;

use sample::signal;

fn main() {
    // Generates a saw wave signal at 1hz to be sampled 4 times per second.
    let mut signal = signal::rate(4.0).const_hz(1.0).saw();
    assert_eq!(signal.next(), Some([1.0]));
    assert_eq!(signal.next(), Some([0.5]));
    assert_eq!(signal.next(), Some([0.0]));
    assert_eq!(signal.next(), Some([-0.5]));
}