A conversion of the original Sound of Erlang
blog post code to the Elixir language
Original blog post: https://www.erlang-solutions.com/blog/the-sound-of-erlang-how-to-use-erlang-as-an-instrument/
Erlang source code: https://github.com/aleklisi/The-Sound-Of-Erlang
On Linux:
- Install ffmpeg (contains ffplay)
- Replace line
@ffplay_binary "ffmpeg/ffplay.exe"
in file music.ex with@ffplay_binary "ffplay"
(might need to pass in the full path to ffplay, unsure here)
On Windows:
- Download ffmpeg binaries (especially ffplay.exe) and place the files inside a
ffmpeg
folder in the project root.
Both:
- Just run
mix run -e "Music.main()"
in the project root folder to hear a song.
Notes:
- On windows i had to remove the multiplication by 2 in this line
step = hz * 2 * :math.pi() / @sample_rate
or the pitch would be one octave higher than the Youtube reference for the pitch standard. Unsure if that is the case for Linux or not.