0% found this document useful (0 votes)
32 views16 pages

Andrea Valle, Fully Generalized Fibonacci Series Modulo N As Music Sequence Generators

Andrea Valle, Fully generalized Fibonacci series

Uploaded by

NickOl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views16 pages

Andrea Valle, Fully Generalized Fibonacci Series Modulo N As Music Sequence Generators

Andrea Valle, Fully generalized Fibonacci series

Uploaded by

NickOl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

Fully generalized Fibonacci series modulo n as music sequence generators

Cristiano Bocci Andrea Valle


Università di Siena CIRMA - Università di Torino
[email protected] [email protected]

ABSTRACT relation 
F0 = 0
F :  F1 = 1 (1)
In this paper we introduce fully generalized Fibonacci se- Fi = Fi−1 + Fi−2 .
quences as useful tools for the generation of integers that
can be interpreted in the musical context for algorithmic The Fibonacci numbers have been widely studied and
composition. In particular, we take into account the mod- satisfy many and varied identities. Many of the identities
ulo operation on Fibonacci sequences resulting in various involve both addition and multiplication and so the full ring
periodic behaviors that we interpret in the pitch class do- structure of the integers is required to prove them.
main. First we introduce Fibonacci sequences and general- In matrix representation, given
ized Fibonacci sequences, then we discuss the modulo op-  
0 1
erator applied to sequences. We propose various interpre- U=
1 1
tations of the resulting sequences in terms of pitches and
pitch classes, and describe some possible operations. Fi- then  
nally, we introduce fully generalized Fibonacci sequences Fi−1 Fi
and describe a possible implementation in an algorithmic Ui = .
Fi Fi+1
composition environment.
It is worth to mention two other well-known sequences.
• The Pell sequence
1. INTRODUCTION 
P0 = 0
Use of the Fibonacci sequence has a long tradition in 20th P :  P1 = 1 (2)
Century Music. Kramer [1] provides an early account of Pi = 2Pi−1 + Pi−2 .
references including Bartók, Stockhausen and Nono (on
the latter see also [2], on Ferneyhough see [3]). In these • The Lucas sequence
cases, Fibonacci sequences are used to define time propor- 
tion, like in [4]. Mathematical and musicological discus- L0 = 2
sions mostly deal with the relation between Fibonacci se- L :  L1 = 1 (3)
quences and golden ratio (see e.g. [5, 6]). Mongoven [6] Li = Li−1 + Li−2 .
also reports contemporary uses while proposing an appli-
cation to tuning systems. Hence the first 9 steps of the three sequences are
In this paper we are mostly interested in pitch and pitch
i 0 1 2 3 4 5 6 7 8 9 ···
class interpretation of Fibonacci sequences, e.g. when num- Fi 0 1 1 2 3 5 8 13 21 34 ···
bers are mapped onto pitches and pitch classes. First, we Pi 0 1 2 5 12 29 70 169 408 985 ···
discuss some general features of Fibonacci numbers, then Li 2 1 3 4 7 11 18 29 47 76 ···
we consider some musical applications to pitch domain, fi- (4)
nally we generalize Fibonacci sequences and describe pos- Fibonacci, Pell and Lucas sequences are respectively
sible music developments. sequences A000045, A000129 and A000032 in the On-
Line Encyclopedia of Integer Sequences (OEIS) 1 .

2. MATHEMATICAL ASPECTS OF FIBONACCI 3. PISANO PERIODS


SEQUENCES
In the following we consider the sequence F (mod n) ob-
tained by taking the remainders of the Fibonacci sequence
The Fibonacci numbers are the integer numbers in the se- modulo n, where n is an integer. For example, if n = 3
quence (the Fibonacci sequence) defined by the recurrence one has
i 0 1 2 3 4 5 6 7 8 9 ···
Copyright: ©2024 Cristiano Bocci et al. This is an open-access article distributed Fi 0 1 1 2 3 5 8 13 21 34 ···
under the terms of the Creative Commons Attribution License 4.0 International, F (mod 3) 0 1 1 2 0 2 2 1 0 1 ···
which permits unrestricted use, distribution, and reproduction in any medium, pro-
(5)
vided the original author and source are credited. 1 https://oeis.org/

32
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

