1 Introduction

Fix \(n \in \mathbb {N}\). Let \(S_n\) be the set whose elements \(s_j\), \(j \in \{0, \ldots ,n-1\}\), are sets of intervals of \(\frac{12}{n} j\) semitones, including its octaves; in other words,

$$\begin{aligned} s_j =\left\{ \frac{12}{n}j + 12m \text{ semitones } \mid m \in \mathbb {Z}\right\} . \end{aligned}$$
(1)

Fixing n as a divisor of 12 we have the sets \(S_1\), \(S_2\), \(S_3\), \(S_4\), \(S_6\) and \(S_{12}\) whose elements are equivalence classes. We shall name elements in \(S_n\) using letters in ascending order starting from the letter a.

  • \(S_1=\left\{ a=\left[ 0\right] \right\} \)

  • \(S_2=\left\{ a=\left[ 0\right] , b=\left[ \frac{12}{2}\right] \right\} \)

  • ...

  • \(S_6=\left\{ a=\left[ 0\right] , b=\left[ \frac{12}{6}\right] , c=\left[ \frac{12}{6}2\right] , d=\left[ \frac{12}{6}3\right] , e=\left[ \frac{12}{6}4\right] ,\right. \) \(\left. f=\left[ \frac{12}{6}5\right] \right\} \)

Now we define the operation \(+\) as the usual modular arithmetic, that is \(\left[ x\right] +\left[ y\right] =\left[ x+y\right] \). E.g. for \(a,b,f\in S_6\):

\(b+f=\left[ 2\,\text {semitones}+10\,\text {semitones}\right] =\left[ 12\,\text {semitones}\right] =a\).

We see that \(\left( S_n,\,+\,\right) \) is a group with a being the identity element. Now lets define \(g:S_n\rightarrow \mathbb {Z}_n\), \(g\left( s_j\right) =\left[ j\right] \), \(j \in \{0, \ldots ,n-1\}\), it is clear that g is an isomorphism from \(S_n\) to \(\mathbb {Z}_n\).

As an example we show the elements in \(S_4\) using middle \(\textit{do}\) (i.e. \(\textit{do}_4\)),Footnote 1 as reference for counting intervals: , where each pitch corresponds to each element in \(S_4\). Since elements in \(S_n\) are equivalence classes we have 6 partitioned sets that can be visually represented as subsets of \(S_{12}\), being \(S_{12}\) the set of all pitches in the chromatic scale:

figure b

2 \((L(S_n),\circ )\)

Let \(L\left( S_n\right) \) be an infinite set of infinite strings with elements in \(S_n\) concatenated in every possible order; also, each string has an infinite string of only a to the right. That is, for \(S_2\), \(a\overline{a}\),Footnote 2 \(b\overline{a},ab\overline{a},babbabab\overline{a}\) are in \(L\left( S_2\right) \). For convenience we won’t write the infinite string of a that goes with every element in \(L\left( S_n\right) \), this way \(babbabab\overline{a}\) will be just babbabab, also \(a\overline{a}\) will be just a. This way we can represent pitch sequences as elements of \(L\left( S_n\right) \), that is representing the movement of the melody by sequences of musical intervals. For instance, the sequence is seen as the element abab in \(L\left( S_2\right) \). We note that having \(\overline{a}\) to the right adds nothing to music since it is a, identity element in \(S_n\), concatenated infinitely times and it adds no intervals.

This is how \(abbbbb\in L\left( S_6\right) \) is seen in a staff:

figure d

This is the whole-tone scale starting at do \(_4\), the other whole-tone scale can be generated in reference to do \(\sharp _4\). Every possible sequence of sounds produced by the use of this scale can be seen as an element of \(L\left( S_6\right) \). It is trivial to note that every sequence of sounds, as long as it uses some or all of the 12 pitches (disregarding enharmonics) in Western music can be seen in \(L\left( S_{12}\right) \) since the latest set includes all possible sequence of intervals. Also, by fixing any \(n\in \mathbb {N}\) and not just divisors of 12 we can extend \(S_n\) and later \(L(S_n)\) to microtonality. Obviously we may encompass whole-tone scales using the same concepts.

Let’s start with a whole-tone scale example. We take a look at Debussy’s first two bars of Prelude No. 2, Voiles, from his First book of Preludes for piano [3]:

figure e

We can represent the upper melody in reference to do \(_4\) as \(effffaf\in L\left( S_6\right) \) and the lower melody as \(cffffff\in L\left( S_6\right) \). Whole-tone elements are present in much of Debussy’s repertoire. Just to mention few examples: everything from Voiles except 6 bars; the solo between the English horn and the cello at the end of the first movement in La Mer, and a number of passages in Les Images, livre I for piano solo.

