teaching machines

VOICES 2019: Learning Music Theory through Code with Deltaphone

Follow is a draft of my talk for VOICES 2019, a virtual conference on the use of music in STEM learning. This is the first virtual conference I have attended. No flight, no badge, no bag of unwanted promotional materials. Just people talking about music and learning from the comfort of their homes and offices.

Introduction

Computer science education has had a good run of late. It’s been endorsed by presidents, athletes, musicians, and household names in technology. A number of states allow computer science to count toward math, science, or even foreign language requirements, and some require that it be offered in all high schools. There are many organizations aiming to provide access to computer science learning to underrepresented groups. A lot of funding is available for educators who can find effective ways to teach computer science.

Blikstein identifies four rationales behind the push to expand computer science education:

  • Labor market rationale: a competitive technology-based economy requires laborers with computer science skills
  • Equity of participation rationale: the most advantageous jobs and offices will go to those with computer science skills
  • Computational thinking rationale: computer science exposes learners to problem-solving strategies that they can apply to other disciplines
  • Computational literacy rationale: computer science engages learners in building representations of knowledge, both in their minds and in the programs they write

Each of these rationales has merit, but the first three are focused on secondary rewards like jobs, status, and transfer. The rationale that is dearest to my heart as an educator is computational literacy. Computational literacy is not about breeding a new generation of software developers. Advocates of this rationale view computer science as a medium for learning in all disciplines—just as literacy considers the written word to be a medium for all kinds of learning. By writing programs and reading them, we learn.

There’s one particular kind of learning for which I think computer science is well-suited: the learning of music theory.

Music Theory through Deltaphone

Programming is one of the primary activities of computer science. But learning to program is generally time-consuming and full of heartache. For programming not to distract from the learning process of another discipline, we need small languages tailored to the discipline. Sometimes these are called domain-specific languages or DSLs. I have been working on a DSL for music called Deltaphone. I will give a demonstration of its features as they relate to the learning of musical theory.

Sequence

Deltaphone supports sequencing, putting one note after another across time. Let’s write a program to render and play a scale. We’ll start with the chromatic scale. Instead of thinking of notes as absolute positions on the staff, learners can describe notes as changes or deltas from the previous note. In the chromatic scale, for example, each note is one halfstep or semitone higher than the previous note.

We can change the root of this scale, and the rest of the scale moves accordingly. In the Logo programming language, Seymour Papert called this turtle geometry. Instead of treating space as an absolute coordinate system, Logo programmers move around space by turning and moving relative to their current position and heading. You could say that Deltaphone supports turtle music.

The major scale follows a different offset pattern: +2 +2 +1 +2 +2 +2 +1.

The minor scale follows a rotated version of this offset pattern: +2 +1 +2 +2 +1 +2 +2.

Repetition

Musical actions can be repeated. Musicians acknowledge repetition with various repeat structures, but there is also considerable implicit repetition. Deltaphone supports both explicit repeat structures and more general purpose loops called ditto and for. Let’s walk up the staff in perfect fifths with ditto and do it again with repeat:

Data Abstraction

One particularly important cognitive activity that programming contributes to learning is abstraction, the generalization of specifics into patterns. In algebra, for instance, we think about operations in terms of variables instead of specific numbers. In Deltaphone, we can abstract data too. Consider this program that plays four quarter notes:

If I decide I want these to be half notes instead, I must make four changes. However, if I do little higher-order thinking, I can instead create a variable storing the duration. In this program I can make a single change to affect all four notes:

Variables make connections between separate instructions clear and make experimenting less costly.

Procedural Abstraction

In addition to abstracting data, we can also abstract procedures. If there’s a chunk of code that represents a high-level action, we can give that chunk an appropriate name. For example, in this program, we can create procedures for chords of the major scale:

Conclusion

My dream for Deltaphone is not to use it to teach kids how to program. Rather, I want to collaborate with music educators and develop a curriculum for learning music theory through programming. The learners will start with a just a handful of Deltaphone’s primitive commands and build up a whole library of musical structures, like repeats, chords, inversions, and so on. They will be computationally literate in music theory.

Comments

Leave a Reply

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