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.4" Or, to use the no_std version (custom global allocator is required):

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

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

rust let waveform = wf!(f64, 200, sine!(frequency: 100., amplitude: 10.), dc_bias!(20.));

3) Turn it into an iterator and sample:

rust let some_samples: Vec<f64> = waveform.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.60.

Similar crates

Breaking changes

0.2

0.4