Let \(s,\grave{s} \in L\left( S_n\right) \), \(s=[s_{1}][s_{2}]\dots [s_n]\dots , \grave{s}=[\grave{s}_{1}][\grave{s}_{2}]\dots [\grave{s_n}]\dots \) Now we define the \(\circ \) operation as a coordinate-wise addition in the sense of \(s\circ \grave{s}=[s_{1}+\grave{s}_{1}][s_{2}+\grave{s}_{2}]\dots [s_n+\grave{s_n}]\dots \) We note that the length of s and \(\grave{s}\) does not matter since every element in \(L\left( S_n\right) \) has \(\overline{a}\) to the right; this means there will always be an a to operate. \((L(S_n),\circ )\) is a group with \(\overline{a}\) being the identity element.Footnote 3 In the following example we look at the first beat, bar no. 31 of Jeux d’eau for solo piano from Ravel [2] . Using \(\left( L\left( S_6\right) ,\circ \right) \) in reference to \(do_4\) the upper melody performed with the right hand, la \(\sharp \) la \(\sharp \) fa\(\sharp \) sol \(\sharp \) can be represented as the faeb element in \(L\left( S_6\right) \), now we arbitrarily select face and operate \(faeb\circ face\) and we obtain eaaf which is the second beat: . Now we represent the upper melody in right hand from bars 31 and 32 of Jeux d’eau (Fig. 1) as follows: bar 31, beat 1: faeb in reference to \(do_4\); bar 1, beat 2: \(faeb\circ face=eaaf\); bar 31, beat 3: \(eaaf\circ baec=faeb\); bar 31, beat 4: \(faeb\circ face=eaaf\); bar 32, beat 1: \(eaaf\circ baac=faef\); bar 32, beat 2: \(faef\circ faac=eaeb\); bar 32, beat 3: \(eaeb\circ faaa=daeb\); bar 32, beat 4: caec in reference to \(do\sharp _4\).

Fig. 1
figure 1

Jeux d’eau, Ravel, bars 31 and 32

Next we explain the example 25 from Julián Carrillo’s treatise Leyes de metamorfósis musicales [Music’s Metamorphosis Laws][1] using \((L(S_n),\circ )\). Here Carrillo shows a “Major scale metamorphosed to its duple” (Fig. 2).

Fig. 2
figure 2

Carrillo’s example 25

This is the result of doubling every interval in a major scale: where there was 1 semitone now there is 2 semitones and so on. Using \((L(S_n),\circ )\) we represent every pitch sequence as a sequence of musical intervals. For a Major scale (Fig. 3) that is the element accbcccb in \(L(S_{12})\):

Fig. 3
figure 3

Major scale, \(accbcccb \in L(S_{12})\)

Now we do \(accbcccb \circ accbcccb = aeeceeec\). Since \(\circ \) operation is a coordinate-wise addition, the result of operating accbcccb to itself is adding every interval in itself (see: Fig. 4).

Fig. 4
figure 4

\(aeeceeec \in L(S_{12})\)

This is the ascending part of the Major scale metamorphosed to its duple shown above. Following this process we obtain aeeceeeclkkkekk which is the whole example 25. We conclude that a Metamorphosis to its duple (according to Carrillo’s laws of Metamorphosis) can be seen as an element in \(L(S_{12})\) operated to itself.

At the beginning of this exposition we defined n as a divisor of 12 which leaded to 6 different sets, but, as mentioned before, we can extend \(S_n\) to microtonality if we choose a different \(n \in \mathbb {N}\) to produce an \(S_n\) whose elements are additions of any arbitrary division of the octave. Then we use the obtained \(S_n\) and expand it to \(L(S_n)\) and \((L(S_n),\circ )\). An example is given with fixed \(n=13\):

  • \(S_{13}=\left\{ a=\left[ 0\right] , b=\left[ \frac{12}{13}\right] , c=\left[ \frac{12}{13}2\right] , d=\left[ \frac{12}{13}3\right] ,\right. \) \(\ldots ,\) \(l=\left[ \frac{12}{13}11\right] ,m= \left. \left[ \frac{12}{13}12\right] \right\} \)

3 Piph Music for Algorithmic Composition

For a first example on algorithmic composition using number representation, it is convenient to quote one of the first compositions systematically using irrational numbers: \(\pi \) (A game within the Circle’s Constant)[4] is an awarded composition by Gabriel Pareyon, that uses the first 1000 digits of \(\pi \) in order to produce a solo for the bass flute. This composition associates every chromatic pitch to each digit starting by 0 as do, 1 as do \(\sharp \) and so on.

figure h

In the leftmost part of this example we see the first sound: re \(\sharp \) corresponding to 3, then do \(\sharp \) corresponding to 1. Afterwards we find the succession 4, 1, 5, 9, 2, 6, 5, 3, 5 where each digit has its defined pitch. We see that for any 1 we will always find a do \(\sharp \) while a 9 will always be la.

As a creative possibility of \((L(S_n),\circ )\) we present a different algorithm (Fig. 5) capable of reading any given finite number and returning the sequence of pitches (as equivalence classes) in order to compose music:

  1. 1.

    Read first digit \(d\ne 0\) and define d instruments.

  2. 2.

    Start with the first instrument, i.e. instrument counter equals 1.

  3. 3.

    Next digit n defines the number of n pitches for the current bar.

  4. 4.

    For each of the next n digits applyFootnote 4 \(g^{-1}:\mathbb {Z}_n \rightarrow S_n\) and consider the corresponding element in \(L(S_n)\) for the current bar, e.g. 021 will be \(acb\in L(S_n)\).

  5. 5.

    Check if the instrument counter is bigger than the first digit d.

  6. 5.1.

    If not, increase instrument counter and repeat step 3.

  7. 5.2.

    If yes, is this the end of the given number?

  8. 5.2.1.

    If not, repeat step 2.

  9. 5.2.2.

    If yes, end.