π(n) 0+ 1+ 2+ 3+ 4+ 5+
+1 1 10 16 30 40 72
+2 3 24 30 48 48 84
+3 8 28 48 40 88 108
+4 6 48 24 36 30 72
+5 20 40 100 80 120 20
+6 24 24 84 24 48 40
+7 16 36 72 76 32 72
+8 12 24 48 18 24 42
+9 24 18 14 56 112 58
+10 60 60 120 60 300 120

Table 1. Pisano periods

F (mod n) is a bi-infinite sequence, that is, given any Figure 1. Plot of the first 10,000 Pisano periods;
two consecutive terms, we can find the terms preceding and Source: Robodile, CC BY-SA 4.0
following those terms. In other terms any pair of consec- https://creativecommons.org/licenses/by-sa/4.0, via Wiki-
utive terms of F (mod n) determines the entire sequence media Commons.
both forward and backward.
Note that there are only n2 pairs of possible terms hence
the serie repeats, and the recurrence of a pair results in As a corollaries we get the following ones.
recurrence of all following terms. By the recursive term in Corollary 3.2.1. if k|n then π(k)|π(n).
(1) and the definition of F (mod n) we have that if Ft+1 ≡
Fs+1 mod n and Ft ≡ Fs mod n then For example, 17|51 and π(17) = 36 divides π(51) =
72. Observe, however that 51/17 = 3 but π(51)/π(17) =
Ft+1 ≡ Fs+1 , · · · , Ft−s+1 ≡ F1 mod n 2. Similarly, 11|22 and π(11) = 10 divides π(22) = 30,
but this time, one has 22/11 = 2 but π(22)/π(11) = 3.
and Ft−s ≡ F0 mod n. Hence we have the following
Corollary 3.2.2. if n has prime factorization
Theorem 3.1 ([7]). F (mod n) forms a simply periodic se-
n = pe11 pe22 · · · penn ,
ries. That is, the series is periodic and repeats by returning
to its starting values. then
Denote by π(n) the least positive integer k such that π(n) = lcm(π(pe11 ), π(pe22 ), . . . , π(penn )).
Fk ≡ 0 mod n and Fk+1 ≡ 1 mod n. Thus, π(n) denotes
the period of F (mod n). For example, according to (5), The following propositions give bounds for π(n).
F (mod 3) has period 8, so π(3) = 8. Proposition 3.2.2. π(n) ≤ 6n, with equality holds if and
Definition 3.1.1. π(n) is called Pisano period of the se- only if n = 2 · 5n .
quence F (mod n). In Figure 1 we can notice that π(250) = 1500 and
π(1250) = 7500 stand out.
The existence of periodic functions in Fibonacci num-
bers was noted by Joseph Louis Lagrange in 1774 [8]. Proposition 3.2.3 ([9]). Given n, let t > 0 such that Lt ≤
In Table 1, the first 60 Pisano periods are shown. Here n where Lt is the t−th Lucas number. Then π(n) ≥ 2t.
the rows represent units while columns represent decimals.
Since 0 represents the initial step, it is important to make
Hence, to check the Pisano period of, for example, 43, it
some considerations about the appearance of 0.
is enough to control the intersection between the column
Note that 0 is in the sequence (as F0 = 0) and since
4+ and the row +3. In Figure 1 there is the plot of the first
F (mod n) is periodic, we get that, for any integer n, in-
10,000 Pisano periods 2 .
finitely many Fibonacci numbers are divisible by n.
We can notice that U k ≡ I mod n precisely when π(n)|k,
where I is the identity matrix 3 . Proposition 3.2.4. The zeros of the sequence F (mod n)
We now collect some results about Pisano periods. are evenly spaced, that is if Fs and Ft are congruent to 0
modulo n, then Fs+t and Fs−t are congruent to 0 modulo
Theorem 3.2 ([7]). For n > 2, π(n) is even.
n.
Proposition 3.2.1. π(lcm(n1 , n2 )) = lcm(π(n1 ), π(n2 )), This follows from the well-know equalities
where lcm is the lowest common multipole.
2
Fs+t = Fs−1 Ft + Fs Ft+1 (6)
A clear visualization of Pisano periods in relation to periodicity has
been proposed by YouTube user Jacob Yatsko here: https://www.
youtube.com/watch?v=o1eLKODSCqw and
3 We remind that | stands for “divides”. Fs−t = (−1)t (Fs Ft+1 − Fs+1 Ft ). (7)

33
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

