Ecological Approaches to Quantifying ( Bio ) Diversity in Music

Ecological Approaches to Quantifying (Bio)Diversity in Music David G. Angeler *,1 and José Benavent-Corai 2 1 Swedish University of Agricultural Sciences, Department of Aquatic Sciences and Assessment, Box 7050, 750 07 Uppsala, Sweden; Tel.: +46 73 028 8535; E-mail: david.angeler@slu.se 2 Cavanilles Institute for Biodiversity and Evolutionary Biology, Universidad de Valencia, Paterna, Spain; Tel.: +34 686 90 54 26; E-mail: jose.benavent.corai@gmail.com


Introduction
The application of mathematical and statistical tools has contributed to the growth of musicology as a quantitative science, complementing qualitative, subjective approaches.A gamut of methods has been used, and has potential, to objectively identify information content and complexity in music.Such methods include, for instance, exploratory data mining in musical spaces, global measures of structure and randomness, time series analysis, hierarchical modeling, Markov Chain Monte Carlo (MCMC) models, circular statistics, principal component analysis, discriminant analysis and non-parametric multidimensional scaling (Beran, 2003).From a computational perspective, a significant increase in algorithm accuracy and efficiency in recent years helped improve quantification, improving our knowledge related to, for instance, melody and chord estimation, beat tracking, mood and genre estimation, and pattern analysis (Pesek et al., 2017).
Many numerical approaches used in music are clearly of transdisciplinary application.MCMC modeling has been applied in disparate sciences such as physics, ecology, speech recognition, bioinformatics and economics.There exist also quantification methods that have been applied for addressing research questions within a specific field, but which so far have found little or no application in other scientific disciplines (e.g., Sundstrom et al., 2014).It is clear that approaches from other scientific fields provide opportunities for alternative testing of aspects of music theory.Such analysis might provide new insights that may complement those obtained by currently applied methods.Such transdisciplinary application of methods can be of special use within musicology (Beran, 2004), because they could help address knowledge gaps and stimulate further research within the field.This paper borrows an analysis approach from ecology, which allows for testing music theory.The rationale builds on the recognition that patterns in ecology (Allen et al., 2014) and music, at the composition (Lehrdahl & Jackendoff, 1983) and sociomusicological system level (Angeler, 2016a), are hierarchically structured.In music, structure occurs at the scale of a section, phrase or motif and at the scale that spans the entire work (Baffioni et al., 1981).Similarly, in ecological systems, structure occurs at the scale of an individual ecosystem but also at the scale of an entire region in which ecosystems are embedded.Georgescu & Georgescu (1990) systems approach to music is an example, which strikingly matches ecological theory regarding ecosystem organization.They recognize three structural core concepts that allow contextualizing ecological approaches to the quantification of structure in music.The first concept relates to "wholeness", which refers to the emergence of structure beyond the sum of components.We relate this concept to the scale of an entire musical composition or a region of ecosystems.Their second concept emphasizes "order", which they define as the subsystems that can be isolated and studied.Ecosystems embedded in a region can be considered such subsystems and are analogous to specific sections in a composition.
The third concept is "centralization", an integrative feature that pulls a work together and makes units subservient to a single organizing principle, harmonic progression.We consider the progression aspect as a manifestation of how patterns of combinations of different pitches and duration of notations change from one measure to the next in an entire composition ("turnover").Similarly, in an ecosystem turnover manifests in how sets of species differ across ecosystems in a region.
Based on this rationale, we contextualize an ecological analysis approach for quantifying structure in music.We first discuss the suitability of the presented approach, making structural analogies between ecology and music.We then demonstrate the ecological analysis approach using specifically generated examples and real compositions with varying degrees of complexity.We conclude with discussing potential applications within musicology research.

