{"id":20443729,"url":"https://github.com/amrali/waver","last_synced_at":"2025-04-12T23:50:41.386Z","repository":{"id":44497358,"uuid":"202930727","full_name":"amrali/waver","owner":"amrali","description":"Waver: A waveform generation library for Rust","archived":false,"fork":false,"pushed_at":"2023-01-18T10:53:49.000Z","size":50,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T17:56:49.992Z","etag":null,"topics":["no-std","rust-library","signal-processing","wave-generator","waveform"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amrali.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-17T20:57:42.000Z","updated_at":"2025-02-14T21:35:21.000Z","dependencies_parsed_at":"2023-02-10T14:31:35.674Z","dependency_job_id":null,"html_url":"https://github.com/amrali/waver","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrali%2Fwaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrali%2Fwaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrali%2Fwaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amrali%2Fwaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amrali","download_url":"https://codeload.github.com/amrali/waver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248170297,"owners_count":21059169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["no-std","rust-library","signal-processing","wave-generator","waveform"],"created_at":"2024-11-15T09:49:15.486Z","updated_at":"2025-04-12T23:50:41.361Z","avatar_url":"https://github.com/amrali.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Waver [![CI](https://github.com/amrali/waver/actions/workflows/main.yml/badge.svg)](https://github.com/amrali/waver/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/amrali/waver/branch/master/graph/badge.svg?token=fN3pEuLaAB)](https://codecov.io/gh/amrali/waver) [![Crates.io](https://img.shields.io/crates/v/waver.svg?logo=rust)](https://crates.io/crates/waver) [![Documentation](https://img.shields.io/badge/docs-current-blue.svg?logo=rust)](https://docs.rs/waver)\n=====\n\nWaver is a simple no-std library to generate any waveform of a given frequency,\namplitude and phase.\n\nA waveform can be a simple sinusoidal wave or a complex waveform of varying\nfrequency and amplitude. Waver is useful where there's a need to generate\na simple sinusoidal sound wave or for constructing a frequency or amplitude\nmodulated carrier wave in bare-metal [Arduino] or a [Raspberry Pi].\n\n## Usage\n\nTo use Waver, add the following to your `Cargo.toml` file.\n\n```toml\n[dependencies]\nwaver = \"0.1\"\n```\n\n## Example\n\n```rust\nuse std::{vec::Vec, f32::consts::PI};\nuse waver::{Waveform, Wave, WaveFunc};\n\nfn main() {\n  // 44.1Khz sampling rate and 16-bit depth.\n  let mut wf = waver::Waveform::\u003ci16\u003e::new(44100.0);\n\n  // Superpose a sine wave, a cosine wave and a triangle function.\n  wf.superpose(Wave { frequency: 2600.0, ..Default::default() })\n    .superpose(Wave { frequency: 2600.0, phase: PI / 2.0, ..Default::default() })\n    .superpose(Wave { frequency: 2600.0, func: WaveFunc::Triangle, ..Default::default() })\n    .normalize_amplitudes();\n\n  // Quantization of 100 samples\n  let _output: Vec\u003ci16\u003e = wf.iter().take(100).collect();\n}\n```\n\n## Features\n\n* Arbitrary quantization levels. Specify the bit depth when constructing `Waveform`.\n* Online wave generation. No buffers, infinite iterators.\n* Wave superposition with weighted amplitudes.\n* Modulate signal's frequency, amplitude or phase.\n* Numerically stable, prevents clipping.\n\n## TODO\n\n* [ ] Implement checks to protect against aliasing (e.g., disallow frequencies above the Nyquist frequency).\n* [ ] Use fixed-point arithmetic for platforms that doesn't have an FPU.\n* [ ] Replace use of libm crate [when math support moves to libcore].\n* [ ] Expand the crate features to also include signal analysis functionality.\n\n## Contributing\n\nThought of something you'd like to see in Waver? You can visit the issue tracker\nto check if it was reported or proposed before, and if not please feel free to\ncreate an issue or feature request. Ready to start contributing?\nThe [contributing guide][contributing] is a good place to start. If you have\nquestions please feel free to ask.\n\n[Arduino]: https://www.arduino.cc/\n[Raspberry Pi]: https://www.raspberrypi.org/\n[contributing]: https://github.com/amrali/waver/blob/master/CONTRIBUTING.md\n[when math support moves to libcore]: https://github.com/rust-lang/rfcs/issues/2505\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrali%2Fwaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famrali%2Fwaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famrali%2Fwaver/lists"}