3.1 Generalized Fibonacci sequences Thus, when we consider this sequence mod n we get
A first kind of generalization of the Fibonacci sequence
rb mod n, b mod n, (r + 1)b mod n, . . .
consists in considering different initial steps. To this aim
we define the sequences G[a,b] of the form This shows that all elements of the sequence are all the
 multiple of b modulo n, independently of the value of r or,
G0 = a
equivalently, of the value of k.
G[a,b] :  G1 = b (8)
Gi = Gi−1 + Gi−2 .
4. FIBONACCI SEQUENCES AND PITCH
for integers a, b. Clearly G[0,1] is the usual Fibonacci se- CLASSES
quence and G[2,1] is the Lucas sequence.
Again, we can consider the sequence G[a,b] (mod n). In Pitch classes are defined in relation to Forte’s set theory for
the following table we have the first steps of G[a,b] and atonal music, where each pitch class (e.g. C representing
G[a,b] (mod n) for a = 3, b = 2 and n = 3: the class of all possible Cs, regardless of octave) is indexed
by an integer number (e.g. 0 for C) (see [10, 11, 12], in
i 0 1 2 3 4 5 6 7 8 ··· other contexts defined as chroma values). In this context,
Gi 3 2 5 7 12 19 31 50 81 ··· we assume: equal temperament; octave equivalence; and
G[3,2] (mod 3) 0 2 2 1 0 1 1 2 2 ··· enharmonic equivalence. The first assumption says that
(9) the octave range ([f, 2f ], where f is frequency)
√ can be di-
vided into 12 equal steps where fi+1 = 12 2fi (12 equal
Proposition 3.2.5. Let a, b, n be integers with m ≥ 2.
temperament, 12-ET)), the second that each corresponding
(a) G[a,b] satisfies Gi = Fi−1 a + Fi b. step in different octaves shares a perceptual ”sameness”
feature, the third that, in relation to Western harmony, al-
(b) G[a,b] (mod n) is periodic. terations are not relevant, so there is properly no difference
among e.g. B♯, C, D♭♭, as they are all represented by pitch
Part (a) of the previous proposition shows an important
class index 0. These three constraints allow for integer no-
link between G[a,b] sequences and Fibonacci sequence F
tation, that is, each step in an equally tempered octave can
and part (b) tells us that sequences G[a,b] have Pisano pe-
be indexed by an integer in the range 0-11. As the pattern
riod.
repeats itself, there are only 12 pitch classes [12].
We denote by π(a, b, n) the Pisano periods of the se-
quences G[a,b] (mod n). We have the following important The first application of Fibonacci numbers to the pitch
result. domain can be traced back to Joseph Schillinger [13]. In
the chapter devoted to Theory of Melody of his System he
Proposition 3.2.6. The Pisano period of G[a,b] (mod n) di- suggests to use Fibonacci sequences as a way to generate
vides the Pisano period of F (mod n), that is pitches, like in Figure 2 (omitting 0, 1). Here Schillinger
is also proposing a specific interpretation of Fibonacci se-
π(a, b, n)|π(n). quences as incremental positive intervals rather than pitch
classes. This means that [0, 1, 1, 2, 3] can be interpreted
Also for π(a, b, n) we have the same results of Proposi- not as C, D♭, D♭, D, E♭ but rather as C, D♭, D, E, G. It can
tion 3.2.1 and Corollaries 3.2.1 and 3.2.2 (see [7]). be easily seen that, due to the accumulation process, num-
Let D = b2 − ab − a2 . The value D plays an important bers mapped onto pitches very soon exceed the available
role to determine π(a, b, n). piano range. As a solution to this problem, Schillinger sug-
Theorem 3.3. If LCD(D, n) = 1 then π(a, b, n) = π(n). gests to transpose each pitch to a viable octave, by means
of “readjustment of the range” [13, p. 334] (Figure 3).
For example, the Lucas sequence has D = −5. Thus, This operation is indeed equivalent to apply mod 12 to
for any n that is not a multiple of 5, the Pisano period of the number. This modulo operation has relevant impli-
the Lucas sequence mod n is the same of F (mod n). cations. Much more recently, Haek [14] has proposed an
Many papers on sequences G[a,b] mainly focus on the application of Fibonacci mod n to serial composition. In
case LCD(a, b) = 1, that is a and b are coprime. However, a 2023 YouTube video, Evanstein presents the application
for the topics of the following sections, also the case in Fibonacci Music Box that deals with modulo application to
which b divides a is of particular interest. In this context, Fibonacci series so to obtain pitch sequences 4 . In the fol-
we establish the following result. lowing we discuss some more general features with num-
ber sequences interpreted as pitch class indices.
Proposition 3.3.1. If a = kb and b divides n then all se-
quences G[kb,b] (mod n) give the same set of numbers, for
all non-negative integers k. 5. FIBONACCI MOD N AND PITCH CLASSES
Proof. Write n = t · b. Given any k, we have k = qn + r In this section we propose an application to the pitch do-
for suitable integers q and r. Thus the sequence G[kb,b] can main of Fibonacci sequences. Generalized Fibonacci se-
be written as quences provide a very simple yet powerful formalism to

