User:Leandroferlin/sandbox

A musical composition networks is a network representation that describes a melody as set of connected nodes.

Musical composition network from Bach violin sonatas.

Overview edit

A melody is a sequence of notes that may or may not have intervals between each pair of pitches.

As a key component of melodies, notes can be represented as a pitch and an associated duration. In this sense, a musical composition network can be constructed by considering nodes as notes and links as connection between notes chronologically subsequent [1].

Network construction edit

Nodes edit

In modern musical notation, a note resume the combination of a pitch and a duration. A Pitch represents the fundamental frequency of the sound, and the duration indicate how much it last.

The standardized pitch system — A440 system — states that the relation between a pitch p and a frequency f can be seen as:

 

Notes and rests can be considered the building blocks of a melody. In a musical composition network, the nodes should be designed as either:

  • A pitch and its duration
  • A rest and its duration

Thus, nodes in the network can be fully qualified by the pitch and it duration in case of notes, and only a duration in case of a interval between notes.

Links edit

To construct the network, links can be described as connections between two notes as it is chronologically played in the analysed piece of music[1].

Let  ,   and   be notes played at times  ,   and  , chronologically ordered. We can define the links between these notes as   and  .

More generally, given two subsequent notes   and  , we can determine a link   as follows:

 

Weight edit

The property weight of links in a musical network can be described as follows: suppose that in a piece of music, a note   and subsequently note   are played. We determine the weight   of the ling   in this scenario as being 1. Suppose now that, as the music is played, the notes   and   appear again in the melody — notice that a note is represented by the concatenation of its pitch and its duration, thus the same node would be seen multiple times in the same music. Now, we increment the weight   by 1, assigning 2 to it. This process continue until the music ends, and the weight   is considered as being number of time that the edges   appears in the music.

Scale-free property edit

 
Scale-free property from Chopin's musical network.

Scale-free networks are networks whose node's degree follows a power law distribution. In other words, in a scale-free network, the probability P(k) of a node have degree k can be described as:

 

Musical composition networks may follow a scale-free distribution with power law exponent ranging from 1 to 2[1][2].

However, not all pieces of musics may present the scale-free property[3].

Furthermore, musical networks displays the small-world phenomenon — in these networks, most of the nodes are not neighbors of other nodes but neighbors of a random node are likely to be neighbors between themselves.

Music generation from networks edit

Due it is likely that music composition networks follows a scale-free distribution and have the small-world property, it would be possible to generate a appealing melodies based on a controlled random walk algorithm.

The algorithm should starts with a musical composition network as the input. A melody can be seen, in simple words, as a sequence of notes. Thus, we can start from a random node and elect the next one based on some decision rule.

The algorithm should ends when the actual node do not have any outgoing link or if a maximum number of node have been reached.

The decision rule to chose the next node in the melody should be, for example, the neighbor whose link has the greater weight.

A simple algorithm considering the max value of the neighbor's weight is presented bellow:

GenerateMelodyFrom(network, maxLength):
    
    melody ← []
    nodeActual ← getRandomNodeFrom(network)
    
    while (melody.length < maxLength) and (nodeActual.hasOutgoingLink()), do:
        nextNode ← getMaxWeightNeighbor(nodeActual)
        melody.append(nextNode)

See also edit

References edit

  1. ^ a b c Liu, Xiao Fan; Tse, Chi K.; Small, Michael (January 2010). "Complex network structure of musical compositions: Algorithmic generation of appealing music". Physica A: Statistical Mechanics and its Applications. 389 (1): 126–132. doi:10.1016/j.physa.2009.08.035.
  2. ^ Ferretti, Stefano (July 2018). "On the complex network structure of musical pieces: analysis of some use cases from different music genres". Multimedia Tools and Applications. 77 (13): 16003–16029. doi:10.1007/s11042-017-5175-y. ISSN 1380-7501.
  3. ^ Rolla, Vitor; Kestenberg, Juliano; Velho, Luiz (2018-02-01). "The complexity of classical music networks". EPL (Europhysics Letters). 121 (3): 38005. doi:10.1209/0295-5075/121/38005. ISSN 0295-5075.