Deep Learning Techniques for Music Generation
Performance RNN
MusicVAE
Wavenet
Abstract
五个维度分析:
- Object
- melody
- polyphony
- accompaniment
- counterpoint
- Representation
waveform, spectrogram, note, chord, meter and beat
波形,频谱图,音符,和弦, 节拍- format
MIDI, piano roll or text. - encoded
scalar, one-hot or many-hot.
- format
- Architecture
- feedforward network
- recurrent network
- autoencoder
- generative adversarial networks
- Challenge
variability, interactivity and creativity. - Strategy
single-step feedforward, iterative feedforward, sampling or input manipulation
Introduction
Type
- Melody
Single-voice monophonic melody - Polyphony
和弦
Single-voice polyphony (also named Single-track polyphony) - Multivoice or Multitrack
Multivoice polyphony (also named Multitrack polyphony) - Accompaniment
伴奏- Counterpoint, composed of one or more melodies (voices)
- Chord progression, which provides some associated harmony.
Destination and Use
- Audio system
play the generated content - Sequencer software
process the generated content(MIDI) - Human(s)
music score.
Mode
- 自动无需人干预
- 具有一些控制界面,供人类用户对生成过程进行某些互动控制
Style
相干性,覆盖率(相对于稀疏性)和范围(特定性与较大广度)
coherence
coverage (versus sparsity)
scope (specialized versus large breadth)
Representation
Audio
-
Waveform
-
Transformed Representations
-
Spectrogram
音频的常见变换表示形式是通过傅立叶变换获得的频谱
扫描二维码关注公众号,回复: 11878555 查看本文章 -
Chromagram
频谱图的一种变化形式
与八度无关
钢琴演奏的C大调的色谱图如图所示
四个子图(a至d)共有的x轴表示时间(以秒为单位)
(a)的y轴表示音符
(b和d)的y轴表示色度(音高等级)
(c)的y轴表示振幅
对于色谱图(b和d),彩色的第三个轴表示强度。
Main Concepts
Note 音符 (Pitch,Duration,Dynamics)
-
Pitch 音高
- frequency
单位 Hz - vertical position (height) on a score
- pitch notation
A 4 A_4 A4 (A440(频率为440 Hz)一般的音高调整标准)
音高等级+一个数字
- frequency
-
Duration 持续时间
- 绝对值 ms
- 相对值 a quarter note / an eighth note
-
Dynamics
- quantitative value (dB)
- qualitative value
an annotation on a score about how to perform the note
{ p p p , p p , p , f , f f , f f f } \{ppp, pp, p, f, ff, fff\} { ppp,pp,p,f,ff,fff}
Rest 休止
- 绝对值 ms
- 相对值
a quarter rest an eighth rest
Interval 间隔
basis of chords 和弦的基础
An interval is a relative transition between two notes
Examples:
a major third (which includes 4 semitones 半音)
a minor third (3 semitones)
a (perfect) fifth (7 semitones)
很少用于基于深度学习的音乐生成
Chord 和弦
一组至少3个音符(一个三重音)
-
specification of the precise octave as well as the position (voicing) for each note
每个音符的精确八度音程 以及位置(发音) -
通过使用和弦符号组合
- 根音的音高等级 e.g. C
- 类型 e.g. major, minor, dominant seventh, or diminished
Rhythm 节奏
conveys the pulsation as well as the stress on specific beats
传达 脉动和节拍
Rhythm introduces pulsation, cycles (脉动,循环)
改变原本平坦的音符线性顺序
Beat and Meter 节拍
the unit of pulsation
- meter
More frequent meters are 2/4, 3/4 and 4/4
3/4表示每小节3个节拍,每小节持续时间为四分音符- 小节内的节拍数
- 每个节拍的持续时间
Multivoice/Multitrack
多音轨
每个声音是不同的人声范围(例如,女高音,中音…)或不同的乐器(例如,钢琴,贝斯,鼓…)。 多声音音乐通常被建模为平行音轨,每个音轨具有不同的音符序列,共享相同的音高,但可能具有不同的强的节拍(重音)
表示形式将是单声复音, 常见的例子是和弦乐器,例如钢琴或吉他
Format
MIDI
Musical Instrument Digital Interface
指定了实时音符演奏数据以及控制数据
-
Note on
- a channel number
表示乐器或轨道
{0,1, . . . ,15} - a MIDI note number
表示音高
{0,1, . . . ,127} - a velocity
音符的响度(对于键盘,它表示按下键的速度)
{0,1, . . . ,127} - e.g. ‘Note on,0,60,50’
表示“在通道1上,开始以速度50演奏中音C”;
- a channel number
-
Note off
- 同上,除了 速度是指示释放音符的速度
- e.g. “Note off,0、60、20”,
表示“在通道1上,以20的速度停止演奏中音C”。
每个音符事件实际上都嵌入到轨道块中,轨道块是一个包含增量时间值的数据结构,该值指定了时序信息和事件本身。
-
a relative metrical time
specifies the number of ticks per quarter note -
an absolute time
ticks 滴答声
四分音符 为 384 ticks(十六分音符为 96 ticks ,八分音符为 192 ticks )
缺点
- 它不能有效地保留通过使用多个音轨一次播放多个音符的概念
Piano Roll
- 条 音符
- 长度 持续时间
优点
- 直观
相对于 MIDI 缺点
- no note off information
无法区分长音和重复的短音
ABC notation
民间音乐和传统音乐
旋律可以编码为文本表示形式,并作为文本进行处理。
前六行是标题,代表元数据
T是音乐的标题,M是 meter ,L是默认音符长度
Chord and Polyphony
Chord2Vec34
MusicXML
Markup Language
e.g. HTML , XML
由于MIDI文件的复杂,不规范以及面向播放的特性,其并不能完全满足音乐软件对谱子显示及排版的需求。因此,MusicXML应运而生。
MusicXML是一个开放自由,易于分发的西洋乐记谱格式,其在万维网联盟(W3C)管理下。MusicXML文件基于标准XML技术,因此本质上是一种文本文件,有别于标准MIDI文件为二进制文件。MusicXML的优点主要在于其对显示格式有着精确的定义,因此可以做到对于同一个文件在不同的环境下打开都有着同样的谱面显示内容。 MusicXML中的音乐语义主要有elements表达,也就是其中的XML标签,并以标签的嵌套关系表达音乐语义的元素包含关系。
MusicXML文件分为两种类型:
score-partwise
谱子信息,XML文件信息
各声部信息
声部1全曲:
小节1:
属性
音符1
音符2
……
小节2:
音符1
音符2
……
……
声部2全曲:
小节:
属性
音符1
音符2
……
小节2:
音符1
音符2
……
……
score-timewise
谱子信息,XML文件信息
各声部信息
小节1:
声部1:
属性
音符1
音符2
……
声部2:
属性
音符1
音符2
……
小节2:
声部1:
属性
音符1
音符2
……
声部2:
属性
音符1
音符2
……
一个属性(attributes)通常包含以下信息:
- Divisions:最小时值单位
- Key:调号
- Time:拍号
- Clef:谱号
对于一个音符(Note),通常包含以下信息:
- Step:音名
- Octave:八度位置
- Duration:相对长度
- Type:音符类型
缺点
- 冗长和丰富,不适合作为机器学习任务的直接表示
库
在Python中
-
可以使用 music21 库处理 MusicXML 文件与 MIDI 文件
-
使用 pretty_midi 库处理 MIDI 文件。
Lead Sheet
爵士,流行音乐等
Flow Machines
- Lead Sheet Data Base (LSDB) repository
include 12,000 lead sheets
MidiNet system
Temporal Scope and Granularity
Scope 范围
- Global
Examples are the MiniBach and DeepHear systems
产生的音乐内容具有固定的长度 - Time step (or time slice)
产生的音乐内容任意长度 - Note step
CONCERT system
产生的音乐内容任意长度
Granularity 粒度
在 Global 和 Time step 的 Temporal Scope ,必须定义 time step 的粒度
- 设置为相对时间
e.g. 十六分音符 - 设置为绝对时间
e.g. 10ms
Encoding
- a scalar discrete integer value encoding of A4, the integer number specifying its MIDI note number;
- a one-hot encoding of A4
- a many-hot encoding of a D minor chord (D4, F4, A4) (D小调和弦)
- a multi-one-hot encoding of a first voice with A4 and a second voice with D3
- a multi-many-hot encoding of a first voice with a D minor chord (D4, F4, A4) and a second voice with C3 (corresponding to a minor seventh on bass).
Dataset
Abs | Dataset | Introduce | URL |
---|---|---|---|
the Classical piano MIDI database | |||
JSB | the JSB Chorales dataset | ||
LSDB | Lead Sheet Data Base | with more than 12,000 lead sheets (including from all jazz and bossa nova song books), developed within the Flow Machines project | |
MuseData electronic library of classical music with more than 800 pieces, from CCARH in Stanford University | |||
MusicNet | a collection of 330 freely-licensed classical music recordings together with over 1 million annotated labels (indicating timing and instrumental information) | ||
Nottingham | a collection of 1,200 folk tunes in the ABC notation , each tune consisting of a simple melody on top of chords, in other words an ABC equivalent of a lead sheet; | ||
Session | a repository and discussion platform for Celtic music in the ABC notation containing more than 15,000 songs | ||
Symbolic Music dataset by Walder | a huge set of cleaned and preprocessed MIDI files | ||
TheoryTab database | a set of songs represented in a tab format, a combination of a piano roll melody, chords and lyrics, in other words a piano roll equivalent of a lead sheet; | ||
Yamaha e-Piano Competition dataset | in which participants MIDI performance records are made available | ||
Architecture
Restricted Boltzmann Machine (RBM)
受限玻尔兹曼机
RBM 和 autoencoder 不同
- an RBM has no ouput – the input also acts as the output;
- an RBM is stochastic, not deterministic
随机,不确定 - RBM 采用特定算法( contrastive divergence )以无监督学习的方式进行训练的
- 操作的值是布尔值
RBMs became popular after Hinton designed a specific fast learning algorithm for them, named contrastive divergence , and used them for pre-training deep neural networks
可以学习分布,可以从少数数据里有效的学习
RBM的本质是一种Unsumervised Machine Learning模型,用于对input数据进行重构,即有效地提取数据特征,构建新的数据结构进行预测分析,基本功能有点儿像AutoEncoder模型(自动编码器)。因此,RBM和AE一样,也可以不断地堆叠实现深层的神经网络挖掘数据的特征。
Generative Adversarial Networks (GAN)
Reinforcement learning (RL)
RL-Tuner architecture
Compound Architectures
Composition
-
RNN Encoder-Decoder
combines an RNN and an autoencoder -
RNN-RBM architecture
combining an RNN architecture and an RBM architecture
Refinement
- variational autoencoder (VAE) architecture
Pattern instantiation
- C-RNN-GAN architecture
Strategy
Ex Nihilo Generation
Minibach
Single-Step Feedforward Strategy
监督学习
piano roll
擅长生成与输入旋律匹配的伴奏(由三个不同旋律组成的对位)
缺陷
- 音乐长度固定
- 相同的旋律将始终产生完全相同的伴奏
- 没有增量性和交互性
DeepHear
based on an autoencoder architecture
DeepHear Ragtime Melody Symbolic Music Generation System
piano roll with a multi-one-hot encoding
Sample
- Metropolis-Hastings algorithm
- Gibbs sampling (GS)
- block Gibbs sampling
different levels of probability distribution (and sampling):
- item-level or vertical dimension
在复合音乐项目的级别,例如和弦。在这种情况下,分布是关于和弦成分之间的关系的,即描述音符一起出现的可能性。 - sequence-level or horizontal dimension
系列项目的级别,例如,由连续音符组成的旋律。在这种情况下,分布与音符序列有关,它描述了在给定音符之后出现特定音符的概率。
RBM-based Chord
RBM-based Chord Music Generation System
模拟复音音乐
sample from the RBM through block Gibbs sampling
Length Variability
单步前馈策略 和解码器前馈策略 的一个重要限制是生成的音乐的长度(更准确地说是步数或小节的次数)是固定的。
解决方法,使用 RNN
- 将其前馈到循环网络中以产生下一项(例如,下一个音符);
- 使用该下一项作为下一个输入,以产生下一个下一项;
- 迭代重复此过程,直到产生所需长度的序列(例如音符,即旋律)为止。
BluesC
其中C代表和弦
Blues Chord Sequence Symbolic Music Generation System
目标是学习和生成和弦序列
piano roll
two types of sequences: melody and chords
BluesMC
MC代表旋律和和弦
Blues Melody and Chords Symbolic Music Generation System
LSTM
Content Variability
RNN上的迭代前馈策略的局限性在于生成是确定性的,前馈相同的输入将始终产生相同的输出
the output activation layer is softmax and generation is modeled as a classification task
可以通过抽样轻松地切换到不确定性策略
通过按照生成的分布对音符进行采样
CONCERT
CONCERT Bach Melody Symbolic Music Generation System
LSTM
The three main components are as follows:
- the pitch height (PH)
- the (modulo) chroma circle (CC) cartesian coordinates
- the (harmonic) circle of fifths (CH) cartesian coordinates.
activation function is the sigmoid function
cost function is mean squared error
是早期工作
Celtic
Celtic Melody Symbolic Music Generation System
输入 - 网络 - 采样 - 递归
Expressiveness
One limitation of most existing systems is that they consider fixed dynamics (amplitude) for all notes as well as an exact quantization (a fixed tempo), which makes the music generated too mechanical, without expressiveness or nuance.
Performance RNN
Performance RNN Piano Polyphony Symbolic Music Generation System
MIDI
LSTM
a temperature 0-1 随机-固定
Melody-Harmony Interaction
RNN-RBM
RNN-RBM Polyphony Symbolic Music Generation System
同时考虑 item-level or vertical dimension 和 sequence-level or horizontal dimension
Hexahedria
Hexahedria Polyphony Symbolic Music Generation Architecture
同时考虑 item-level or vertical dimension 和 sequence-level or horizontal dimension
古典钢琴MIDI / piano roll
Bi-Axial LSTM
Bi-Axial LSTM Polyphony Symbolic Music Generation Architecture
Structure
MusicVAE
MusicVAE Multivoice Hierarchical Symbolic Music Generation System
在解码器内具有2级分层RNN的变异递归自动编码器(VRAE)
MIDI
Incrementality
- 单步前馈–前馈体系结构在单个处理步骤中处理包括所有时间步长的全局表示。一个例子是MiniBach
- 迭代前馈–循环体系结构迭代处理与单个时间步相对应的本地表示。一个例子是CONCERT
- 增量采样–前馈体系结构通过增量实例化其变量(每个变量对应于特定时间步长音符的可能性)来增量处理包括所有时间步长的全局表示。一个例子是DeepBach
DeepBach
DeepBach Chorale Multivoice Symbolic Music Generation System
Hadjeres
Interactivity
与人类用户的某种互动性,以帮助人们以渐进和互动的方式完成音乐任务(作曲,对位,和声,分析,编排等)
- Deep-AutoController
- DeepBach