(qn + r)b, b, (qn + r + 1)b, (qn + r + 2)b, (qn + r + 3)b, . . . 4 https://www.youtube.com/watch?v=_aIf4WUCNZU

34
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

    
    

Figure 4. Pitch class sequence for a = 2, b = 1, n = 11.

Figure 2. “Unilateral symmetry of Fibonacci series”. into account as a generative cell, such as those used e.g. by
From [13, p. 334] Stravinskij ([15, 16]). Third, it can be exploited as a sort
of weighted pitch class sequence: in the case of Figure 4
pitch class 7 (G) has more occurrences than all the other
pitch classes, so it acts like a “modal” pivot for the whole
sequence. By taking into account the resulting pitch class
set, many analytical features can be explored. Ian Ring’s
website provides an extensive analytical approach to scale
patterns 5 . Ring has automatically computed an extensive
set of analytical features from existing literature. In this
context, a scale is an ordered sequence of pitch classes
starting from 0 and including no intervals < 4. A scale
Figure 3. “Readjustment of the range”. From [13, p. 334] can be represented in bit form with the lowest bit (repre-
senting pitch class 0) at the right. The bit form of the set
{0, 1, 2, 3, 4, 7, 10} is thus [0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1]. This
generate infinite sequences of integers. Thus, they are right- allows to compute the decimal form, that is, 1183. As a
ful candidates to enter the algorithmic composer’s toolbox. scale starts by definition from 0, the decimal is always odd.
As already observed by Schillinger, Fibonacci sequences This number can be used as a pointer to a page in Ring’s
rapidly grow outside a useful pitch range. Modulo appli- website, so to explore the resulting scale pattern in relation
cation solves this issue but at the same time provides a new e.g. to Forte number, Tonnetz, prime form, interval vector,
feature. When modulo n is applied, the result is a cyclic chirality and many others 6 .
pattern that can be interpreted in relation to pitch domain. In short, generalized Fibonacci sequences mod n al-
In this case, pitch sequences are interesting as they pro- lows to generate simultaneously a scale and a repeating
vide a non-uniform distribution of pitches while ensuring melody. A “Sequence Graph” like the one in Figure 7
a variable periodicity. We can start by considering three shows in a compact way this twofold nature for the pre-
cases: viously discussed G[2,1] with n = 11. The pitch sequence
1. n < 12 is [2, 1, 3, 4, 7, 0, 7, 7, 3, 10]. Nodes represent pitch classes
(integers as labels), their radius being proportional to the
2. n = 12 number of occurrences (node 7 is the largest). Edges repre-
sent the sequencing order, as specified by each edge label.
3. n > 12 The graph is by definition directed and cyclic [17]. The
dotted edge indicates the cycle loop and can also be used
5.1 n <12 to quickly identify the starting node. Its label indicates the
While discussing the first case, we also introduce some Pisano period.
general aspects.
If n < 12, then pitch classes ≥ n are necessarily missing 5.2 n = 12
from the resulting cycle. Figure 4 shows the pitch class
pattern for G[2,1] with n = 11 (Lucas Sequence mod 11) All the previous considerations apply to n = 12, with the
(Figure 5 shows a line visualization for the melodic pro- difference that it is indeed possible to create a full chro-
file). It can be observed that pitch class 11 (= B) is miss- matic pitch set (decimal notation: 4095). While this is
ing. But while this holds true by definition, not all the theoretically possible, by considering all combinations of
other 11 pitch classes are present. It is possible to study generalized Fibonacci sequences with 0 < a < 100 and
various features of this pattern. Pitch classes in the se- 1 < b < 100 this does not happen, the best approxima-
quence are only 7, the set being {0, 1, 2, 3, 4, 7, 10}. The tion being the pitch class {0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11},
Pisano period is 10. Finally, the number of occurrences that is, the chromatic set without F♯ (decimal: 4031), in
for each pitch class is the following (in which the items in all cases with π(n) = 24. Figure 8 shows the patterns with
the array indicate occurrences for pitch classes 0 − 11): pitch class set 4031 generated by lowest a (= 0) and b,
[1, 1, 1, 2, 1, 0, 0, 3, 0, 0, 1, 0]. This means that there are respectively 1 (classic Fibonacci sequence) and 5 (G[0,1]
single occurrences of C, C♯, D, E, B♭, 2 occurrences of D♯, and G[0,5] with n = 12). Even in case of the same pitch
3 occurrences of G. Of course, there are no occurrences for class set, still pitch sequences and occurrence counts are
B, but neither for F, F♯, G♯, A (Figure 6). different.
How to interpret the sequence in Figure 4? First, it can 5 https://ianring.com/musictheory/scales/
be seen as a specific melodic form. Second, it can be taken 6 https://ianring.com/musictheory/scales/1183

