wavegen
wavegen
is a wavefrom generator made with 🦀
How to use it?
- Add
wavegen
to your project:
[]
= "0.2"
Or, to use the no_std version:
[]
= { = "0.2", = false, = ["libm"] }
- Define a waveform with sampling frequency and function components:
let wf = with_components;
- Turn it into an iterator and sample:
let some_samples: = wf.iter.take.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
- Simple sine
- Two superposed phase-shifted sines
- "Real life" example: 300Hz sine signal with 50Hz interference noise
- Sawtooth
- Superposition of sine + sawtooth
- Square wave
- Superposition of Sine, Square and Sawtooth with different frequencies
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
- Waver which was the inspiration for this crate
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