# How does a number correspond to a sound when listening to an OEIS sequence?

I noticed that the OEIS allows you to listen to a sequence. It converts a sequence of integers to sounds somehow, but I can't find any information on which numbers correspond to which sounds. The OEIS wiki page doesn't contain any further information.

Could anybody explain how sounds are associated to integers? Presumably higher numbers always have a higher pitch. Is there some function $f$ such that a sound of frequency $f(n)$ is played when $n$ appears in the sequence? If so, what is $f$?

• If you would like a quick understanding of the number to note method, check out oeis.org/A123456 and oeis.org/A144488 These are Fur Elise as a sequence. Jul 17, 2015 at 2:36

Before transpositions and such, it works, effectively, like this:

$$P(n)=\begin{cases}A&n\equiv9\mod12\\A\sharp&n\equiv10\mod12\\B&n\equiv11\mod12\\C&n\equiv0\mod12\\C\sharp&n\equiv1\mod12\\D&n\equiv2\mod12\\D\sharp&n\equiv3\mod12\\E&n\equiv4\mod12\\F&n\equiv5\mod12\\F\sharp&n\equiv6\mod12\\G&n\equiv7\mod12\\G\sharp&n\equiv8\mod12\end{cases}$$ $$O(n)=\left\lfloor\frac{n}{12}\right\rfloor$$

Where $P$ is the note name and $O$ is the octave number.

EDIT:

In western music, there are 8 "notes" per octave (though there are 12 actual tones). The notes in one octave are obtained from the previous octave by doubling the frequency. For example, $A4$ has a frequency of $440$ Hz, so $A3$ is $220$ Hz and $A5$ is $880$ Hz. The notes in a single octave are related by specific ratios of frequencies that are dependent on a few factors which can be read about here.

Transposition, in music, is the act of moving the notes of a song up or down based on the needs of key, instrument, and a number of other factors. For example, if you wanted to transpose $A4$ up 6 tones, you would get $D\sharp5$ (since the octave starts, traditionally, at $C$ and has period $12$).

So, the method by which OEIS does its "Listen to this Sequence" stuff works, more finely, like this:

1. Add to the terms of the sequence the amount being transposed.
5. (Player) Interpret hexadecimal values for terms from sequence as $P(n)$ and $O(n)$ from above.
For a list of Western music note frequencies, see here. Of course, it is cheaper on memory to just store the base frequency of $A4\rightarrow440$ and adjust from there.