wavegen

Crates.io docs Bors enabled

wavegen is a wavefrom generator made with 🦀

How to use it?

1) Add wavegen to your project:

toml [dependencies] wavegen = "0.2" Or, to use the no_std version:

toml [dependencies] wavegen = { version = "0.2", default-features = false, features = ["libm"] }

2) Define a waveform with sampling frequency and function components:

rust let wf = Waveform::<f64>::with_components(200.0, vec![ sine!(frequency: 100, amplitude: 10), dc_bias!(20) ]);

3) Turn it into an iterator and sample:

rust let some_samples: Vec<f64> = wf.iter().take(200).collect();

Refer to documentation for more exhaustive usage examples.

Show me some examples!

Interactive demo

Check out the demo at https://wavegen-demo.netlify.app

Plot charts

Sine plot

Superposed sines plot

300<em>50</em>hz_sines

Sawtooth plot

Sine and sawtooth superposed

Square wave

Something funky

All above examples are generated with simple program found in examples/plot.rs. Run cargo run --example plot to generate them yourself.

MSRV

The Minimum Supported Rust Version is 1.56.1.

Similar crates

Breaking changes

0.2

0.2 intorduces a braking change in how macros are annotated, changing the annotation form from frequency = n to frequency: n