Air Play
Smog Music Created With Beijing Air Quality Data

This song generates a musical sequence using official air quality data in Beijing over the last three years. Daily readings of PM 2.5 particulates are used to indicate air quality. Using this data, I try to "pollute" a song over time. In other words, the song responds to the cumulative impact of multiple and consecutive daily readings rather than any individual daily reading.

The Song

Listen to the song by using the player above, or check out the song on Soundcloud if you prefer no visuals or would like to comment on a specific part of the song. Read further down to learn more about how the song was constructed.

A Brief Air Quality Guide for PM2.5

Fine particulate matter (PM2.5) is an air pollutant that is a concern for people's health when levels in air are high. Due to their tiny size (two and one half microns or less in width), PM2.5 particles are able to travel deeply into the respiratory tract, reaching the lungs. They can also reduce visibility and cause the air to appear hazy when levels are elevated, sometimes referred to as "smog."

The United States Environmental Protection Agency (EPA) has developed an Air Quality Index (AQI) that is used to report air quality. This AQI is divided into six categories indicating increasing levels of health concern. An AQI value over 300 represents hazardous air quality and below 50 the air quality is good.

Air Quality Index (AQI) PM2.5 Health Effects Statement PM2.5 Cautionary Statement
Good
(0-50)
PM2.5 air pollution poses little or no risk. None
Moderate
(51-100)
Unusually sensitive individuals may experience respiratory symptoms. Unusually sensitive people should consider limiting prolonged outdoor exertion.
Unhealthy for Sensitive Groups
(101-150)
Increasing likelihood of respiratory symptoms in sensitive individuals, aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly. Active children and adults, and people with respiratory disease, such as asthma, should limit prolonged outdoor exertion.
Unhealthy
(151-200)
Increased aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; increased respiratory effects in general population. Active children and adults, and people with respiratory disease, such as asthma, should avoid prolonged outdoor exertion; everyone else, especially children, should limit prolonged outdoor exertion.
Very Unhealthy
(201-300)
Significant aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; significant increase in respiratory effects in general population. Active children and adults, and people with respiratory disease, such as asthma, should avoid all outdoor exertion; everyone else, especially children, should limit outdoor exertion.
Hazardous
(301-500)
Serious aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; serious risk of respiratory effects in general population. Everyone should avoid all outdoor exertion.
Beyond Index
(>500)
Extremely High Levels of PM2.5

Composition & Style

