{"id":17697655,"url":"https://github.com/ales-tsurko/midi-player","last_synced_at":"2026-01-30T14:16:35.211Z","repository":{"id":258429514,"uuid":"870383419","full_name":"ales-tsurko/midi-player","owner":"ales-tsurko","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-24T15:44:44.000Z","size":45623,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T14:59:50.490Z","etag":null,"topics":["audio","midi","midi-player","soundfont"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ales-tsurko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-10T00:07:18.000Z","updated_at":"2024-10-24T15:44:48.000Z","dependencies_parsed_at":"2025-03-13T00:41:31.107Z","dependency_job_id":null,"html_url":"https://github.com/ales-tsurko/midi-player","commit_stats":null,"previous_names":["ales-tsurko/midi-player"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ales-tsurko/midi-player","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2Fmidi-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2Fmidi-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2Fmidi-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2Fmidi-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ales-tsurko","download_url":"https://codeload.github.com/ales-tsurko/midi-player/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2Fmidi-player/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28913955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","midi","midi-player","soundfont"],"created_at":"2024-10-24T14:48:10.112Z","updated_at":"2026-01-30T14:16:35.191Z","avatar_url":"https://github.com/ales-tsurko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"midi-player\n===========\n\nA MIDI file player library with integrated synthesizer ([`rustysynth`](https://crates.io/crates/rustysynth)).\n\nIt's independent from audio library, that means you should provide your own\naudio loop and run the render function within it.\n\nThe player has play/stop, position, volume and tempo parameters, and position\nobserver, which allows you to track the play position in the real-time. \n\n\n\n\n## Example usage (with `cpal`)\n\n\n```rust\nuse std::{thread, time::Duration};\n\nuse cpal::{\n    traits::{DeviceTrait, HostTrait, StreamTrait},\n    StreamConfig,\n};\nuse midi_player::player::{Player, Settings};\n\nfn main() {\n    let settings = Settings::builder().build();\n    let (player, mut controller) =\n        Player::new(\"examples/Nice-Steinway-Lite-v3.0.sf2\", settings).unwrap();\n\n    thread::spawn(|| {\n        start_audio_loop(player);\n    });\n\n    thread::sleep(Duration::from_secs(2));\n\n    controller\n        .set_file(Some(\"examples/Sibelius_The_Spruce.mid\"))\n        .unwrap();\n\n    controller.play();\n\n    loop {}\n}\n\nfn start_audio_loop(mut player: Player) {\n    let host = cpal::default_host();\n    let device = host\n        .default_output_device()\n        .expect(\"No output device available\");\n    let channels = 2 as usize;\n    let config = StreamConfig {\n        channels: channels as u16,\n        sample_rate: cpal::SampleRate(player.settings().sample_rate),\n        buffer_size: cpal::BufferSize::Fixed(player.settings().audio_buffer_size),\n    };\n\n    let err_fn = |err| eprintln!(\"An error occurred on the output audio stream: {}\", err);\n\n    let mut left = vec![0f32; player.settings().audio_buffer_size as usize];\n    let mut right = vec![0f32; player.settings().audio_buffer_size as usize];\n\n    let stream = device\n        .build_output_stream(\n            \u0026config.into(),\n            move |data: \u0026mut [f32], _: \u0026cpal::OutputCallbackInfo| {\n                let sample_count = data.len() / channels;\n\n                player.render(\u0026mut left, \u0026mut right);\n\n                if !left.is_empty() {\n                    for i in 0..sample_count {\n                        data[channels * i] = left[i];\n                        data[channels * i + 1] = right[i];\n                    }\n                }\n            },\n            err_fn,\n            None,\n        )\n        .unwrap();\n\n    stream.play().expect(\"cannot run audio stream\");\n\n    std::thread::park();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fales-tsurko%2Fmidi-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fales-tsurko%2Fmidi-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fales-tsurko%2Fmidi-player/lists"}