1 Star 0 Fork 0

brendanaaa / random-midi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Random Melody Generator

Generate random melody under specific rules.

Getting started

Prerequisites

This project is written in Python 3.6. I haven't tested in other versions.

MIDIUtil library is used in my project. You can install it simply by using pip:

pip install MIDIUtil

How to use?

Simply run main.py. A standard MIDI file will be generated in output folder. The filename is midi_{timestamp}.mid.

You can play it using a media player (e.g. Windows Media Player) or import it into a Digital Audio Workstation (DAW).

Customize

By default, the melody is in major pentatonic scale, chord progression is C-Am-F-G (1-6-4-5), and percussion pattern is fixed. Also, the interval of notes within a phrase is constrained.

The rules can be modified in rules.json.

You can also adjust the length of song and tempo in song_settings.json.

rules.json

Parameter Description
notes Defines the notes used for composition.
interval_upper Defines the upper bound of interval of notes. The values in this list will be randomly chosen.
interval_lower Defines the lower bound of interval of notes. The values in this list will be randomly chosen.
rhythm Defines rhythm pattern for melody. The numbers are in beats (quarter notes).
seq_chord Defines the chord sequence. Notes in each sub-array will be played simultaneously to form a chord.
seq_perc Defines the percussion sequence. The first element in the sub-array denotes the drum sound, and the second element denotes time value in beats.
velocity Defines the velocity of strong, intermediate and weak beats.

song_settings.json

Parameter Description
length Defines the length of song.
tempo Defines the tempo of song, measured in Beats per Minute (BPM).

Credits

  • The whole project is written in Python (python.org).
  • The project uses MIDIUtil library by MarkCWirt.
  • I would appreciate ScoreDraft by fynv. My project is partially inspired by ScoreDraft. Since ScoreDraft uses scripts to compose music, I found its potential to automatically generate music. My algorithm of randomly generating melody was initially tested on ScoreDraft.

空文件

简介

暂无描述 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/brendanaaa/random-midi.git
git@gitee.com:brendanaaa/random-midi.git
brendanaaa
random-midi
random-midi
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891