{"id":14990792,"url":"https://github.com/sinshu/ziggysynth","last_synced_at":"2025-04-12T03:24:30.359Z","repository":{"id":65625597,"uuid":"542993746","full_name":"sinshu/ziggysynth","owner":"sinshu","description":"A SoundFont MIDI synthesizer written in pure Zig","archived":false,"fork":false,"pushed_at":"2025-03-16T05:14:51.000Z","size":889,"stargazers_count":71,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:01:39.312Z","etag":null,"topics":["audio","meltysynth","midi","soundfont","synthesizer","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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":null,"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-29T08:01:37.000Z","updated_at":"2025-03-16T05:14:54.000Z","dependencies_parsed_at":"2024-01-31T01:40:31.598Z","dependency_job_id":null,"html_url":"https://github.com/sinshu/ziggysynth","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/sinshu%2Fziggysynth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Fziggysynth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Fziggysynth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinshu%2Fziggysynth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinshu","download_url":"https://codeload.github.com/sinshu/ziggysynth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511065,"owners_count":21116345,"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","soundfont","synthesizer","zig","ziglang"],"created_at":"2024-09-24T14:20:51.645Z","updated_at":"2025-04-12T03:24:30.351Z","avatar_url":"https://github.com/sinshu.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZiggySynth\n\nZiggySynth is a SoundFont MIDI synthesizer written in pure Zig, ported from [MeltySynth for C#](https://github.com/sinshu/meltysynth).\n\n\n\n## Features\n\n* Suitable for both real-time and offline synthesis.\n* Support for standard MIDI files.\n* No dependencies other than the standard library.\n* All the functionality is in [a single file](src/ziggysynth.zig).\n\n\n\n## Installation\n\n* Zig v0.14.x is required.\n* Copy [ziggysynth.zig](src/ziggysynth.zig) to your project.\n\n\n\n## Demo\n\nhttps://www.youtube.com/watch?v=GQj3tF8OdPw\n\n[![Youtube video](https://img.youtube.com/vi/GQj3tF8OdPw/0.jpg)](https://www.youtube.com/watch?v=GQj3tF8OdPw)\n\n\n\n## Examples\n\nSome useful aliases:\n\n```zig\nconst ziggysynth = @import(\"ziggysynth.zig\");\nconst SoundFont = ziggysynth.SoundFont;\nconst Synthesizer = ziggysynth.Synthesizer;\nconst SynthesizerSettings = ziggysynth.SynthesizerSettings;\nconst MidiFile = ziggysynth.MidiFile;\nconst MidiFileSequencer = ziggysynth.MidiFileSequencer;\n```\n\nAn example code to synthesize a simple chord:\n\n```zig\n// Load the SoundFont.\nvar sf2 = try fs.cwd().openFile(\"TimGM6mb.sf2\", .{});\ndefer sf2.close();\nvar sound_font = try SoundFont.init(allocator, sf2.reader());\ndefer sound_font.deinit();\n\n// Create the synthesizer.\nvar settings = SynthesizerSettings.init(44100);\nvar synthesizer = try Synthesizer.init(allocator, \u0026sound_font, \u0026settings);\ndefer synthesizer.deinit();\n\n// Play some notes (middle C, E, G).\nsynthesizer.noteOn(0, 60, 100);\nsynthesizer.noteOn(0, 64, 100);\nsynthesizer.noteOn(0, 67, 100);\n\n// The output buffer (3 seconds).\nconst sample_count: usize = @intCast(3 * settings.sample_rate);\nvar left: []f32 = try allocator.alloc(f32, sample_count);\ndefer allocator.free(left);\nvar right: []f32 = try allocator.alloc(f32, sample_count);\ndefer allocator.free(right);\n\n// Render the waveform.\nsynthesizer.render(left, right);\n```\n\nAnother example code to synthesize a MIDI file:\n\n```zig\n// Load the SoundFont.\nvar sf2 = try fs.cwd().openFile(\"TimGM6mb.sf2\", .{});\ndefer sf2.close();\nvar sound_font = try SoundFont.init(allocator, sf2.reader());\ndefer sound_font.deinit();\n\n// Create the synthesizer.\nvar settings = SynthesizerSettings.init(44100);\nvar synthesizer = try Synthesizer.init(allocator, \u0026sound_font, \u0026settings);\ndefer synthesizer.deinit();\n\n// Load the MIDI file.\nvar mid = try fs.cwd().openFile(\"flourish.mid\", .{});\ndefer mid.close();\nvar midi_file = try MidiFile.init(allocator, mid.reader());\ndefer midi_file.deinit();\n\n// Create the sequencer.\nvar sequencer = MidiFileSequencer.init(\u0026synthesizer);\n\n// Play the MIDI file.\nsequencer.play(\u0026midi_file, false);\n\n// The output buffer.\nconst sample_count = @as(f64, @floatFromInt(settings.sample_rate)) * midi_file.getLength();\nvar left: []f32 = try allocator.alloc(f32, @intFromFloat(sample_count));\ndefer allocator.free(left);\nvar right: []f32 = try allocator.alloc(f32, @intFromFloat(sample_count));\ndefer allocator.free(right);\n\n// Render the waveform.\nsequencer.render(left, right);\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] Performace optimization\n\n\n\n## License\n\nZiggySynth is available under [the MIT license](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinshu%2Fziggysynth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinshu%2Fziggysynth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinshu%2Fziggysynth/lists"}