Crate sine_macro

Crate sine_macro 

Source
Expand description

A procedural macro for generating signed integer sine waves as arrays.

§Example

use sine_macro::sine_wave;

// Sine wave defined as const item:
sine_wave! {
    const MY_CONST_SINE_WAVE = sine_wave(frequency: 400, rate: 16_000);
}

// Or as static item:
sine_wave! {
    static MY_STATIC_SINE_WAVE = sine_wave(frequency: 1000, rate: 48_000, len: 48_000);
}

// Sine wave defined as local variable with default rate of 44,100 Hz:
let wave = sine_wave!(frequency: 800, repeats: 10);

See the macro documentation for more examples.

Macros§

sine_wave
Generates an array of signed integers for a sine wave.