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

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews