Experiments with making music in Elixir
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Experiments in making music with Elixir, for a forthcoming talk at the Indy Elixir meetup.


$ git clone git@github.com:stevegrossi/sweet_beats.git
$ brew install sox
$ mix run --no-halt

Learn more about the SoX library (docs)

Tentative API

Each "track" is a looping worker process supervised by the main application:

worker(Melody, [Guitar, ~w(G . A . B . A . )]),
worker(Rhythm, ["kick2.wav", ~w(X . X .)], id: 1),

There are currently two types of processes


This module is for generating musical tones. It takes two arguments, the first is an instrument module (e.g. Guitar) which plays notes by implementing the Instrument behaviour. The second argument is an array of notes. Specify sharps with #, e.g. F#; flats with b, e.g. Gb; and rests with .. You can also optionally specify the octave with an integer, e.g. G#2


This module is for playing audio file samples from the /samples directory. Any file format that SoX supports should work. The worker process takes two arguments: the first is the name of the sample file, and the second is an array of beats. . signifies a rest (play nothing), and any other character (I prefer X) will play the sound file on that beat.

Improvements I’d Like to Make

  • More and better Instruments!
  • A better API? At least one that allows composition.
  • The ability to write and save compositions as text files rather than having to modify the Supervisor.Spec.
  • Specifiable tempo per-track

Additional Resources