{"id":16985662,"url":"https://github.com/sinshu/rustysynth","last_synced_at":"2025-10-18T22:02:37.245Z","repository":{"id":64053886,"uuid":"538371588","full_name":"sinshu/rustysynth","owner":"sinshu","description":"A SoundFont MIDI synthesizer written in pure Rust","archived":false,"fork":false,"pushed_at":"2025-04-19T11:30:59.000Z","size":1056,"stargazers_count":165,"open_issues_count":6,"forks_count":27,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T16:52:11.163Z","etag":null,"topics":["audio","meltysynth","midi","rust","soundfont","synthesizer"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinshu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-19T06:55:33.000Z","updated_at":"2025-04-19T11:31:02.000Z","dependencies_parsed_at":"2025-01-18T23:24:38.933Z","dependency_job_id":"80bc7a88-acc7-492e-8bdc-4caf9bd31b40","html_url":"https://github.com/sinshu/rustysynth","commit_stats":{"total_commits":166,"total_committers":7,"mean_commits":"23.714285714285715","dds":"0.15662650602409633","last_synced_commit":"6d50b5f5d9f73f58cc6093c31860f782150246a2"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Frustysynth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Frustysynth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Frustysynth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Frustysynth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinshu","download_url":"https://codeload.github.com/sinshu/rustysynth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414453,"owners_count":22067261,"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":["audio","meltysynth","midi","rust","soundfont","synthesizer"],"created_at":"2024-10-14T02:43:57.438Z","updated_at":"2025-10-18T22:02:32.205Z","avatar_url":"https://github.com/sinshu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RustySynth\n\nRustySynth is a SoundFont MIDI synthesizer written in pure Rust, ported from [MeltySynth](https://github.com/sinshu/meltysynth).\n\n\n\n## Features\n\n* Suitable for both real-time and offline synthesis.\n* Supports standard MIDI files with additional features including dynamic tempo changing.\n* No dependencies other than the standard library.\n\n\n\n## Demo\n\nThis is a demo video to show the synthesizer running on [rust-sfml](https://github.com/jeremyletang/rust-sfml) in real-time.\n\nhttps://www.youtube.com/watch?v=o9rPTJIPmVk\n\n[![Youtube video](rustysynth-yt.png)](https://www.youtube.com/watch?v=o9rPTJIPmVk)\n\n\n\n## Installation\n\nRustySynth is available on [crates.io](https://crates.io/crates/rustysynth):\n\n```\ncargo add rustysynth\n```\n\n\n\n## Examples\n\nHere are some example codes.\n\n\u003e [!NOTE]\n\u003e Each example omits the `use` statements.\n\u003e For full code, see the respective links.\n\n[An example code to synthesize a simple chord:](example/src/main.rs#L15)\n\n```rust\n// Load the SoundFont.\nlet mut sf2 = File::open(\"TimGM6mb.sf2\").unwrap();\nlet sound_font = Arc::new(SoundFont::new(\u0026mut sf2).unwrap());\n\n// Create the synthesizer.\nlet settings = SynthesizerSettings::new(44100);\nlet mut synthesizer = Synthesizer::new(\u0026sound_font, \u0026settings).unwrap();\n\n// Play some notes (middle C, E, G).\nsynthesizer.note_on(0, 60, 100);\nsynthesizer.note_on(0, 64, 100);\nsynthesizer.note_on(0, 67, 100);\n\n// The output buffer (3 seconds).\nlet sample_count = (3 * settings.sample_rate) as usize;\nlet mut left: Vec\u003cf32\u003e = vec![0_f32; sample_count];\nlet mut right: Vec\u003cf32\u003e = vec![0_f32; sample_count];\n\n// Render the waveform.\nsynthesizer.render(\u0026mut left[..], \u0026mut right[..]);\n```\n\n[Another example code to synthesize a MIDI file:](example/src/main.rs#L41)\n\n```rust\n// Load the SoundFont.\nlet mut sf2 = File::open(\"TimGM6mb.sf2\").unwrap();\nlet sound_font = Arc::new(SoundFont::new(\u0026mut sf2).unwrap());\n\n// Load the MIDI file.\nlet mut mid = File::open(\"flourish.mid\").unwrap();\nlet midi_file = Arc::new(MidiFile::new(\u0026mut mid).unwrap());\n\n// Create the MIDI file sequencer.\nlet settings = SynthesizerSettings::new(44100);\nlet synthesizer = Synthesizer::new(\u0026sound_font, \u0026settings).unwrap();\nlet mut sequencer = MidiFileSequencer::new(synthesizer);\n\n// Play the MIDI file.\nsequencer.play(\u0026midi_file, false);\n\n// The output buffer.\nlet sample_count = (settings.sample_rate as f64 * midi_file.get_length()) as usize;\nlet mut left: Vec\u003cf32\u003e = vec![0_f32; sample_count];\nlet mut right: Vec\u003cf32\u003e = vec![0_f32; sample_count];\n\n// Render the waveform.\nsequencer.render(\u0026mut left[..], \u0026mut right[..]);\n```\n\n[Yet another example code to synthesize a MIDI file in real-time with the TinyAudio crate:](https://github.com/sinshu/rustysynth/blob/tinyaudio/workspace/src/main.rs)\n\n```rust\n// Setup the audio output.\nlet params = OutputDeviceParameters {\n    channels_count: 2,\n    sample_rate: 44100,\n    channel_sample_count: 4410,\n};\n\n// Buffer for the audio output.\nlet mut left: Vec\u003cf32\u003e = vec![0_f32; params.channel_sample_count];\nlet mut right: Vec\u003cf32\u003e = vec![0_f32; params.channel_sample_count];\n\n// Load the SoundFont.\nlet mut sf2 = File::open(\"TimGM6mb.sf2\").unwrap();\nlet sound_font = Arc::new(SoundFont::new(\u0026mut sf2).unwrap());\n\n// Load the MIDI file.\nlet mut mid = File::open(\"flourish.mid\").unwrap();\nlet midi_file = Arc::new(MidiFile::new(\u0026mut mid).unwrap());\n\n// Create the MIDI file sequencer.\nlet settings = SynthesizerSettings::new(params.sample_rate as i32);\nlet synthesizer = Synthesizer::new(\u0026sound_font, \u0026settings).unwrap();\nlet mut sequencer = MidiFileSequencer::new(synthesizer);\n\n// Play the MIDI file.\nsequencer.play(\u0026midi_file, false);\n\n// Start the audio output.\nlet _device = run_output_device(params, {\n    move |data| {\n        sequencer.render(\u0026mut left[..], \u0026mut right[..]);\n        for (i, value) in left.iter().interleave(right.iter()).enumerate() {\n            data[i] = *value;\n        }\n    }\n})\n.unwrap();\n\n// Wait for 10 seconds.\nstd::thread::sleep(std::time::Duration::from_secs(10));\n```\n\n\n\n## Todo\n\n* __Wave synthesis__\n    - [x] SoundFont reader\n    - [x] Waveform generator\n    - [x] Envelope generator\n    - [x] Low-pass filter\n    - [x] Vibrato LFO\n    - [x] Modulation LFO\n* __MIDI message processing__\n    - [x] Note on/off\n    - [x] Bank selection\n    - [x] Modulation\n    - [x] Volume control\n    - [x] Pan\n    - [x] Expression\n    - [x] Hold pedal\n    - [x] Program change\n    - [x] Pitch bend\n    - [x] Tuning\n* __Effects__\n    - [x] Reverb\n    - [x] Chorus\n* __Other things__\n    - [x] Standard MIDI file support\n    - [x] MIDI file loop extension support\n    - [x] Performace optimization\n\n\n\n## License\n\nRustySynth is available under [the MIT license](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinshu%2Frustysynth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinshu%2Frustysynth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinshu%2Frustysynth/lists"}