35
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

Music21 Fragment
Music21


                       
 
12

        
10     

15

8
      
                    
   
18

6
    
               
 

21

4
       
          
     
2
24
      

0
0 2 4 6 8
Figure 9. Patterns for a = 2 and , b = 1 and n =
12, 15, 18, 21, 24.

Figure 5. Melodic profile in a = 2, b = 1, n = 11.


If b = 2, then all sequences with a = kb (where k is
an integer), result in the pitch class set {0, 2, 4, 6, 8, 10},
with π(n) = 24, that is, a whole tone scale. Yet, pitch se-
quences are different, with different occurrence counts. In
short, various hexatonic patterns can be generated. When
3.0
b = 4, then all sequences with a = kb result in the pitch
2.5
class set {0, 4, 8}, with n = 8, that is, an augmented triad.
Similarly, with b = 3 and a = kb, the pitch class set is
2.0 {0, 3, 6, 9}, a diminished 7th chord.
In general, by Proposition 3.3.1, if b is a divisor of n,
1.5 then all sequences G[kb,b] (mod n) result in the same set of
pitch classes.
1.0

0.5
5.3 n >12
If n is greater than 12 all the previous considerations apply
0.0
0 2 4 6 8 10 but the obtained remainders result in a range of more than
one octave. This feature can be exploited in order to dis-
tribute pitches over a larger span, in this sense privileging
Figure 6. Occurrences for pitch classes in a = 2, b = 1, a pitch interpretation rather than a pitch class one. Figure
n = 11. 9 shows Lucas sequence (G[2,1] ) with five moduli ranging
from n = 12 (top) to n = 24 (bottom). Meter is kept in the
music notation so that different Pisano periods are clearly
visible (respectively: 24, 8, 24, 16, 24). Extension of pitch
range is clearly visible, and in particular top and bottom se-
quences (n = 12 and n = 24) show how the same pitches
are distributed over 1 and 2 octaves respectively.
This approach leads to interesting results in terms of
pitch sequences but does not allow to take into account the
analytical features discussed in subsections 5.1 and 5.2, as
those features apply not to pitches but to pitch classes. A
Figure 7. Sequence Graph for in a = 2, b = 1, n = 11. second approach can thus be proposed so to exploit the
richness of variable n while still placing the discussion at
the pitch class level. The algorithm is the following:
1. Generate a generalized Fibonacci sequence G
          
         

        2. Apply modulo n > 12 to G so to get G1
0, 1

3. Apply modulo n1 = 12 to G1 so to get G2


                         G2 represents a sequence of pitches in the range [0, 1, ..., 11],
    
0, 5

that is one octave, and actual pitches can be interpreted as


pitch classes. Figure 10 shows the further application of
Figure 8. Patterns for a = 0 and , b = 1 (top) and b = 5 modulo n = 12 to the patterns from Figure 9. Pitch pat-
(bottom). terns with n = 12 and n = 24 (top and bottom) result in
the same pitch class sequence.

36
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

Music21 Fragment
Music21

                                        
 
12

H0 = a
     H[a,b,k1 ,k2 ,s] :  H1 = b
15           
Hi = k1 Hi−1 + k2 Hi−2 + s.
(12)

