Gil Sperling

video, stage and music

Sound Composition in p5.js

November 20, 2019 by gilsperling

with Zhoujian Sheng

An algorithm which takes someone’s phone number and turns it into music.

Each number on the keypad is translated into a tone on the western scale, key of C major (C through E for 0-9). Then different number strings are assigned different musical instruments and different tempi.


One challenge was choosing sounds that would work well together. After initially using the oscillator function, we decided to find samples of live instrument online and pitch-manipulate them. One observation, is that the more you bend the pitch of a recorded sound, the less it sounds like the original instrument being sampled. We settled on piano, cello, trumpet and flute as our ensemble.

Once the algorithm is created, it is easy to switch to a different scale by changing the ratios in the scale array. Here is the same sketch, using a scale that evenly divides an octave to intervals of 1.111. The result sounds more… ominous?

Further directions might include ways of making each phone number based composition more unique, for example by tying the base frequency to a function of all the digits in the number, playing a set of numbers in chorus etc.

Posted in Fall '19 - Introduction to Computational Media |

Comments are closed.