Inspiration

Austin had been thinking about trying to make a language from scratch for a while, and Eric had been wondering how synthesizers work. We decided to combine our ideas into one hack project where we could both learn about these areas.

What it does

Musik is a custom programming language that allows a user to specify in code how to play sounds. It can be used to create interesting noises or even music. It's primarily control structure is a set of timed loops, all of which are executed concurrently.

Learn Code with the Science of Sound

Musik is a great way to learn a bit of code while also learning about the mathematics behind the sounds we hear. Often when we think of music notes, we think of piano keys and the clearly defined tones. Musik instead relies purely on the frequencies associated with sound waves. It's simple approachable grammar is a great introduction to programming while creating awesome tunes.

How we built it

We used Python for our programming language. For the custom language, we used ANTLR 4 to autogen the parser for our custom syntax grammar. For the audio, we used pyaudio to stream our samples directly to the output buffer.

Challenges we ran into

Creating an unambiguous grammar is a lot harder than it seems to be, and it can be hard to debug issues related to this.

Accomplishments that we're proud of

We were really happy that we have an actual custom language. We were also happy with the tight integration between the music and programming aspects.

What we learned

We learned a lot more about how sounds are digitally generated. We also learned a lot more about how to create interpreters.

What's next for Musik

There exists a lot more opportunity for Musik: modulators, custom sounds, extended language features, etc.

Built With

Share this project:

Updates