Coding Education STEM

Creating music and teaching coding

Have you heard of Earsketch? It’s an amazing, fun way to create music while learning, practicing, teaching coding! Yes, music and coding all in one with its online, free platform (for students)…you just need a browser. It supports Python and Javascript coding in their online editor and you can compile and run the code on the same webapp. Check them out at

You don’t have to generate sound using code, rather you code to arrange the tracks, add effects to them and various other things. For the actual audio files, you can use your own or you can search on their platform for loops and clips that you can use for your unique creation. Really easy to get started and a solid API support.

The DAW interface of a composition I created in a few minutes with just a few lines of code (code and audio file is shared below) looks like this:

DAW interface for one of my compositions

Below is a quick example of my creation. The video is just of Windows Media Player with custom visualization playing my audio file.

Audio playing in Windows Media Player with custom visualzations

Hope you liked it. Go ahead and create your own…have fun and enjoy!

The code for the composition above is:

Python source code for above composition

Interested in creating programmable, cool electronic gadgets? Give my newest book on Arduino a try: Hello Arduino!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top