18                               where a, b, k1 , k2 , s are integers. Parameters a and b pro-
vide the initial steps, while k1 and k2 determine the size
                                
21
  of the recursive steps and s is called the shift of the se-
quence. Obviously the Fibonacci sequence F corresponds
to H[0,1,1,1,0] , the sequences G[a,b] are obtained for H[a,b,1,1,0]
24                                                  Finally, with H[0,1,k,1,0] we get the k−fibonacci sequences
Fk .
A larger amount of different sequences can be obtained
Figure 10. Patterns from Figure 9 with further n1 = 12. by changing some parameters in the definition of Fibonacci
recursion laws. By means of generalization a very large
palette of numerical sequences becomes easily available
6. MORE GENERALIZATIONS to the music composer. Moreover, use of moduli intro-
The classic Fibonacci sequence allows for several gener- duces further richness. The previous discussion has shown
alizations. An interesting case is given by the so-called how it may be complex to choose in advance the generator
k−Fibonacci sequence [18]: parameters that lead to a certain sequence without empir-
ically verifying the results. In this sense, an experimen-
tal approach is the most viable approach to explore fully

Fk,0 = 0
Fk :  Fk,1 = 1 (10) generalized Fibonacci sequences, as slight modifications
Fk,i = kFk,i−1 + Fk,i−2 . of available parameters may have dramatic effects. As an
example, let us consider the fully generalized Lucas se-
If k = 2, the Pell sequence appears. If k = 3 we get the quence H[2,1,3,5,3] , with n = 23 and n1 = 12. The Pisano
following sequence period is very large (π(n) = 176) and the sequence graph
particularly complex, as it can be seen in Figure 11. In
i 0 1 2 3 4 5 6 7 8 ··· a computational environment for algorithmic composition,
F3,i 0 1 3 10 33 109 360 1189 3927 ··· visualization and sonification displays allow to navigate
(11) these kinds of datascapes.
The k−Fibonacci sequences satisfy nice properties. For
example the following ones show useful relationship among 7. IMPLEMENTATION
the terms of the sequence:
Implementation of fully generalized Fibonacci sequences
• Catalan’s identity: is straightforward. Listing 1 shows two Python functions
fiboR and fiboI that compute a sequence of length ln
2 2
Fk,n−r Fk,n+r − Fk,n = (−1)n+1−r Fk,n ; by passing a, b, k1, k2, s as arguments. The first
is recursive, the second iterative. Length must be empiri-
• Simson’s identity: cally large enough to comprise Pisano period (here, 1000).
Modulo can be applied by making use of list comprehen-
2
Fk,n−1 Fk,n+1 − Fk,n = (−1)n ; sion on the resulting seq sequence (line 9) by applying n
and then n1 = 12 so to get pitch classes. Here we are com-
puting H[2,1,3,5,3] with n = 23 and n1 = 12 as discussed
• d’Ocagne’s identity:
in section 6.
Fk,m Fk,n+1 − Fk,m+1 Fk,n = (−1)n Fk,m−n . 1 def fiboR(a=0, b=1, k1=1, k2=1, s=0, seq = [], i
= 0, ln = 1000):
2 if i < ln:
3 c = (a*k1) + (b*k2) + s
More properties, with details of the proofs can be found 4 seq.append(c)
in [19, 20, 21]. 5 fiboR(b, c, k1, k2, s, seq, i+1, ln)
6 return [a,b]+seq
Also for this sequences we can talk of Pisano period 7
thanks to the following result. 8 def fiboI(a=0, b=1, k1=1, k2=1, s=0, ln=1000):
9 seq = [a, b]
10 for x in range(ln):
Theorem 6.1 ([18]). Fk (mod n) is a simple periodic se- 11 a, b = b, (a*k1) + (b*k2) + s
12 seq.append(b)
quence. 13 return seq
14
In particular, the results of Corollaries 3.2.1 and 3.2.2 15 n = 23
16 seq = [(x % n) % 12 for x in fiboI(2,1,3,5,3)]
are valid also for k−Fibonacci sequences.
Taking a step further, as a new contribution, we define Listing 1. Python example.
fully generalized Fibonacci as in the following:

37
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

