How does sound travel? How does it relate to pitch, melody and everything music? Can we visualize and interact with it to better understand how music works?

The book Code of Music by Luisa Pereira answers these questions to explain the basics of music theory and then gradually starts diving into interactively teaching how anyone can create their own music with code!!

I worked with her for my Google Summer of Code to make an interactive web and pdf version of the book, along with fellow ITP student Elias Jarzombek, who was also a web developer on the team.

Before we began working on the book style and coding the interactives, we had a lot of previous work to do:

  1. Build an infrastructure that would house and structure the book contents.
  2. With the book containing a lot of interactives and media, think of a way to optimise the performance and make it light.
  3. Build an automated workflow that would make deploying and content creation streamlined.
  4. Create a style guide and generic reusable functions.
  5. Finally, begin working on placing the book contents and building the interactives.

We chose to go with using Magicbook as a platform as it provides a way to create web and pdf versions of  the book from the same source files. Magicbook is an open source project funded by New York University's Interactive Telecommunications Program, where I am currently a student. Apart from providing web and pdf builds, Magicbook has a quick way to set the book structure with Chapters and subchapters, and it generates a  navigation menu without additional styling. It also gives the flexibility to add content in both html and markdown.

The first version of the Code of Music was written in Jekyll which had few issues for our use case. One that was of major concern to us was performance with having multiple iframes for the interactives. We wanted to have a way to use inline canvases for our interactives. So naturally the steps that followed were -

  1. Port the existing book from Jekyll to magic book.

  2. Test out the libraries that were essential to the project and figure out how they could be bundled with Magicbook.

  3. P5.js is a very crucial library for the project as all of our interactives would be built using that. To be able to use the p5 javascript files from other folders to our main content markdown files, Elias built out a separate plugin so that magicbook could render our interactives as a separate canvas.