Do you enjoy the sounds that wind chimes extract from a soft breeze? How about the gentle splashing of raindrops, the soothing sound of falling water, or the roar of surf?

These appealing natural sounds provide only a hint of the vast range of musical compositions hidden away in many kinds of data. Lately I’ve been having lots of fun transforming data I’ve collected into natural music and posting the results on my Youtube channel, like the video below. Various methods for making sounds from data are available. Let’s use them to convert data into music.

Using Mathematica to Create Music

This project is excerpted from Forrest Mims' new book, Forrest Mims' Science Experiments, available now from the Maker Shed and fine booksellers.

This project is excerpted from Forrest Mims’ new book, Forrest Mims’ Science Experiments, available now from the Maker Shed and fine booksellers.

George Hrabovsky is an amateur physicist who uses Wolfram Mathematica software in his theoretical research. His praise of Mathematica was so persuasive that I eventually bought the program, and it’s where I first went when trying to transform data into music.

Among Mathematica’s astonishing range of features is the ability to convert numbers into synthesized musical notes representing a variety of instruments. Mathematica’s Music Package can convert data into representative audio frequencies and much more. If you’re into programming, it’s a highly flexible tool for transforming data into music.

MusicAlgorithms

Jonathan Middleton is assistant professor of theory and composition in the music department at Eastern Washington University, where he teaches composition, orchestration, and computer music. While exploring ways to transform data into music, I discovered Dr. Middleton’s MusicAlgorithms website (developed with assistance from Andrew Cobb, Michael Henry, Robert Lyon, and Ian Siemer with sponsorship from the Northwest Academic Computing Consortium).

The homepage states that, “Here, the algorithmic process is used in a creative context so that users can convert sequences of numbers into sounds.” That single sentence hooked me into the MusicAlgorithms site for a week while I transformed some of my data into an amazing variety of intriguing musical “compositions.”

How to Use MusicAlgorithms

MusicAlgorithms requires a Java-enabled computer. Transforming a string of numbers into music is simple; you can either type or paste a series of numbers into the program. Here’s a quick way to learn to use the site:

  1. From the homepage, click the Compose button. Then click “Import your own numbers” to enter the data input page.
  2. In the Algorithm box, enter into window A the numbers 1 through 10 (press the Enter key after each number).
  3. Ignore checkboxes B, C, and D and click the Get Algorithm Output button.
  4. In the Pitch box, click the Scale Values button to normalize the numbers 1 to 10 that you entered in window A into the piano scale of 0 to 88 (1 = 0, 2 = 9, 3 = 19, … 10 = 88). These numbers will appear in the adjacent Derived Pitch Values window.
  5. Skip the Duration box (for now). In the Compose box, click the Play button.
  6. A MIDI Player window will open, showing a piano keyboard over buttons for Step and Play and options for Volume, Tempo, and Instrument (Figure 28-1).
m32-figa

Fig 28-1 The MusicAlgorithms web tool displays a piano keyboard over a range of selectable options for instrument selection, tempo, and volume. A pointer on the scale below the keyboard keeps track of progress.

Click the Play button to hear the 10 notes you have composed. Keep playing these notes while using the sliders to adjust the volume and tempo. Then let the fun begin by selecting from the pull-down menu of 128 synthesized instruments and sounds. Soon you’ll be ready to compose music from real data.

Finding Data for MusicAlgorithms

If you’re an amateur weather watcher, you probably have plenty of numbers to transform into music. For example, MusicAlgorithms will convert a year of your daily minimum and maximum temperatures into a remarkable audio experience that will provide an entirely new way to appreciate your data. If you have no scientific data, try converting your daily expenses or bank balance into music. You might be surprised by what you hear.

A goldmine of data is scattered across the web. For example, my local National Weather Service station near San Antonio, Texas, provides monthly and annual precipitation data since 1871 and temperature since 1885. Converting these data into music provides an entirely new way to better appreciate seasonal temperature cycles and even cold fronts, El Niños, and droughts.

The U.S. Geological Survey provides data on stream flow. Many NASA and NOAA sites are filled with data. Other data sources include the U.S. census, stock market statistics, commodity prices, grocery store price lists, traffic counts on major highways, and so forth.

Sample MusicAlgorithms

I’ve posted several videos of MusicAlgorithms based on my data. These will give you a good idea of the amazing variety of sounds you can produce from data that ordinarily are depicted only as dots, lines, or bars on charts.

  • One year of solar noon UV-B data. Since 1988, I’ve measured the sun’s ultraviolet radiation from a field in Texas at solar noon on days when clouds didn’t block the sun. In the YouTube clip below, the UV-B intensity at noon on each of the 170 days during 2010 in which the UV-B could be measured in Figure 28-2 is transformed into representative musical notes.

Figure 28-2 Weather data, like these solar UV measurements, are easily converted into representative sequences of musical tones.

Figure 28-2 Weather data, like these solar UV measurements, are easily converted into representative sequences of musical tones.

Each musical note is accompanied by a 360° fisheye image of the sky made when the UV-B was measured. Low UV-B levels during winter are indicated by low pitch tones, and the high UV-B levels during summer by high pitch tones. Variations in the steady increase and then decrease in UV-B during the year are caused by clouds near the sun, haze, and changes in the ozone layer.

  • The cosmic ray background count. In the below video, the cosmic ray background count on a flight from San Antonio, Texas to Zurich, Switzerland (Figure 28-3), is transformed into an audio composition in which the frequency of tones represents altitude. A typical Geiger counter measures around 11 counts per minute (CPM) at the ground and several hundred CPM at altitudes of 35,000 feet or more.

Figure 28-3 The cosmic ray background count measured by a Geiger counter increases with altitude. The altitude changes of an aircraft flying from San Antonio to Zurich can be heard as distinct changes in pitch, proportional to altitude.

Figure 28-3 The cosmic ray background count measured by a Geiger counter increases with altitude. The altitude changes of an aircraft flying from San Antonio to Zurich can be heard as distinct changes in pitch, proportional to altitude.

  • Tree rings To symphonic strings. MusicAlgorithms can convert the widths of annual growth rings in trees into a tune in which wide rings from wet years have a higher pitch than thin rings from dry years. This composition uses ring data from a tree at my place downed by a flood in 2010 (Figure 28-4).
Figure 28-4 Decades of tree growth can be converted into music based on the precipitation-modulated width of annual growth rings. The bois d’arc tree shown here began growth in 1977.

Figure 28-4 Decades of tree growth can be converted into music based on the precipitation-modulated width of annual growth rings. The bois d’arc tree shown here began growth in 1977.

A tree produces one growth ring each year. The light-colored spring growth is called early wood, the darker summer-fall growth is late wood. In the below video, the width of the early and late wood in each ring was measured and then played in this sequence: early wood note/late wood note/sum of early and late wood notes/rest interval to separate the rings. This clip also includes the data plot I used to form the composition.

Going Further

Here I’ve simply transformed strings of numbers into music. MusicAlgorithms lets you do much more. You can select from a variety of mathematical functions and then enter the pitch range and the duration of each tone. These functions include the mathematical constants pi (π), phi (φ), and e, exponents, the Fibonacci sequence, Pascal’s triangle, Markov chains, and even a chaos algorithm and DNA sequences. If you’re interested in synthesized music, you can’t go wrong exploring these features. Just block out some time. MusicAlgorithms is the most addictive website I’ve ever visited.