Functions for period estimation and for data analysis explore pitch class set composition, occurrence distribu-
(e.g. occurrence count) and conversion (e.g. decimal nota- tion, Pisano period. In short, fully generalized Fibonacci
tion of pitch class set) are similarly trivial. Jupyter Note- sequences are useful tools for algorithmic composition.
book 7 provides a web-based computing platform that of- The previous discussion focused on pitch classed based
fers an interactive environment for Python development 8 . on 12-ET. We can think of extending the approach by tak-
In the context of algorithmic composition, Jupyter Note- ing into account non-integer numbers. As an example,
book allows to exploit the large ecosystem of Python li- 4 mod 2.5 = 1.5. Fractional parts can be interpreted
braries. As an example, after computing the decimal repre- as semitone fractions, like in MIDI notation, where e.g.
sentation of a pitch class set, by means of the webbrowser 60.5 indicates a middle C raised of a quarter tone. In-
module it is possible to automatically access Ian Ring’s deed, other fractions can be obtained. Non-integers can
pages dedicated to that scale. Figures 5 and 6 have been be applied in fully generalized Fibonacci both to param-
generated using the standard matplotlib module for eters a, b, k1 , k2 , s and to mod n. If holding the octave
plotting. The sequence graph in Figure 7 has been gener- constraint, by further applying mod n = 12 it is pos-
ated with the pydot module, a Python interface for Graphviz sible to create non-12-ET pitch class sets. In relation to
[22]. The same module has been used to generate the se- this, a different approach to be explored is to define a spe-
quence graph for H[2,1,3,5,3] with n = 23 and n1 = 12 cific mapping function that maps the output integers from
computed in Listing 1, shown in Figure 11. The Python H onto specific sets of non-integers values. Finally, while
Music21package provides an integrated bridge towards mu- we consider pitch and pitch class interpretation as partic-
sic computation and notation [23]. It includes functional- ularly promising, fully generalized Fibonacci mod n can
ities to analyse, plot and notate music data. In relation to be used to generate values to control arbitrary cycling pa-
music notation, it allows to generate MusicXML that can rameters for sound and music computing. As a suggestion,
be further manipulated in music notation softwares (e.g. periodic sequences can be used to fill looping wavetables
Musescore 9 ). Like the other previously mentioned mod- for audio synthesis. In this sense, one can think of Figure
ules, Music21 can be directly accessed via Jupyter Note- 5 as a wavetable plot. An interesting feature is that these
book, so that notation output can be displayed in the Note- wavetables are amplitude limited, as the amplitude range
book itself (via Musescore backend) and results can be is by definition in the range [0, n − 1], where n is the last
heard (via MIDI playback). All music examples (Figg. 4, applied modulo.
8, 9, 10), have been generated via Music21 and Musescore.
Further data sonification can be obtained by the direct us- 9. REFERENCES
age of the SuperCollider 10 environment into Jupyter Note-
book by means of the sc3nb Python-interface [24]. [1] J. Kramer, “The Fibonacci Series in Twentieth-Century
Music,” Journal of Music Theory, vol. 17, no. 1,
pp. 110–148, 1973.
8. CONCLUSIONS AND FUTURE
DEVELOPMENTS [2] J. Kochavi, The Fibonacci Sequence as Metric Sus-
pension in Luigi Nono’s Il Canto Sospeso, ch. Chapter
Fully generalized Fibonacci sequences are simple yet pow- 5, Mathematical Music Theory, pp. 83–108. WORLD
erful generative devices that results in complex, unpredictable SCIENTIFIC, 2018.
patterns that, once the modulo operation is applied, never-
theless lead to repeating organizations. These sequences [3] G. Albert, “Weakening Structures or Structuring Mis-
can be interpreted in the music domain in various ways. takes? Brian Ferneyhough’s Manipulation of the Fi-
In our proposal, we mapped integers onto indices for pitch bonacci Sequence in his Second String Quartet,” Mit-
and pitch class description. In the latter case, modulo 12 teilungen der Paul Sacher Stiftung, vol. 28, pp. 55–60,
is the key operation that enables to lead back the obtained 2015.
results to the vast music theory literature dedicated to the
[4] E. L. Lowman, “An Example of Fibonacci Numbers
topic. It is worth mentioning that obtained sequences can
Used to Generate Rhythmic Values in Modern Music,”
indeed be manipulated further. As an example, transpo-
The Fibonacci Quarterly, vol. 4, no. 9, pp. 423–26,
sition results in adding a factor t to all the integers in a
1971.
sequence. As the operation is obvious, we have focused on
sequence properties rather than on pitch classes in them- [5] A. Shannon, I. Klamka, and R. van Gend, “Generalized
selves (e.g. we have not taken into account that Fibonacci Fibonacci Numbers and Music,” JOURNAL OF AD-
starts on C while Lucas on D, as pitch organization can be VANCES IN MATHEMATICS, vol. 14, pp. 7564–7579,
transposed at will). Fully generalized Fibonacci sequences 05 2018.
favors an experimental, empirical approach, as through com-
putational environments it is possible for each sequence to [6] C. Mongoven, “A Style of Music characterized by Fi-
bonacci and the Golden Ratio,” Congressus Numeran-
7 https://jupyter.org/ tium, 01 2010.
8 See the implementation on colab: https://github.com/
vanderaalle/FullyGeneralizedFibonacciSequences/ [7] D. Wall, “Fibonacci series modulo m,” The American
blob/main/FibonacciModuloN.ipynb
9 https://musescore.org/ Mathematical Monthly, vol. 67, no. 6, pp. 525–532,
10 https://supercollider.github.io/ 1960.

