Skip to main content

The Future of Music: Making Beats With Code

May 24, 2022
Mike Horn instructing students
"Code gives us an elegant language to think about musical ideas," says Mike Horn.

A new book by Northwestern University professor Mike Horn offers a powerful way to create music that can be linked with digital production tools of the future.

Introduction to Digital Music with Python Programming: Learning Music With Code is a beginner’s guide to the increasingly intertwined world of music and code. The book uses two platforms, including Horn’s TunePad, which let users create short musical loops that can be layered together using a simple digital audio workstation interface.

Horn, director of the Tangible Interaction Design and Learning (TIDAL) Lab, coauthored the book with Melanie West, a learning sciences doctoral student at the School of Education and Social Policy; and Cameron Roberts, a software developer and saxophonist in Chicago and a member of the TIDAL lab.

"Working with TunePad over the past several years has changed my outlook on both music and computation," said Roberts, (left) who, before arriving at Northwestern, had been told he'd have to choose between music and code. "Combining music with code not only creates entirely new creative potentials, but also changes the way we think of both areas. TunePad also opens up a world in which you can interact with music and code through playfulness and exploration."

For West, who studies the role of music in the learning sciences, the project aligned perfectly with her research interests. Before coming to Northwestern, West worked as a recording engineer for 10 years, earning a platinum album from her work with the Talking Heads on the Little Creatures album.

"TunePad, being free and accessible, can open doors to new ways of learning through music," she said. "There's nothing like witnessing the expression on a child’s face when they are able to program a Python loop that expresses their musical thoughts. I hope many more children are given the opportunity to create and learn using TunePad."

Introduction to Digital Music with Python Programming coverThe book covers the fundamentals of rhythm, chord structure, and melodic composition along with the basics of digital production. Each new concept is anchored in a real-word musical example to give readers the ability to make beats in minutes.

The team wanted to help people of all coding backgrounds and musical ability (including those with none) explore the algorithmic and mathematical beauty of music. Written in clear, accessible language, their book targets high school- aged students and up and educators, whether they work in computer science, music, or informal educational settings.

“Code gives us an elegant language to think about musical ideas,” said Horn, associate professor of computer science and learning sciences. “Music is a great way to learn core programming concepts. Together they reinforce one another is surprising and potent ways that open new creative opportunities.”

Falling in Love

For Horn, coding has long been a way to help revitalize subjects that have become “painfully rote” in schools. His own experience with music is a case in point. As a child growing up in Houston, Horn played the viola, but he memorized the songs and never fell in love with music.

“While I could read music, I never learned to read music as literature, never composed anything not even informally scratching out a tune, and I never developed habits of deep listening,” he said. “I never played just for fun.”

Learning how to code was a completely different experience. He was self-taught, took electives that he chose himself, spent hours working on games or other projects (when he probably should have been practicing the viola, he says), planned out algorithms, and even synthesized his own rudimentary sound effects. “I had no idea what I was doing, but that was liberating,” he said. “I fell in love with coding.”

Developing TunePad over the last several years helped Horn rediscover the power of musical ideas. “Code has given me a different kind of language for thinking about things like rhythm, chords and harmony,” he said. “Music has become something creative and alive in a way that it never was for me before.”

Increasingly, students in local districts have been able to try it for themselves. Teachers in Evanston/Skokie School District 65 computer science classes recently offered TunePad to fifth graders. The six-week class culminated with a “When Coded Beats Come Alive” festival at Evanston Township High School, where select student compositions were performed by a live, professional band.

“Music and code reinforce one another in surprising and powerful ways that open new creative opportunities,” Horn said. “Regardless of your starting point–as a coder, as a musician, as neither, as both–you will discover something new about yourself and what you can become."

Read more about TunePad in SESP Magazine.