maximum duration


number of sounds


number of repeated sounds


A large number and two pairs of timestamps denote a time bracket. The beginning and ending of each time bracket is chosen by picking a time value within the range denoted by each timestamp pair. The large number denotes a sound to be played once within the time bracket. One sound should be chosen for each unique large number and can be long or very short.

This website is an attempt to randomly generate a score in the style of a John Cage number piece using JavaScript and jQuery. The maximum duration slider dictates the maximum duration of the score desired. I have included coin flip random number generators to decide if the time brackets generated actually start at 0'00" or end with the maximum duration. However, the first timestamp of the piece and the last timestamp will not fall within the inner 80% of the desired duration (10% in, 10% left). The number of sounds slider specifies the number of sounds desired in the score while the number of repeated sounds slider dictates how many times any sound appears twice or more.

In generating the score, I first fill an array of integers 1-n inclusive, one for each sound. I then choose randomly from the array an integer to repeat, which is then pushed to the array. I then use the Fisher-Yates algorithm to shuffle this array. This results in the final ordering of the big numbers for each bracket. The duration array consists of four entries to every one of the entries in the sound array (four = two pairs of time stamps). These entries are integers corresponding to the eventual timestamps (m'ss") but in seconds. Before randomly generating the duration array's entries, I call a coin flip function to determine whether or not to start at 0'00" and whether to end at the maximum duration. This is overridden if the resulting length of the piece is smaller than the number of sounds multiplied by the number of repeated sounds. In the generation of the array, I make sure that each random integer is unique (there are no duplicates in the array). Obviously, this cannot hold if the previous statement about the length and the multiplied value is not true by the pigeonhole principle. In this case, I limit the number of tries of generating unique numbers to ten per number. After the array is generated, I use a quicksort algorithm to sort the array.

More information about me or my projects can be found at