Making Music With Baseball Data

Philip Del Vecchio

What does a baseball game sound like?

You’re probably imagining the crack of a bat, the cheers of the crowd, the shouts of a traveling beer salesman, and the reverberations of a morale-boosting walk-up song through the stadium. But what does the game itself sound like? Does the combination of throws, hits, and catches that make up a baseball game have a rhythm? A melody? Inspired by James Murphy (best known for his musical project LCD Soundsystem) and IBM’s project using Wimbledon tennis data, I spent our last hack day trying to programmatically create music using only data from games scored using GameChanger.

Computers have been used to make music since the early 1950s, when mathematician Geoff Hill programmed the CSIRAC to play simple melodies. Computers are now ubiquitous in the music making process, used in composition, recording, synthesis, and mixing. The MUSIC I program, developed by Max Mathews at Bell Laboratories in 1957, was the first to incorporate algorithmic composition, extending the use of computers in music beyond simple playback. Since then, experimentation in algorithmic composition has included machine learning, fractals, and genetic algorithms, serving as inspiration for musicians and debate on the nature of art.

The simplest process to generate sound from a game’s play-by-play data is with 1-1 mapping of events to sounds generated by a synthesizer. Each event (a ball, a strike, a hit, etc.) is translated into a pre-generated sound, triggered sequentially at a fixed tempo (in this case, 300 beats per minute). I generated the sounds using Ableton Live’s Operator, an analog modeling synthesizer.

The result, as you may have expected, is robotic and lifeless. Let’s try introducing context. If we differentiate between a single, double, and triple, between strikes one, two, and three, between a fly-out and a ground-out, etc., we begin to hear the beginnings of more complex musical patterns. To avoid complete cacophony, I quantized the generated pitches to notes in a major scale. Each type of event still has its own sound, but it is modulated based on the context in which it occurred.

But there’s more to a baseball game than the plays that occur. The players, locations, and fans contribute just as much to the feeling of a game as the in-game events themselves. Let’s try using some of the game’s metadata to seed some variation in the tempo, pitch, and dynamics (loudness) of sounds.

Aleatoric music is music dating back to the late 15th century but popularized by avant-garde composers in the 20th century including John Cage and Charles Ives. Aleatoric refers to the use of chance in some element of the music, whether in the composition or performance of the piece. In our case, the randomness comes not from the roll of a die or a pseudorandom number generator, but from the “random” events of a baseball game. For each game, however, the music is deterministic - running the algorithm on a given game will produce the same sounds every time.

What we have now is a series of notes constituting a melody and a sort of asynchronous harmony that comes from the quantization to a set key. We also have tone, determined by the original synthesizer sounds, tempo from the play loop, and dynamics from our earlier seeding. The only remaining element of traditional (i.e., European) music is rhythm. In its current state, our song lacks a time signature and a real sense of rhythm beyond the continuous beating of the sounds. Let’s add some drums from an 808.

It’s no Daft Punk, but what we have now is a dancefloor-ready hit written (accidentally) by the players on a baseball field.

This post was written by Philip Del Vecchio who interned with GameChanger in the Summer of 2015. Philip goes to Penn and is currently in his Senior year.