MarkovComposer

Abstract

Algorithms, or algorithmic composition, have been used to compose music for centuries. For example, Western punctus contra punctum can be sometimes reduced to algorithmic determinacy. Then, why not use fast-learning computers capable of billions of calculations per second to do what they do best, to follow algorithms?

Markov chain?

Markov chain, named after Andrey Andreyevich Markov, is a (pseudo)random process of transition from one state to another. The transition is "memoryless" and it only depends on the current state and on the probabilities (saved in a so-called transition matrix). Sequence of events that preceeded the current state should in no way determine the transition. This "memorylessness" is also called Markov property. In short, transiting from one state to another is a random process based on probability.

The general idea

Markov chain is just plain perfect for algorithmic music compositions. Notes (128 of them) are used as possible states. For the implementation, I'm using a second order Markov chain, meaning two previous states (two previous notes) determine the next state and nothing else. All of the transition probabilites are stored in a 2^14x2^7 matrix. As input, the composer takes two integer values (0 <= n, m <= 127) representing 2 starting notes. Based on that the algorithm calculates/generates the next note and the generation process goes ad infinitum (until you stop it, that is). Pitch of the notes and spacing between two notes is also stored in the Markov chain.

Samples

Just an example what can Markov composer do. Based on a little bit of testing, there are probably a lot more, a lot better generated compositions.

Live demonstration

If you want to see MarkovComposer in action, but you don't want to mess with the Java code, you can access a web version of it here. Source of the web version is avaiable here.

Implementation

A detailed explanation can be found in the following blog post: Markov Composer - Using machine learning and a Markov chain to compose music



MarkovComposer

摘要

算法或算法组合已被用于组合音乐几个世纪。例如,西方 punctus contra punctum 有时可以减少到算法确定性。那么为什么不使用每秒能够进行数十亿计算的快速学习计算机来做最好的操作呢?遵循算法?

马尔可夫链?

马尔可夫链,以安德烈·安德烈耶维奇马可夫(Andre Andreyevich Markov)命名,是从一个州到另一个州的(伪)随机过程。转换是无记忆,它只取决于当前状态和概率(保存在所谓的转换矩阵中)。先于当前状态的事件的顺序决不能确定转换。这种无记忆也被称为马尔可夫财产。简而言之,从一个状态转移到另一个状态是基于概率的随机过程

一般想法

马可夫链对算法音乐作品来说完全是完美的。笔记(其中128个)被用作可能的状态。为了实现,我使用二阶马尔科夫链,意思是以前的两个状态(两个前面的注释)确定下一个状态,没有别的。所有转换概率都存储在2 ^ 14x2 ^ 7矩阵中。作为输入,作曲家获取代表2个起始音符的两个整数值(0 <= n,m <= 127)。基于该算法计算/生成下一个音符,并且生成过程进入无限制(直到您停止它,就是这样)。笔记之间的间距和两个笔记之间的间距也存储在马尔可夫链中。

样本

马可夫作曲家可以做一个例子。基于一些测试,可能会有更多的,更好的生成组合。

现场演示

如果要查看MarkovComposer的操作,但您不想混淆Java代码,则可以访问其网页版本这里。网站版本的来源可以此处

实现

详细的解释可以在以下博文中找到:




相关问题推荐