The song composition is entirely algorithmic and is composed of the following building blocks:

  1. Daily PM2.5 Readings in Beijing: the song was generated primarily by looking at cumulative daily readings of air pollutant data spanning three years. The song becomes "polluted" after many consecutive days of unhealthy readings rather than being affected by any single daily reading. Conversely, the song will "clear up" after many consecutive days of good or moderate readings. I decided to create the song in this way because it was more analogous to the impact of pollution on a Beijing resident's health over a longer period of time.
  2. Industrial Music: is a genre of music that generally uses electronic technology (such as synthesizers and white noise ) in a harsh and abrasive manner. I believed this would be the most appropriate types of sounds to sample from since much of China's pollution is driven by its recent industrial and technological boom.
  3. Sound mass (e.g. György Ligeti's Atmosphères ): a concept in music that minimizes the importance of individual pitches in preference for texture and dynamics, and obscures the boundary between sound and noise. It has also been referred to as tone shower, sound crowd, or cloud. I thought this would be the best sonic metaphor for a cloud of smog. At the most hazardous parts of the song, the individual instruments begin to blend into each other , creating a "mass" or a "cloud" of sound where the listener cannot distinguish one instrument from another.

Sounds Used

This song is entirely composed of 38 samples (e.g. , , , , ) from a single Nine Inch Nails track called 32 Ghosts IV . It is from their album Ghosts I–IV, which was not only released under a Creative Commons license, but amazingly, the band made their multitrack sources for every song available for download for free.

Nine Inch Nails is a popular American industrial rock band who regularly uses noise, distortion, and dissonance in their song arrangements. I felt that their musical style and this track's dark and brooding nature had the ideal sound to express the threatening and oppressive nature of air pollution in Beijing.

Data Used

The data used was taken directly from the U.S Embassy Beijing Air Quality Monitor website's historical data files. They provide hourly PM2.5 readings from the past 6 years as downloadable CSV's. For the purpose of my song, I used data from the last three years (2012-2014). I also averaged the hourly readings for each day into daily readings.

Tools & Process

This song was algorithmically generated in that I wrote a computer program that took data and music samples as input and generated the song as output. I did not manually compose any part of this song.

For those interested in replicating, adapting, or extending my process, all of the code and sound files is open source and can be found here. It also contains a comprehensive README to guide you through the setup and configuration. The following is a brief outline of my process:

  1. Based on the project's objective, I decided upon a stylistic and compositional approach.
  2. I then extracted individual instrument samples from the Nine Inch Nail song.
  3. Using Python, a widely used programming language, I:
    1. Calculated daily averages from the hourly air quality data.
    2. Calculated an ongoing "residue" value, which I defined as cumulated pollution for readings exceeding the healthy standard of 50. Multiple, consecutive days of unhealthy readings would result in growing residue. Multiple, consecutive days of normal to moderate readings would result in reduced residue.
    3. Assigned instruments to each day based on the residue value.
    4. Generated a sequence of sounds that correlate to the calculations made in previous 3 steps.
  4. The sequence of sounds from the previous step was fed into ChucK, a programming language for real-time sound synthesis and music creation. I used ChucK because it is really good at generating strongly-timed sequences. The output would then be an audio file that I could listen to.
  5. I then repeated the previous steps numerous times, tweaking the sounds and the algorithms until I was satisfied with the result
  6. I used Processing, a programming language with a visual focus, to generate the visualization using the data above.

If you happen to use my code and create something new, please shoot me an email at hello@brianfoo.com. I'd love to see and share your work!

Q&A

In this section, I will go more deeply into my process as well as document answers to select questions I've received after the initial post.

What inspired you to use air pollution data?

Compared to other environmental issues such as climate change or natural resource depletion, air pollution can be immediately felt. It goes into your lungs when you breathe, and in the case of smog, it blocks your vision. I believe music is good at creating immediate and visceral experiences for listeners. I wanted to create an experience that gives listeners an emotional response and intuitive understanding of the levels of pollution Beijing residents are exposed to on a short and long-term basis. As for the sounds of the song, I wanted emulate the feeling of slowly being surrounded by a cloud of smog.

Can you explain a little more how the song is "polluted"?

Each dot represents a PM 2.5 (particulate matter) particle. Each beat approximately represents one day's average reading of PM 2.5, which generally varies from 0 to over 500 parts per cubic meter. The U.S. considers 50 particles the upper limit for how many particles poses little to no risk on residents' health. So what I did was make every particle above the threshold of 50 stick around for some period of time, thus creating what I call "residue." The higher the number, the longer the particle sticks around for. As more and more particles accumulate, more and more instruments are added to the song. At the peak levels of pollution, the song succumbs to a deluge of instrument sounds. The song only "clears up" after continuous days that are considered good or moderate. I chose this approach because someone's health generally isn't affected by one particular day of bad pollution, but prolonged exposure over time.

Here is a simple graph showing the daily PM2.5 readings over time:

Chart of PM 2.5 readings

Here is a simple graph showing the daily readings juxtaposed with the relative "residue" values:

Chart of PM 2.5 readings and residue

Why Beijing?

Due to it's size and growth, Beijing is one of the many major cities in the world who will have a significant impact on the global climate. I could have done this for a number of cities in the world such as Los Angeles, New Delhi, and Mexico City, but Beijing is the largest and fastest-growing cities in the world. I wanted to focus on one city so it would be a more tangible and direct experience for the listener.

Questions & Feedback

I'd love to hear from you. I'm sure I've also made some erroneous statements somewhere, so please correct me. You can use the widget below or email me at hello@brianfoo.com.

Data-Driven DJ is a series of music experiments that combine data, algorithms, and borrowed sounds.

My goal is to explore new experiences around data consumption beyond the written and visual forms by taking advantage of music's temporal nature and capacity to alter one's mood. Topics will range from social and cultural to health and environmental.

Each song will be made out in the open: the creative process will be documented and published online, and all custom software written will be open-source. Stealing, extending, and remixing are inevitable, welcome, and encouraged. Check out the FAQs for more information.

About me

My name is Brian Foo and I am a programmer and visual artist living and working in New York City. Learn more about what I do on my personal website. You can also follow my work on Twitter, Facebook, Soundcloud, or Vimeo.