“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
The first stage in this interactive demonstration is to generate a sequence of numbers using an algorithm that might have been run on the Analytical Engine. In stage 2 you reduce these numbers to a smaller range of numbers, using 'clock arithmetic'. Then in stage 3, you can visualize and play the number sequence interactively, and explore the mapping of the numbers to musical notes. If this is your first visit, try the green buttons. NB This program has been developed and tested in Chrome and Firefox browsers.
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:
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.
How might Ada Lovelace have calculated these?
Like Fibonacci, but each number is the sum of the previous three. Another of many variations on Fibonacci.
n0: n1: n2:
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, ...
This is an approximation to a sine wave, the sequence described by the equation a + a.sin(rθ)
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.
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.
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).
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.
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.
This tool was developed to generate Fibonacci numbers and reduce them with clock arithmetic, generating a periodic sequence which is then mapped to notes, and the music explored by selecting fragments to play (Lagrange noted periodic functions in Fibonacci numbers in 1774, and the period is known as the Pisano period). Additional algorithms have been added to stimulate discussion of mathematical calculations on the Analytical Engine, contemplating what Ada Lovelace and Charles Babbage might have done if the engine had been built. Powers is included as it is the example in the Ada sketches operatic work composed by Emily Howard. The other examples are:
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.