{"id":16656175,"url":"https://github.com/fhunleth/midi_synth","last_synced_at":"2026-01-22T18:47:44.069Z","repository":{"id":48842107,"uuid":"135080553","full_name":"fhunleth/midi_synth","owner":"fhunleth","description":"Play music in Elixir","archived":false,"fork":false,"pushed_at":"2024-06-06T01:14:20.000Z","size":72,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-11-30T17:50:29.745Z","etag":null,"topics":["elixir","fluidsynth","hacktoberfest","midi"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/midi_synth","language":"Elixir","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/fhunleth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-05-27T20:48:59.000Z","updated_at":"2025-10-25T19:57:28.000Z","dependencies_parsed_at":"2025-03-21T16:49:18.516Z","dependency_job_id":null,"html_url":"https://github.com/fhunleth/midi_synth","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fhunleth/midi_synth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fmidi_synth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fmidi_synth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fmidi_synth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fmidi_synth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fhunleth","download_url":"https://codeload.github.com/fhunleth/midi_synth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fmidi_synth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28668400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T17:07:18.858Z","status":"ssl_error","status_checked_at":"2026-01-22T17:05:02.040Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["elixir","fluidsynth","hacktoberfest","midi"],"created_at":"2024-10-12T09:56:29.355Z","updated_at":"2026-01-22T18:47:44.016Z","avatar_url":"https://github.com/fhunleth.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIDISynth\n\n[![CircleCI](https://circleci.com/gh/fhunleth/midi_synth.svg?style=svg)](https://circleci.com/gh/fhunleth/midi_synth)\n[![Hex.pm](https://img.shields.io/hexpm/v/midi_synth.svg)](https://hex.pm/packages/midi_synth)\n[![Hex.pm](https://img.shields.io/hexpm/dt/midi_synth.svg)](https://hex.pm/packages/midi_synth)\n[![Hex.pm](https://img.shields.io/hexpm/l/midi_synth.svg)](https://hex.pm/packages/midi_synth)\n[![Github.com](https://img.shields.io/github/last-commit/fhunleth/midi_synth.svg)](https://github.com/fhunleth/midi_synth)\n\nPlay music in Elixir.\n\n## Trying it out\n\nFirst, install [FluidSynth](http://www.fluidsynth.org/).\n\nOn Linux:\n\n```sh\nsudo apt install libfluidsynth-dev\n```\n\nOn MacOS:\n\n```sh\nbrew install fluidsynth pkg-config\n```\n\nNext, either clone this library or pull it in as a dependency to your Elixir\nproject. The following is an example of the dependency for your `mix.exs`:\n\n```elixir\n{:midi_synth, \"~\u003e 0.4.0\"}\n```\n\nFetch dependencies and build as you normally would. The first build will\ndownload the `FluidR3_GM.sf2` soundfont file. This is a Creative\nCommons-licensed data file that contains all of the\n[General MIDI](https://en.wikipedia.org/wiki/General_MIDI) instruments. It is a\ngood place to start, but can be changed later on.\n\nIMPORTANT: If `midi_synth` has a compiler error on MacOS, it is likely that it\nis due to an error in a pkg-config file referred to by `fluidsynth.pc`. To fix,\nedit `/opt/homebrew/lib/pkgconfig/fluidsynth.pc` and remove the word \"readline\".\n\n## Try it out using IEx\n\nStart IEx by running `iex -S mix` from a shell prompt.\n\n`MIDISynth` is a `GenServer` and must be started first. The library comes with\nwith helpers to make playing simple things easy. For more complicated uses,\nyou'll want to build on this library.\n\nOK, let's play a note. Notes are numbered sequentially. Middle C is note 60.\nHere's how to play middle C for 100 ms.\n\n```elixir\niex\u003e {:ok, synth} = MIDISynth.start_link([])\n{:ok, #PID\u003c0.226.0\u003e}\niex\u003e MIDISynth.Keyboard.play(synth, 60, 100)\n```\n\nYou can play the same note with a different velocity. The velocities range from\n1 to 127. Here's how to play middle C for 100 ms with velocity mezzo-forte: 80.\n\n```elixir\niex\u003e MIDISynth.Keyboard.play(synth, 60, 100, 80)\n```\n\nIf you don't like the piano, try switching the instrument to something else.\nFor example, trumpets [(General MIDI instrument\n57)](https://www.midi.org/specifications-old/item/gm-level-1-sound-set) are\nnice:\n\n```elixir\niex\u003e MIDISynth.Keyboard.change_program(synth, 57)\niex\u003e MIDISynth.Keyboard.play(synth, 60, 500)\n```\n\nPercussion instruments can be played only through MIDI channel 9.\nFor example, this is how to play a cowbell sound:\n\n```elixir\niex\u003e MIDISynth.Keyboard.play(synth, 56, 0, 127, 9)\n```\n\nThe real value of this library is the ability to send raw MIDI messages to the\nFluidSynth library. The Elixir code barely scratches the surface of what's\npossible. If you're comfortable with raw [MIDI\ncommands](https://www.midi.org/specifications/item/table-1-summary-of-midi-message),\ntry this out:\n\n```elixir\niex\u003e MIDISynth.midi(synth, \u003c\u003c0x90, 60, 127\u003e\u003e)\niex\u003e MIDISynth.midi(synth, \u003c\u003c0x80, 60, 127\u003e\u003e)\n```\n\nSee `MIDISynth.Command` for help with encoding messages, and please feel free to\nadd more.\n\n## License\n\nThe Elixir and C code are covered by the Apache 2 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhunleth%2Fmidi_synth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffhunleth%2Fmidi_synth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhunleth%2Fmidi_synth/lists"}