fhunleth

fhunleth

Co-author of Nerves

I’ve been playing around with libfluidsynth which is a software MIDI synthesizer. The nice part (for me at least) is that it can play notes without any additional hardware and the software setup is simple once you get libfluidsynth and a soundfont installed.

I’m finding that I don’t have time to do justice to a music library in Elixir and I don’t think that I have the musical background to do it anyway. It has been a lot of fun, though, so I packaged up the raw MIDI interface and posted it at midi_synth | Hex.

The library doesn’t have a sequencer. You just give it MIDI commands and it immediately runs them. Thanks to Elixir’s binary syntax, this is actually not too bad to work with. There is some example code to get you started. Please read the README.md for getting libfluidsynth and a soundfont file.

Showing Posts 1 to 3

sym_num

sym_num

Hello.

I wrote a code that generate music of Takeuchi function.
Thank you for good library.

fhunleth

fhunleth OP

Co-author of Nerves

This is great! Thank you for posting.

You have motivated me to clean up and improve the source code for the library. I will publish updates soon.

Frank

fhunleth

fhunleth OP

Co-author of Nerves

I just released midi_synth v0.3.0 which is a substantial update to the library. Unfortunately, it is completely backwards incompatible with v0.2.0, but on the plus side, it fixes quite a few big mistakes I made a couple years ago.

The main module, MIDISynth, only handles low level MIDI commands now. I moved the helper functions for playing simple songs and for encoding MIDI commands to other modules. My hope is that other libraries can build upon the flexibility of being able to send nearly any MIDI command to midi_synth and not be constrained the library. See the docs for examples. I think that the changes that need to be made to existing code are self-explanatory since the API was pretty small anyway.

Besides the name changes and API functions moving around, you now need to start a software MIDI synth yourself. You can do that by calling MIDISynth.start_link/1 manually or by including it in one of your supervision trees.

Other improvements include:

  1. All configuration is passed to MIDISynth.start_link/1. I removed the one use of the application environment, so you can now start up multiple synthesizers with different sound fonts if you want.
  2. C code gets built under _build. This sounds small, but it prevents a number of issues especially if anyone ever starts cross-compiling midi_synth for Nerves.
  3. The build system automatically downloads a Creative Commons-licensed general MIDI soundfont. This step could be improved, but at the moment, it simplifies getting started and this soundfont file is probably sufficient for most people.

I’ve tested this on OSX and Linux, and it seems to work. Of course, it’s audio, so Linux friends, please help if there are settings that you need tweaked or need to be exposed as user-configurable.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 12366 136
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews