APPLICATIONS OF QUANTUM ANNEALING TO MUSIC THEORY

Ashish Arya 
Ludmila Botelho
Fabiola Cañete
Dhruvi Kapadia
Özlem Salehi
"...might compose elaborate and scientific pieces of music of any degree of complexity or extent"

Ada Lovelace

Charles Babbage

Quantum annealing

Proposition: Find the minimum energy in a landscape

  • Ground state = optimal solution

$$ H(t) = \left(1-\frac{t}{T}\right)H_0+  \frac{t}{T}H_P  $$

  • Different from gate based

$$ H_P = - \sum_{i > j} J_{ij}s_i s_j - \sum _i h_is_i, $$

$$ H(t) = \left(1-\frac{t}{T}\right)H_0+  \frac{t}{T}H_P  $$

- Can be encoded in Binary Values

Ising model

  • Mathematical model to describe magnetization

\( s_i \in \{-1,+1\} \)

NP-hard!

\(  s_i \leftrightarrow x_i = \frac{1-s_i}{2} \)

\( x_i \in\{0,1\} \)

quadratic unconstrained binary optimization

  • Minimizing quadratic functions

$$ y=x^TQx $$

  • Penalty Method

$$ \text{min  } y=f(x) $$

$$ \text{subject to:  } x_1 +x_2 + x_3= 1 $$

$$\text{min }y=f(x)+P\left(\sum_{i=1}^3 x_i -1\right)^2 $$

Binary variables

Constants

And now for something completely different

Music Generation

4

1

rest

measure

Durations

2

Pitches

C

D

A

E

G

F

B

C

Music Generation

x_{i,j} = \begin{cases}% 1 & \text{note at position $i$ is $j$,}\\ 0 & \text{otherwise.} \end{cases}

$$\sum_{j \in P} x_{i,j} = 1$$

How to define the binary variables?

$$\left ( 1- \sum_{j \in P} x_{i,j} \right )^2$$

  • Pitches
  • Rules about consecutive notes

$$x_{i,C} + x_{i+1,D} \leq 1$$

$$x_{i,C} + x_{i+1,C} + x_{i+2,C} \leq 2 $$

$$P=\{p_1,p_2,\dots,p_k \}$$

\(x_{i,j}\) for \(i \in [n]\) and \(j \in P\)

$$P=\{\mathtt{C}, \mathtt{D}, \mathtt{E}, \mathtt{G}\}$$

Melody Generation

Optimization

$$ -\sum_{ \substack{i\in [n-1]  \\ j,j' \in P}} W_{j,j'} x_{i,j} x_{i+1,j'} $$

weights

Exemple: Ode to Joy excerpt

$$W_{F\#4,E4} = 2, $$

$$W_{F\#4,F\#4} = 2,$$

$$W_{F\#4,G4} = 1$$

melody Generation

    $$\sum_{\substack{i \in [n] \\ j \in D}} d(j)y_{i,j} = L$$

  • Duration of notes
y_{i,j} = \begin{cases}% 1 & \text{note at position $i$ has duration $j$,}\\ 0 & \text{otherwise.} \end{cases}

Rhythm Generation

$$ \sum_{j \in D} y_{i,j} = 1$$

    $$D = \{1,2,3,4\}$$

    $$j \in D$$

Harmonization

x_{i,j} = \begin{cases}% 1 & \text{chord at position $i$ contains note $j$,}\\ 0 & \text{otherwise.} \end{cases}

$$\sum_{j \in P} x_{i,j} = 3$$

$$(1-x_{i,p_{i_j}})$$

G

E

D

G

B

B

G

And now for something Different

Markov random fields (MRF)

  • Set of random variables (0,1) that form an undirected graph and satisfy the Markov property.

Music with MRF

  • Antecedent: Algorythms, Generating music with D-Wave's Quantum Annealer (iQuHack 2021)
  • D-Wave's Markov Network

HARMONIZATION WITH MRF

  • Our work: harmonize a melody implementing music theory rules.

Results

Melody                                                                                Harmonized melody 

Thank you!

Dziękuję!

Obrigada!

धन्यवाद!

 Teşekkür ederim!

Köszönöm!

ধন্যবাদ !

Made with Slides.com