{"id":13822590,"url":"https://github.com/gyng/synthrs","last_synced_at":"2026-03-14T17:21:52.826Z","repository":{"id":49151438,"uuid":"27885114","full_name":"gyng/synthrs","owner":"gyng","description":"Toy audio synthesizer library in Rust with basic MIDI support.","archived":false,"fork":false,"pushed_at":"2021-06-26T08:14:51.000Z","size":7934,"stargazers_count":88,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T23:37:23.473Z","etag":null,"topics":["midi","rust","synthesizer","wav"],"latest_commit_sha":null,"homepage":"https://gyng.github.io/synthrs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gyng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-11T18:19:51.000Z","updated_at":"2024-11-18T11:02:12.000Z","dependencies_parsed_at":"2022-08-25T14:51:50.123Z","dependency_job_id":null,"html_url":"https://github.com/gyng/synthrs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyng%2Fsynthrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyng%2Fsynthrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyng%2Fsynthrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyng%2Fsynthrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gyng","download_url":"https://codeload.github.com/gyng/synthrs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254576456,"owners_count":22094371,"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":["midi","rust","synthesizer","wav"],"created_at":"2024-08-04T08:02:07.561Z","updated_at":"2025-12-18T00:07:46.742Z","avatar_url":"https://github.com/gyng.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# synthrs\n\n[Documentation](https://gyng.github.io/synthrs)\n\nToy synthesiser library in Rust.\n\nFor programmatic playback, please check out the [cpal integration](https://github.com/gyng/midcat).\n\n## Features\n\n* Not too difficult syntax for writing your own tones (see examples)\n* Basic filters (low-pass, high-pass, band-pass, band-reject, all-pass, comb, delay line, attack/decay envelope)\n* Basic waveforms (sine, square, triangle, sawtooth, tangent, bastardised Karplus-Strong, and more)\n* MIDI synthesis\n* Basic sample synthesis (WAV)\n* PCM or WAV output\n\n#### Integrations\n\n* [usage with cpal](https://github.com/gyng/midcat)\n* [midi-to-wav](https://github.com/gyng/midi-to-wav)\n* [wasm, web synthesis](https://gyng.github.io/synthrs-wasm-ts/#/)\n\n#### Examples (loud)\n\n*You have to right-click \u003e download the bigger ones to your computer because GitHub does not like to stream audio*\n\n* [busy signal](examples/assets/busysignal.ogg)\n* [bell](examples/assets/bell.ogg)\n* [mtnking-pure](examples/assets/mountainking-puresquare.ogg) *pure square wave*\n* [mtnking-envelope](examples/assets/mountainking.ogg) *butchered Karplus-Strong square wave with attack and decay*\n* [gymnopedie](examples/assets/gymnopedie_sampler.ogg) *piano sample*\n* [rustle](examples/assets/rustle.ogg)\n* [clarinet sample](examples/assets/octave_clarinet_sampler.ogg)\n\n## Try\n\nTo run examples (list below)\n\n    cargo run --example EXAMPLE_NAME\n\nTo use as a library, add this to `Cargo.toml`\n\n    [dependencies.synthrs]\n    git = \"https://github.com/gyng/synthrs\"\n    rev = \"the commit you want\"\n\nTo write a custom tone to a WAV file\n\n```rust\nextern crate synthrs;\n\nuse synthrs::synthesizer::{ make_samples, quantize_samples };\nuse synthrs::wave::sine_wave;\nuse synthrs::writer::write_wav_file;\n\nfn main() {\n    // Using a predefined generator\n    write_wav_file(\"out/sine.wav\", 44_100,\n        \u0026quantize_samples::\u003ci16\u003e(\n            \u0026make_samples(1.0, 44_100, sine_wave(440.0))\n        )\n    ).expect(\"failed to write to file\");\n\n    // `make_samples` takes in the duration, sample rate, and a generator closure.\n    // It returns an iterator which `quantize_samples` wraps around (setting the bit depth).\n    write_wav_file(\"out/sine_closure.wav\", 44_100,\n        \u0026quantize_samples::\u003ci16\u003e(\n            \u0026make_samples(1.0, 44_100, |t| (t * 440.0 * 2.0 * 3.14159).sin())\n        )\n    ).expect(\"failed to write to file\");\n}\n```\n\nMore examples are in [`examples/`](examples/).\n\n### Examples\n\nCheck out [`Cargo.toml`](Cargo.toml) for the full example list.\n\n* [`simple`](examples/simple.rs) generates simple tones in `out/`\n* [`telecoms`](examples/telecoms.rs) generates phone tones in `out/`\n* [`filters`](examples/filters.rs) generates examples of audio filtering in `out/`\n* [`midi`](examples/midi.rs) synthesises a few MIDI files in `out/`\n\nThis generates WAV or PCM files which can be opened in Audacity. Example MIDI files are public domain as far as I can tell.\n\n#### cpal\n\n[Example usage with cpal](https://github.com/gyng/midcat)\n\n#### midi-to-wav\n\n[midi-to-wav, a simple cli to convert MIDI files to WAV](https://github.com/gyng/midi-to-wav)\n\n#### wasm\n\n* [synthrs-wasm-ts](https://github.com/gyng/synthrs-wasm-ts)\n* [demo](https://gyng.github.io/synthrs-wasm-ts)\n\n### Audacity PCM import settings\n\n`File \u003e Import \u003e Raw Data...`\n\n* Signed 16-bit PCM\n* Little-endian\n* 1 Channel (Mono)\n* Sample rate: 44_100Hz (or whatever your samples generated have)\n\n## License\n\nsynthrs is licensed under the MIT License. See [`LICENSE`](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyng%2Fsynthrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgyng%2Fsynthrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyng%2Fsynthrs/lists"}