# Numbers Into Notes

“Supposing, for instance, that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations, the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent.”   Ada Lovelace, 1843

Fibonacci

Each number is the sum of the previous two. If we start with 0, 1 we get the sequence commonly known as the Fibonacci numbers 0, 1, 1, 2, 3, 5, 8, 13, ... (could also start 1, 1). If we start with 2, 1 we get the Lucas numbers 2, 1, 3, 4, 7, 11, 18, ... (could also start 1, 3). The sequences are described mathematically by the relation Fk,n+1 = kFk,n + Fk,n-1 where k = 1.

n0: n1: k:

Powers

The sequence of powers of 2 is 20, 21, 22, 23, ... i.e. 1, 2, 4, 8, 16, 32 etc. Here you can generate the sequence of powers of 2 or any other number, known as the base.

base:

Other Algorithms

How might Ada Lovelace have calculated these?

Tribonacci

Like Fibonacci, but each number is the sum of the previous three. Another of many variations on Fibonacci.

n0: n1: n2:

Triangular and Factorials

Triangular numbers are the sequence of sums 1, 1 + 2, 1 + 2 + 3, 1 + 2 + 3 + 4, ....

Factorial numbers are the sequence of products 1, 1 x 2, 1 x 2 x 3, 1 x 2 x 3 x 4, ...

Sinusoidal

This is an approximation to a sine wave, the sequence described by the equation a + a.sin(rθ)

a: r:

Bernoulli

Bernouill numbers are generated here using the algorithm described by Ada Lovelace. The numbers are a sequence of fractions, so we provide a sequence of numerators or a sequence of denominators.

### The Sequence

Modulo

We reduce each of the numbers in the sequence using modular arithmetic (clock arithmetic). We divide each number by mod and keep the remainder, so all the numbers will be between 0 and mod - 1.

mod:

Logarithms

Logarithms are included here to help visualize the growth of the sequences. Log10 of 10 is 1, 100 is 2, 1000 is 3, etc (logs of zero or negative numbers will appear as 0).

### The Numbers

 length mod period

Press Display to show a 'number roll' visualization of the sequence, with time from left to right and numbers going up. The mapping of numbers to notes can be modified as you wish using the buttons below the number roll. Press the Play button to play the sequence as eighth notes (quavers), or the 4 or 2 buttons to play quarter or half notes, with piano or xylophone sounds. The mouse selects a subset of notes to be played, and holding the shift key down modifies the current selection. Sust causes notes to be sustained so that you can hear them alongside each other. You can also change the tempo (beats per minute). The Life button produces the next generation of the number roll according to the rules of the Game of Life (devised 1970), and the Cat button transforms a square iteratively (inspired by Arnold's Cat, 1960s) so that it returns to normal after a Pisano period. Pressing Display resets the display at any time.

Choose which pitch and octave the number 0 corresponds to (e.g. C1), then click on a scale or generate one from intervals (e.g. 2 2 1 2 2 2 1, or WWHWWWH, or TTSTTTS). Pressing any buttons will regenerate the mapping table, which comes into effect next time you play.

### Generate Scale from Intervals

Here you can see the note sequence in various data formats, which you can copy and paste to export this data to other software tools—Lilypond to display notes in music notation, MIDI CSV to generate Standard MIDI files, or an image of the number roll. If you are running this web page from a server that supports conversions automatically then you will see Generate PDF and Generate MIDI buttons, which open a new browser window. Metadata specified here (e.g. a title) is included in the exported files, and you can also generate a provenance graph which describes how your output was generated.

 Sequence Rows Columns Pitch Octave Intervals Selection BPM

### Provenance (prov-n)

Please email Numbers into Notes with any questions, bug reports, and suggestions for new features. This application is currently only supported on Chrome and Firefox.

Written by David De Roure, December 2015, for the Ada Lovelace Symposium and as an interactive demonstration to encourage discussion about music, mathematics, and programming at the time of Ada Lovelace. Thanks to Emily Howard and Lasse Rempe-Gillen for their inspiration through Ada sketches, to Pip Willcox for jointly organising the Numbers into Notes project, and to all our colleagues for feedback and ideas. This research is supported by the Transforming Musicology project funded by the Arts and Humanities Research Council, and the FAST project funded by the Engineering and Physical Sciences Research Council.

When this application is run online, the logs maintained by the server include the IP address of the client, the referring web page, and the user agent (browser). This information is used for debugging and developing the software, and may be summarised in aggregate form to report usage in publicly available documents. We do not use cookies. When export format conversion functionality is enabled, exported Lilypond and MIDI files are stored on the server on a temporary basis and are available to anyone with the appropriate URLs: they are stored for access, to assist with debugging and demonstrating the operation of the program, and in order to analyse and report on usage.