38
XXIV CIM – Atti/Proceedings - Torino, 30/09–02/10 2024

[8] D. Fulton and W. L. Morris, “On Arithmetical func-


tions related to the Fibonacci numbers,” Acta Arith-
metica, vol. 16, 1969.
[9] A. Catlin, “A lower bound for the period of the
Fibonacci series modulo m,” Fibonacci Quarterly,
vol. 12, pp. 349–350, 1974.
[10] A. Forte, The Structure of Atonal Music. Yale Univer-
sity Press, 1973.
[11] J. Rahn, Basic Atonal Theory. Longman music series,
Longman, 1980.
[12] J. Straus, Introduction to Post-tonal Theory. Prentice
Hall, 1990.
[13] J. Schillinger, L. Dowling, and A. Shaw, The
Schillinger System of Musical Composition. C. Fischer,
Incorporated, 1946.
[14] J. Haek, “Residue Cycles of Fibonacci Series Mod-
ulo m as Tools for Serial Composition,” Perspectives
of New Music, vol. 46, no. 2, pp. 33–58, 2008.
[15] J. N. Straus, “A Strategy of Large-Scale Organization
in Stravinsky’s Late Music,” Intégral, vol. 11, pp. 1–
36, 1997.
[16] A. Rehding, “Towards A ’Logic of Discontinuity’
in Stravinsky’s ’Symphonies of Wind Instruments’:
Hasty, Kramer and Straus Reconsidered,” Music Anal-
ysis, vol. 17, no. 1, pp. 39–65, 1998.
[17] R. Diestel, Graph Theory. Springer, August 2005.
[18] A. Falcon and A. Plaza, “k−Fibonacci sequences mod-
ulo m,” Chaos Solitons & Fractals, vol. 41, pp. 497–
504, 2009.
[19] A. Falcon and A. Plaza, “On the Fibonacci
k−numbers,” Chaos Solitons & Fractals, vol. 32,
no. 5, p. 1615–1624, 2007.
[20] A. Falcon and A. Plaza, “The k−Fibonacci sequence
and the Pascal 2−triangle,” Chaos Solitons & Fractals,
vol. 33, no. 1, pp. 38–49, 2007.
[21] A. Falcon and A. Plaza, “On k−Fibonacci sequences
and polynomials and their derivatives,” Chaos Solitons
& Fractals, vol. 39, pp. 1005–1019, 2007.
[22] E. R. Gansner and S. C. North, “An open graph visu-
alization system and its applications to software engi-
neering,” Software: Practice and Experience, vol. 30,
no. 11, pp. 1203–1233, 2000.
[23] M. S. Cuthbert and C. Ariza, “Music21: A Toolkit
for Computer-Aided Musicology and Symbolic Mu-
sic Data,” in ISMIR (J. S. Downie and R. C. Veltkamp,
eds.), pp. 637–642, 2010.
[24] T. Hermann and D. Reinsch, “sc3nb: a Python-
Figure 11. Graph for H[2,1,3,5,3] with n = 23 and n1 = SuperCollider Interface for Auditory Data Science,”
12. in Proceedings of the 16th International Audio
Mostly Conference, AM ’21, (New York, NY, USA),
p. 208–215, 2021.

39

You might also like