Fig. 5
figure 5

\((L(S_n),\circ )\) algorithm flowchart

The use of digits in this algorithm limits the number of instruments in the score and the number of pitches to a maximum of 9. Also, due to the decimal system there is not much \((L(S_n),\circ )\) interesting options, but this “lack”can be solved using two digits instead of one for each process. Later we will see a different algorithm capable to obtain a finite number from a score. Since by now we do not consider any rhythmic, nor dynamical values, this leads, if waned, to different musical values arising from the same finite number and vice versa.

What results from using the algorithm proposed by Pareyon is different to what results using the \((L(S_n),\circ )\) algorithm. Since we understand every element in \((L(S_n),\circ )\) as a melody that results in adding intervals, it is not obvious to find a pitch with its corresponding digit, but will be easy to understand a whole melody as a sequence of digits.

As a consequent exercise we prepared a music scoreFootnote 5 for two treble and one bass clefs from the number \(\pi \) up to the digit 190 using \((L(S_6),\circ )\) and starting in do. Metre was assigned in equal durations \(\left( \frac{1}{1}\right) \).

The first digit in \(\pi \) is 3, meaning 3 instruments. Next we find 14, this means 1 pitch, element 4 in \((L(S_6),\circ )\) corresponding to 8 semitones; since we start in do the pitch must be sol \(\sharp \). Next there is 15, meaning 1 pitch, element 5 in \((L(S_6),\circ )\), that is la \(\sharp \). Next 10 digits are 9265358979, meaning 9 pitches, element 265358979 in \((L(S_6),\circ )\). Below are the first four bars with a space between bars where every bold digit, the start of a new instrument, assigns how many pitches correspond for current bar: 3. 14159265358979 3238462643383 27950288419 71693993751058209749445923.

figure i

Five bars later there is a triple consecutive digits occurrence in the bass clef: 81284811174502:

figure j

Using the algorithm with more digits of \(\pi \) we would reach the Feynman point 999999 which would result in the addition of the same 9 element in given \(S_n\).

Since we observe that any non-trivially repeated numerical sequence, like \(\pi \) (and typically other irrationals), contains phrases (i.e. sequences of ordered digits with their own sequential expressiveness), then we can extend a generalized Piph Music as a branch of Group Theory. We use the term Piph after the given example of \(\pi \) as music (Pi), containing segments of musical concatenation (phrase, therefore making the name \({Pi+ph}\) for any phrasing extracted from irrational numbers segmentation).Footnote 6

4 Translating a Piece of Music into a Single Number

By the reverse usage of the algorithm shown above, we can translate a piece of music into a single finite number. The process we follow is:

  1. 1.

    Number of instruments defines first d digit.

  2. 2.

    Start with the first instrument, i.e. instrument counter equals 1.

  3. 3.

    Count the number of pitches in the current bar and define the next n digit.

  4. 4.

    Next n digits are obtained applyingFootnote 7 \(g:S_n\rightarrow \mathbb {Z}_n\) to the corresponding \(L(S_n)\) element in the current bar, e.g. abc is 012.

  5. 5.

    Increase the instrument counter and check if this is bigger than the first digit d.

  6. 5.1.

    If not, increase instrument counter and repeat step 3.

  7. 5.2.

    If yes, is this the end of the piece of music?

  8. 5.2.1.

    If not, repeat step 2.

  9. 5.2.2.

    If yes, end.

For the last example (Fig. 6) we apply a variation of the proposed algorithm to the instrumental (teponaztlis) passage Macuilli, Chicuei and Matlactli (that is Five, Eight and Ten, in Nahuatl language) in the musical score Xochicuicatl Cuecuechtli, also composed by Pareyon [5]:

Fig. 6
figure 6

Pareyon’s Xochicuicatl Cuecuechtli (2012), excerpt from the manuscript’s page 26, with three teponaztlis (wooden, carved log instruments) with the labels Macuilli, Chicuei and Matlactli (i.e. 5, 8, 10)

For the numerical translation of this excerpt, we use \((L(S_2),\circ )\) with 1, \(b\in S_2\), being the element that changes between high and low pitch and 0, \(a\in S_2\) the identity element. Next we numerically represent this example, with a space between bars where every bold digit represents the start of a different instrument: 3 0 30000 5101000 0 0 0 3000 0 5101000 5101000 0 0 5101000 0 0 510100 5101000 0 0 2000.

Although this number is “mathematically useless”, it may be useful to fulfil a number sequence abstraction, such as the textural-orchestrational pattern, like 030500003050500050005500020 (i.e. only taking into account bold numbers), or rather in order to abstract the contrapuntal number 353555552 as the key number of this segment, in turn able to be treated as a source for musical development from the same source.