Troubadour will look at the LLVM IR of your code and turn it into a beautiful melody.
This package is unregistered so you will need to install it via
import Pkg
Pkg.add(PackageSpec(url = "https://github.com/JuliaWTF/Troubadour.jl"))
For using @llvm_midi
you will additionally need to install fluidsynth
.
There is a large list of installation instructions on their github.
For using @llvm_play
you will need to install sox
.
You can find it on this download link.
PS: there is some work to make it an automatically installed binary.
With the installation done you are ready for some LLVM music delight!
Troubadour can be used via its macros @llvm_midi
and @llvm_play
:
using Troubadour
@llvm_midi sqrt(2)
@llvm_play println("Dance!")
With @llvm_midi
you can also record your llvm as an MP3 using the keyword record = true
@llvm_midi 1 + 1 record = true
The sound file will be saved as "1 + 1.mp3" (the latest summer hit).