Music meets biodiversity research
The ecological approach presented here is designed to study biodiversity, a long tradition in ecology, which is often motivated by the loss of animal and plant species due to environmental change pressures, like global warming or exotic species invasions.Ecologists have used a plethora of measures to quantify different properties of biodiversity.That is, biodiversity has become an umbrella term for different diversity phenomena; for instance: 1) Species richness, or simply richness, quantifies the number of animal and plant species within an ecosystem (e.g., a lake).Richness alone ignores how abundant species are; 2) Shannon entropy (expH'), a measure derived from information theory that has also a broad and long application tradition in musicology for assessing structural complexity (Youngblood, 1958;Knopoff & Hutchinson, 1983;Pearce, 2007;Hansen & Pearce, 2012).As in music, Shannon entropy in ecology emphasizes similar structural complexity.It integrates both the occurrence of species and their abundances in a single metric.This measure is often referred to as diversity to discern it from richness; and 3) Evenness assesses the equality of species in term of their abundances in an ecosystem.It essentially compares the dominance structure across species in ecosystems and summarizes it in a single metric.It is derived by division of diversity with richness and the resulting values are bound between 0 (a highly uneven community; a few species are highly dominant) to 1 (every species has the same abundances; perfect evenness).
These metrics can be used for studying patterns at different hierarchical scales.
That is, measures of richness, diversity and evenness can be assessed for a single ecosystem, which ecologists refer to as alpha diversity, and for a number of ecosystems within a region (e.g., a landscape of lakes; gamma diversity).How assemblages of plants and animals differ across ecosystems in a region can also be quantified and expressed by a measure of differentiation (beta diversity).That is, beta diversity accounts both for the relationship between the diversity at the scale of individual ecosystems and the degree of differentiation among ecosystems.
It is beyond the scope of this paper to present detailed information about mathematical deduction and the pure ecological meaning of the biodiversity measures used in this study.Such information can be found in Baselga (2010), Tuomisto (2010, 2012) and Jost (2007;2010).For a more general description of biodiversity in ecology see Magurran (2004).Angeler & Drakare (2013) provide an ecological example for this type of biodiversity analysis.
There are striking similarities between ecosystems and musical composition, which suggests that ecological approaches to quantifying structure of species assemblages in ecosystems can be used for assessing structure in music scores.This study applies the ecological concept of alpha, beta and gamma biodiversity to, and contextualizes it, within music (Table 1).We regard compositions as "equivalents" of ecological systems, which share structural properties that are conducive to biodiversity measurements.Specifically, we view notes as equivalents of species, measures within a composition as a single ecosystem, and the sum of measures within a composition (i.e. the entire song) as the landscape composed of ecosystems (Table 1).These equivalents comprise the building blocks for calculating alpha diversity (at the scale of measure), gamma diversity (at the scale of the song) and beta diversity (differentiation in the composition of notes across measures within a song) in music (Table 1).This differentiation essentially accounts for the hierarchical organization of musical compositions.The alpha, beta and gamma diversity equivalents are aligned with the components wholeness, order, and centralization in the theoretical systems approach to music by Georgescu & Georgescu (1990).

Study examples
To demonstrate the approach for assessing biodiversity in music at different levels of complexity (alpha, beta and gamma diversity), three examples were composed for the piano.Note the approach is not limited to the piano; it is broader applicable to other instruments and orchestra.The examples were composed in the freeware MuseScore 2.0.3 by one of the authors (DGA).Gauging the performance of numerical approaches in the analysis of music is recommended (Witten & Cronklin, 1990).Our examples therefore had an ascending level of complexity and followed certain rules.That is, all three examples were in C major, used a 4/4 time signature and had 15 measures (Figure 1).The first example was the most basic.Every measure consisted of one whole note (treble clef) and one whole rest (bass clef).The notes c 2 and d 2 alternated between measures in the treble clef, while whole rests were applied in the bass clef throughout all measures.Complexity was increased in the second example (Figure 1).In this example, the same treble clef notation was maintained while variation in the bass clef notation was added relative to example 1.This variation was comprised of a whole rest in addition to different notes and their duration patterns among measures.These patterns were repeated every four measures.The third example was the most complex (Figure 1).It was composed to have unique combinations and duration of notes and rests in each measure.Note that this example was composed entirely randomly and is not meant to represent a harmonic song structure.
In addition to these demonstration examples we also used two songs from different, arbitrarily selected genres with different levels of complexity.The first is a popular English lullaby (Twinkle Twinkle Little Star; sheet in Appendix 1), which is very simple in structure.The second belongs to the genre of minimalist music titled "Buzz Holling" (sheet in Appendix 1), composed by the first author, which has a higher level of complexity compared to the lullaby.
Both the demonstration and "real" examples used in this study have been specifically chosen to test the hypothesis that increasing complexity in song structure increases alpha, beta, and gamma diversity in the songs.That is, increasing variability in pitch and duration patterns of notes across measures increases alpha and gamma diversity.In turn, with higher variability across measures, they become more differentiated from each other, so that beta diversity increases.

Matrix preparation
For analyzing biodiversity components in the songs we prepared matrices in Microsoft Excel, which followed essentially the style used in ecological analyses of biodiversity.
That is, every single measure in the song was treated as a musical equivalent of an ecosystem embedded in a landscape.Thus, the notations of each measure were ordered in a single row and served to calculate alpha diversity.The sequence of measures in the compositions was organized serially, so that measure 1 comprised the first row, the second measure the second row, and so forth.At the end of the matrix (after the last measure in each song) an additional row was added and the sum of values calculated across rows.This served to calculate gamma diversity in the whole composition.The notes and rests, as the equivalents of animal or plant species within ecosystems, were organized in columns.Every note or rest was considered one diversity unit per measure (Table 1).We treated every note distinctly; that is, different durations of the same note (e.g., c 1 whole and c 1 quarter or half rest, quarter rest and sixteenth rest) were coded as different diversity units.Notations in both the treble and bass clef were quantified together for each measure.Notes and rests of the same type were quantified according to their occurrence in the measures (i.e., if three F quarter notes occurred in one measure in either the treble or bass clef then this note scored 3. Identically, if only a single quarter rest occurred in a measure, it scored 1; etc. (Table 1)).In the preparation of the matrix for the Buzz Holling song, articulations, ties and dynamics were ignored for codification to allow for individual notes to comprise an equivalent of a biological species.

Analyses
In this study, we borrowed from the field of ecology to quantify biodiversity in songs at different scales (Table 1).That is, we assessed biodiversity at the level of individual measures (i.e., notes within a measure; alpha diversity), 2) across measures at the entire song level (notes across measures comprise gamma diversity), and 3) the structural differentiation of notes across measures in an entire song (beta diversity).In this study, following ecological nomenclature, we use biodiversity as an umbrella term for different diversity metrics: 1) richness (which only quantifies the occurrence of notes), 2) diversity (exponentiated Shannon entropy; expH').This metric accounts both for the occurrences of notes and their abundances in a song; exponentiation of Shannon entropy is carried out in ecology for achieving mathematically correct comparison with richness; Jost (2007), Baselga (2010); and 3) evenness, which expresses how even notations occur in a song in term of their abundances (definitions in Table 1).Alpha diversity and gamma diversity for richness and diversity were calculated in the Primer 6 (Primer-E, Plymouth, UK) software for Windows.Beta diversity was calculated following Whittaker's (1960;1972) multiplicative partitioning method (beta diversity equals gamma diversity divided by averaged alpha diversity).Evenness was calculated by dividing diversity with richness (Tuomisto, 2012).

Results
Biodiversity measures increased with increasing complexity of song structures in the examples and real songs (Table 2).These increases were observed at the alpha, beta and gamma diversity level, independent of the biodiversity measures used (richness, diversity, evenness).Example 1 with its most simple structure had a mean alpha richness of 2, showing that each measure had consistently 2 notations (one full note, one full rest) (Figure 1).The gamma richness value in this example was three, showing that at the entire song level 3 notations occurred (full c 2 , full d 2 , full rest).Beta richness in this example was 1.50; it shows the differentiation between notations at the gamma and mean alpha level.That is, across measures one notation (whole rest in the bass clef) was shared, while the alternation of notes (c 2 , d 2 ) between measures in the treble clef resulted to the contribution of each note to half of the composition (Figure 1).Diversity (Shannon entropy; expH') in this example shows deviations relative to the richness results.Beta (1.41) and gamma (2.83) diversity were slightly lower relative to richness values, while alpha diversity showed the same value (2.00).These differences can be explained by the unequal occurrence of notes in the entire example.
That is, there occurred 8 full c 2 while only 7 full d 2 were present in the 15 measures.
The slight dominance of c 2 over d 2 results in a marginally uneven structure in the composition.This unevenness decreased beta and gamma diversity values because these different abundances are accounted for in Shannon entropy.In turn, these differences manifest also in evenness values.Because Shannon entropy and richness had the same alpha values, evenness was perfect (value = 1).This means that there is no difference in the abundance structure of notes at the level of measures.By contrast, gamma evenness was slightly lower (0.94) than alpha evenness.This reflects the slight difference in the abundance structure of notes at the level of the entire example.
The examination of biodiversity patterns in example 1 is relatively simple but becomes more difficult with the increasing complexity of the other examples.Our biodiversity calculations allow for identifying objectively the differences among examples.They also allow contextualizing this complexity with that present in the real songs.Gamma richness and diversity showed the highest increase from example 1 to 3, with richness increasing 20 times (from 3 to 60.16) and diversity 25 times (from 2.83 to 72) (Table 2).Less pronounced were these increases for beta biodiversity (7.5 and 2 times for diversity and richness, respectively), and alpha biodiversity (3.4 times, diversity; 3.2 times, richness) (Table 2).Despite these changes, evenness values were equal or higher to 0.84 (Table 2).Because evenness values are bound between 0 (highly uneven) and 1 (perfect evenness), this shows a relatively homogenous dominance structure of notations across examples.
Comparing the real songs with the examples showed that richness and diversity values at the beta and gamma level of Twinkle Twinkle Little Star fell between examples 2 and 3, while its alpha richness and diversity fell between examples 1 and 2 (Table 2).Richness and diversity values at the beta and gamma level of the Buzz Holling score exceeded approximately twice the values of example 3. The alpha richness and diversity of this song were slightly lower than those of example 3.

Discussion
This paper's main aim is to demonstrate a transdisciplinary approach to the objective and simultaneous analysis of diversity at different hierarchical levels in musical compositions.Several applications, which were beyond the scope of this paper, can be envisioned for future research in musicology.Selected applications can focus, for instance, on the evaluation of how much individual instruments contribute to the diversity in orchestral performances or on the comparison of the complexity in compositions among composers.Also studying the variability of musical diversity within and across genres is a further possibility for research.Such analysis can target phylogenetic and ontogenetic developments in music.That is, phylogenetic analysis may allow assessing how genres of music, reflected in the diversity of compositions, develop over time and across geographical regions.Numerical analyses can complement currently existing subjective qualitative analysis of genre evolution (e.g., Angeler, 2016a), and target the analysis of disparate genres such as electronic dance music, classical music, tribal music and heavy metal.Ontogenetic studies may allow assessing how the diversity of compositions changes during a composer's, band's or orchestra's lifetime.Constant experimentation with music is a critical component in the work of many artists (e.g., Bob Dylan; Boucher & Browning, 2015), as it is in music at large, and numerical analysis using the approach suggested here could help assess how diversity in their work changes as a function of this experimentation.
We agree with Beran (2004) that there is a certain risk that music could lose its charm, once numbers explains it.However, from a scientific viewpoint, the quantification approach presented here allows for explicit hypothesis testing to obtain knowledge through deductive inference.Hypothetical-deductive inference, a common scientific method, might unravel many of the unknown intricacies of music, not only as a form of complex adaptive system within the (acoustic) arts (Leman, 1990), but also as a broader socio-musicological system in which music and people are strictly interlinked (Angeler, 2016a).
Musicologists have recognized the difficulty with many complex quantitative models (e.g., predictive, probabilistic, hierarchical modeling; cellular automata), to often capture and reflect genuine musical principles (Witten & Conklin, 1990).Such difficulties may arise because modeling frequently requires complex parameterization that may lead to a misrepresentation of phenomena under study (Mouchart & Orsi, 2016).In this regard, the biodiversity analysis approach presented here has little risk.
It does not require a priori parameter setting before calculations.The approach rather extracts information present in the subjects; it let's the musical compositions themselves "tell the structure".Thus, one benefit that may derive from a biodiversity analysis in music is that it can provide a numerical benchmark against which the performance of more complex hierarchical models can be assessed and potential recalibration informed.Such an application seems especially suitable for making comparisons based on information theoretical analysis because measurements such as Shannon entropy are common in both quantitative musicological modeling (Pearce, 2007) and diversity studies in ecology (Magurran 2004;this study).
A further benefit that derives from the biodiversity analysis approach presented here is that different "phenomena" present in musical compositions can be studied simultaneously.That is, ecologists consider evenness, richness and diversity to represent different aspects in the characterization of complex assemblages of animals and plants in the environment.These different measures thus help making nature's complexity more tractable, particularly if it can be assessed at different hierarchical scales (alpha, beta and gamma diversity).Musical compositions can undoubtedly also be hierarchically structured (Lehrdahl & Jackendoff, 1983), and many can reach high levels of complexity, for instance the compositions of the New Complexity genre (Fox, 2001).Objectively analyzing and understanding such complexity has long intrigued music scholars.Studying different structural phenomena across hierarchical scales in composition using the ecological approach demonstrated in this paper can assist them as a complement to existing modeling methods in their endeavors to scrutinize complexity.
The relationship between structure and complexity in music and human cognition has been long recognized (Meyer, 1967).It is beyond our aim to speculate about the value of biodiversity analysis to study psychological aspects related to music.
However, we point to recent research, which used biodiversity analysis for assessing structure in visual art works (Angeler, 2016b).Such an analysis might find similar applications in music research.Angeler (2016b) proposed that "numbers" could provide a common measure stick against which people's subjective perceptions of art can be gauged.Such a process might help to re-conceptualize "seeing" (or hearing) as questioning (Thomsen, 2015).In turn, inquiring through questioning might facilitate information processing and trigger a learning process (Wyer & Srull, 1986).Through this process perceptional uncertainty, which also characterizes music (Clayton et al., 2013), could be reduced.Numerically underpinning structure in music can potentially help listeners comprehend complexity in music.
We conclude with acknowledging that the biodiversity terminology used in this paper is ecological.This choice was deliberate to emphasize that the application of the biodiversity framework to music is borrowed from the field of ecology.Not only does this give credit to its origin, but also reduces the risk of "reinventing the wheel".Arguably musicologists may feel uncomfortable using this terminology.It is far from our aim to impose it; we rather consider that adaptations of terms in a more specific music context, made by and for musicologists, will improve effective communication and potential application of the biodiversity analysis framework.Such adaptation of terminology, while acknowledging its origin, could potentially contribute to the needed perception of musicology as an integral part of interdisciplinary science (Naveda, 2015;Angeler 2016a).

Figure legends Figure 1 :
Figure legends

Table 1 :
Description of ecological biodiversity measures and their contextualization within and application to music.