Skip to content

stevegrossi/sweet_beats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SweetBeats

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

Installation

$ 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

Melody

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

Rhythm

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

About

Experiments with making music in Elixir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages