程序音乐生成技术
一段时间以来,我一直在对内容的程序生成进行大量思考,但我从未见过对程序音乐进行太多实验。 我们拥有生成模型、动画、纹理的出色技术,但音乐仍然是完全静态或简单的分层循环(例如孢子)。
正因为如此,我一直在思考最佳的音乐生成技术,我很好奇其他人的想法。 即使您之前没有考虑过,您认为什么效果最好? 请每个答案一种技术,并尽可能提供示例。 该技术可以使用现有数据或完全从头开始生成音乐,也许可以根据某种输入(情绪、速度等)。
I've been putting a lot of thought into procedural generation of content for a while and I've never seen much experimentation with procedural music. We have fantastic techniques for generating models, animations, textures, but music is still either completely static or simply layered loops (e.g. Spore).
Because of that, I've been thinking up optimal music generation techniques, and I'm curious as to what other people have in mind. Even if you haven't previously considered it, what do you think will work well? One technique per answer please, and include examples where possible. The technique can use existing data or generate the music entirely from scratch, perhaps on some sort of input (mood, speed, whatever).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(19)
您所描述的具体技术是托马斯·杜比(Thomas Dolby)十年或十五年前正在研究的技术,尽管我现在不记得他称之为什么,所以我无法给您一个好的搜索术语。
但请参阅这篇维基百科文章和此元过滤器页面。
The specific technique you're describing is something Thomas Dolby was working on ten or fifteen years ago, though I can't remember now what he called it so I can't give you a good search term.
But see this Wikipedia article and this Metafilter page.
最成功的系统可能会结合多种技术。 我怀疑您是否会找到一种适用于所有音乐流派的旋律、和声、节奏和低音序列生成的技术。
例如,马尔可夫链非常适合旋律和和声序列生成。 该方法需要分析现有歌曲来构建链转移概率。 马尔可夫链的真正美妙之处在于状态可以是任何你想要的。
神经网络非常适合时间序列预测(预测),这意味着它们同样适合在针对现有流行旋律/和声进行训练时“预测”音乐序列。 最终结果将类似于马尔可夫链方法。 除了减少内存占用之外,我想不出马尔可夫链方法有什么好处。
除了音高之外,您还需要持续时间来确定生成的音符或和弦的节奏。 您可以选择将此信息合并到马尔可夫链状态或神经网络输出中,也可以单独生成它并组合独立的音高和持续时间序列。
遗传算法可用于进化节律部分。 一个简单的模型可以使用二进制 染色体,其中前 32 位表示底鼓,第二个 32 位军鼓,第三个 32 位闭合踩镲等等。 这种情况的缺点是它们需要持续的人类反馈来评估新进化模式的适应性。
专家系统可用于验证其他技术生成的序列。 这种验证系统的知识库可能可以从任何优秀的音乐理论书籍或网站中获取。 尝试 Ricci Adams 的 musictheory.net。
The most successful system will likely combine several techniques. I doubt you'll find one technique that works well for melody, harmony, rhythm and bass sequence generation across all genres of music.
Markov chains, for instance, are well suited for melodic and harmonic sequence generation. This method requires analysis of existing songs to build the chain transition probabilities. The real beauty of Markov chains is that the states can be whatever you want.
Neural networks are well suited to time series prediction (forecasting), which means they're equally suited to 'predicting' a musical sequence when trained against existing popular melodies/harmonies. The end result will be similar to that of the Markov chain approach. I can't think of any benefit over the Markov chain approach other than reducing the memory footprint.
In addition to pitch you will need duration to determine the rhythm of the generated notes or chords. You can choose to incorporate this information into the Markov chain states or neural network outputs, or you can generate it separately and combine the independent pitch and duration sequences.
Genetic algorithms can be used to evolve rhythm sections. A simple model could use a binary chromosome in which the first 32 bits represent the pattern of a kick drum, the second 32 bits a snare, the third 32 bits a closed hi hat and so on. The downside in this case is that they require continuous human feedback to assess the fitness of the newly evolved patterns.
An expert system can be used to verify sequences generated by the other techniques. The knowledge base for such a validation system can probably be lifted from any good music theory book or website. Try Ricci Adams' musictheory.net.
对这些技术的研究已有 50 多年的历史,但常常被不熟悉计算机音乐和算法作曲历史的开发人员所忽视。 可以在此处找到解决这些问题的系统和研究的大量示例:
http://www.algorithmic.net
There are over 50 years of research into these techniques, often overlooked by developers not familiar with the history of computer music and algorithmic composition. Numerous examples of systems and research that address these issues can be found here:
http://www.algorithmic.net
元胞自动机 - 阅读。
您也可以在此处尝试一下。
编辑:
rakkarage 提供了另一个资源:http: //www.ibm.com/developerworks/java/library/j-camusic/
Cellular Automata - read.
You can also try it out here.
Edit:
rakkarage has supplied another resource: http://www.ibm.com/developerworks/java/library/j-camusic/
一种简单且有些有效的算法是使用 1/f 噪声(又名“粉红噪声”)从音阶中选择时长和音符。 这听起来有点像音乐,可以作为一个很好的起点。
更好的算法是使用“马尔可夫链”。扫描一些示例音乐并构建概率表。 在最简单的情况下,就像 C 有 20% 的可能性跟随 A。为了使这一点更好,请查看过去几个音符的顺序,例如“CA B”有 15% 的可能跟随 B, 4% 可能后面跟着 Bb 等。然后,只需使用之前选择的音符的概率来选择音符即可。 这个非常简单的算法产生了非常好的结果。
用于音乐生成的马尔可夫链
An easy and somewhat effective algorithm is to use 1/f noise aka "pink noise" to select durations and notes from a scale. This sounds sort of like music and can be a good starting point.
A better algorithm is to use "markov chains".. scan some example music and build a table of probabilities. In the simplest case, it would be something like C is 20% likely to follow A. To make this better, look at the sequence of the past few notes, for example "C A B" is 15% likely to be followed by B, and 4% likely to be followed by a Bb, etc. Then, just pick notes using the probabilities of the previously chosen notes. This remarkably simple algorithm generates pretty good results.
Markov chains for music generation
我的软件使用应用进化理论来“发展”音乐。 这个过程类似于 Richard Dawkins 的盲人钟表匠程序 - MusiGenesis 随机添加音乐元素,并且然后用户决定是否保留每个添加的元素。 这个想法是只保留你喜欢的东西,抛弃任何听起来不合适的东西,而且你不需要接受任何音乐训练就可以使用它。
界面崩溃了,但它很旧 - 起诉我。
My software uses applied evolutionary theory to "grow" music. The process is similar to Richard Dawkins' The Blind Watchmaker program - MusiGenesis adds musical elements randomly, and then the user decides whether or not to keep each added element. The idea is to just keep what you like and ditch whatever doesn't sound right, and you don't have to have any musical training to use it.
The interface blows, but it's old - sue me.
Dmitri Tymoczko 这里有一些有趣的想法和例子:
http://music.princeton.edu/~dmitri /whatmakesmusicsoundgood.html
Dmitri Tymoczko has some interesting ideas and examples here :
http://music.princeton.edu/~dmitri/whatmakesmusicsoundgood.html
我一直很喜欢使用 iMuse 系统的旧 Lucasarts 游戏,该系统为游戏制作了永无休止的反应性配乐,并且非常具有音乐性(因为其中大部分仍然是由作曲家创作的)。 您可以在这里找到规格(包括专利):
http://en.wikipedia.org/wiki/IMUSE
任天堂似乎是唯一一家公司仍然使用类似于 iMuse 的方法来动态创作或影响音乐。
除非你的项目非常具有实验性,否则我不会放弃使用作曲家 - 真正的人类作曲家会比算法产生更多音乐性和可听性的结果。
与写诗相比:你可以轻松地生成听起来很前卫的无意义诗,但温和地说,用算法复制莎士比亚是很困难的。
I have always liked the old Lucasarts games that used the iMuse system, which produced a never-ending, reactive soundtrack for the game and was very musical (because most of it was still created by a composer). You can find the specs (including the patent) here:
http://en.wikipedia.org/wiki/IMUSE
Nintendo seems to be the only company to still use an approach similar to iMuse to create or influence the music on the fly.
Unless your project is very experimental, I would not abandon the use of a composer - a real human composer will produce much more musical and listenable results than an algorythm.
Compare it to writing a poem: You can easily generate nonsene poems which sound very avant-garde, but to replicate shakespeare with an algorythm is difficult, to put it mildly.
您看过 SoundHelix (http://www.soundhelix.com) 吗? 它是一个开源 Java 框架,用于算法随机音乐创作,可以产生非常简洁的音乐。 您可以将 SoundHelix 用作独立应用程序、嵌入网页中的小程序、基于 JNLP 的小程序,也可以将其包含到您自己的 Java 程序中。
使用 SoundHelix 生成的示例可以在这里找到:http://www.soundhelix.com/audio-examples
Have you taken a look at SoundHelix (http://www.soundhelix.com)? It's an Open-Source Java framework for algorithmic random music creation that produces pretty neat music. You can use SoundHelix as a standalone application, as an applet embedded in a webpage, as an JNLP-based applet or you can include it into your own Java program.
Examples generated with SoundHelix can be found here: http://www.soundhelix.com/audio-examples
对非无聊程序音乐生成的研究可以追溯到很久以前。 浏览《计算机音乐杂志》的新旧期刊
http://www.mitpressjournals.org/cmj(没有真正的域名?)这有严重的技术问题对音乐合成工匠、烙铁骑手、比特牧民和学术研究人员有实际用途的文章。 这不是一些蓬松的评论和采访文章,比如你可以在主要书店找到的一些杂志。
Research on non-boring procedural music generation goes way back. Browse old and new issues of Computer Music Journal
http://www.mitpressjournals.org/cmj (no real domain name?) This has serious technical articles of actual use to music synthesis tinkerers, soldering iron jockeys, bit herders and academic researchers. It's ot a fluffy reviews and interviews rag such as several of the mags you can find in major bookstores.
这么大的话题。 您可以在 morganpackard.com 上查看我的 iPad 应用程序 Thicket 或我的 Ripple 软件。 根据我的经验,大多数动态音乐生成的学术方法都提出了听起来很学术的东西。 我认为更成功的东西是在俱乐部/电子世界的边缘发现的。 在这方面,莫诺莱克是我的英雄。 非常耐听的东西,很大程度上是计算机生成的。 我自己的音乐也不错。 Paul Lansky 的“Alphabet Book”是非常耐听的算法音乐的一个很好的例子,特别是考虑到他是一个学者。
Such a big subject. You could take a look at my iPad app, Thicket, or my Ripple software at morganpackard.com. In my experience, most of the academic approaches to dynamic music generation come up with stuff that sounds, well, academic. I think the more successful stuff is found on the fringes of the club/electronica world. Monolake is my hero in this respect. Very listenable stuff, very much computer-generated. My own music isn't bad either. Paul Lansky's "Alphabet Book" is a nice example of extremely listenable algorithmic music, especially considering that he's an academic guy.
我一直在考虑的技术是创建小的音乐模式,最多一个小节左右。 用“兴奋”、“强烈”等感觉标识符来标记这些模式。当您想为某种情况生成音乐时,请根据这些标签选择一些模式,然后选择您想要演奏的乐器。 根据乐器,弄清楚如何组合这些模式(例如,在钢琴上,您可以将所有模式一起演奏,具体取决于手的跨度,在吉他上,您可以快速连续地演奏音符),然后将其渲染到 PCM 。 此外,您还可以更改调、更改速度、添加效果等。
The technique I've been considering is to create small musical patterns, up to a bar or so. Tag these patterns with feeling identifiers such as 'excitement', 'intense', etc. When you want to generate music for a situation, pick a few patterns based on these tags and pick an instrument you want to play it with. Based on the instrument, figure out how to combine the patterns (e.g. on a piano you may be able to play it all together, depending on hand span, on a guitar you may play the notes in rapid succession) and then render it to PCM. In addition, you could change key, change speed, add effects, etc.
算法组合这本书是对使用的几种方法:
“涵盖的主题包括:马尔可夫模型、生成语法、转换网络、混沌和自相似性、遗传算法、细胞自动机、神经网络和人工智能。”
对于这个广泛的主题来说,这是一个很好的起点,但它从未深入描述每种方法的工作原理。 它对每个内容都提供了很好的概述,但如果您还不了解它们,那么还不够。
The book Algorithmic Composition is a good tour of the several methods used:
"Topics covered are: markov models, generative grammars, transition networks, chaos and self-similarity, genetic algorithms, cellular automata, neural networks and artificial intelligence."
It is a good starting point on this wide topic, however it does never describe in depth how each method works. It provides a good overview of each, but will not be enough to if you do not already have knowledge about them.
如果您对音乐如何结合在一起有更深入的理论,Bill Sethares 网站有一些有趣的曲折。
If you're into deeper theories about how music hangs together, Bill Sethares site has some interesting twists.
不完全是你想要的,但我知道有人研究自动生成 DJ 集 基于内容的音乐相似性。
Not quite what you're after, but I knew someone who looked at automatically generating DJ sets called Content Based Music Similarity.
早在 90 年代末,Microsoft 创建了一个名为“交互式音乐控件”的 ActiveX 控件,它完全可以满足您的需求。 不幸的是,他们似乎已经放弃了这个项目。
Back in the late 90's, Microsoft created an ActiveX control called the "Interactive Music Control" which did exact what your looking for. Unfortunately, they seem to have abandon the project.
我一直在考虑做这个项目提案 - “8.1”来自哥本哈根大学计算机科学系“编程语言的理论与实践”研究小组:
正如我所见,这与您的问题相反,生成的数据 - 我想 - 可以在音乐程序生成的某些实例中使用。
Ive been looking into doing this project proposal - "8.1" from the "Theory and praxis in programming language" research group from the University of Copenhagen - department of CS:
This - as I see it - is the opposite direction of your question the data generated - I imagine - could be used in some instances of procedural generation of music.
我的观点是,生成音乐只有经过严格的选择过程才能发挥作用。 算法音乐先驱大卫·科普(David Cope)会仔细检查他的算法(我认为主要是基于马尔可夫链)的数小时音乐输出,以挑选出少数实际上效果良好的音乐。
我认为这个选择过程可以通过对特定音乐风格的特征进行建模来实现自动化。 例如,“迪斯科”风格会给以另类节奏和鼓声部分为特色的贝斯线奖励很多分,而鼓声部分在底拍上有军鼓,但如果严重不和谐和声则扣分。
事实上,音乐创作过程充满了如此多的惯用做法,如果没有该领域的具体知识,很难对其进行建模。
My opinion is that generative music only works when it goes through a rigorous selection process. David Cope, an algorithmic music pioneer, would go through hours of musical output from his algorithms (which I think were mostly Markov Chain based) to pick out the few that actually turned out well.
I think this selection process could be automated by modeling the characteristics of a particular musical style. For instance, a "disco" style would award lots of points for a bassline that features offbeats and drum parts with snares on the backbeats but subtract points for heavily dissonant harmonies.
The fact is that the music composition process is filled with so many idiomatic practices that they are very difficult to model without specific knowledge of the field.
我一直在开发一个用于程序音乐的 Python 模块。 我只是编写了我所知道的音符、音阶和和弦结构,然后让它根据这些限制随机生成内容。 我确信像这样的系统可以教授更多的理论和模式,尤其是由更了解该主题的人教授。 然后,您可以使用这些系统作为遗传算法或随机内容生成的约束。
您可以此处查看我的实现,特别是随机生成的引导示例可能对您有用。 对和弦进行有深入了解的人可以通过类似的技术创建歌曲结构,并在其上实现类似的受约束的随机旋律。 我的音乐理论知识还没有延伸到那么远。
但基本上,您需要对想要生成的音乐类型的理论进行编码,然后将其用作某些算法的约束,以在程序上探索该理论的范围。
I've been working on a Python module for procedural music. I just programmed out what I know about notes, scales, and chord construction, then have been able to let it randomly generate content from those constraints. I'm sure there's more theory and patterns a system like that could be taught, especially by someone who understands the subject better. Then you can use those systems as constraints for genetic algorithms or randomized content generation.
You can go over my implementation here, especially the randomly generated lead example may be useful to you. Someone with a solid understanding of chord progressions could create a song structure from techniques like that and implement constrained random melodies like this over it. My knowledge of music theory does not extend that far.
But basically, you'll need to encode the theory of the kind of music you want to generate, and then use that as a constraint for some algorithm for procedurally exploring the range of that theory.