Skip to main content

Composition of music with reinforcement learning.

Project description

Build Status codecov Maintainability PyPI version

RL-Musician

Overview

As of now, this is a proof-of-concept for music composition by reinforcement learning agents. Here, an agent interacts with piano roll environment, episode end is submission of current piano roll, and reward is determined by applying evaluation rules to the roll.

Comparing to music composition tools such as MuseNet, reinforcement learning approach (at least in theory) has two advantages:

  • Actual creativity lies not in imitation of famous pieces, but in finding new ways to create something to be called art. Reinforcement learning meets this criterion, but supervised learning don't.
  • There are tuning systems other than equal temperament (say, in microtonal music) and there can be not enough pieces for some of them. A model can not be trained in a supervised manner without a dataset, but, given evaluation rules, an agent can be trained even for an absolutely new tuning system.

Currently, the implementation of environment supports only equal temperament, but this limitation may be eliminated in the future.

To find more details, look at a draft of a paper.

Installation

To install a stable version, run:

pip install rl-musician

Usage

To train an agent from scratch and to get results produced by it, run:

python -m rlmusician \
    -c [path/to/your/config] \
    -p [how_long_to_train] \
    -e [how_many_pieces_to_produce]

All three arguments are optional. Default config is used if -c argument is not passed; -p and -e options have reasonable defaults too.

Created pieces are stored in a directory specified in the config. For each piece, there is a nested directory that contains:

  • Piano roll in TSV format;
  • MIDI file;
  • Events file in sinethesizer TSV format;
  • WAV file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rl-musician-0.1.2.tar.gz (19.8 kB view details)

Uploaded Source

File details

Details for the file rl-musician-0.1.2.tar.gz.

File metadata

  • Download URL: rl-musician-0.1.2.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for rl-musician-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da8d7564b23bb2e1c6c06752bd23355abffa07b4014ff88100a6202b77af965c
MD5 eb24e887daefcb2b503f22c13f36c269
BLAKE2b-256 7420c57f319b47688173502de56bfbee87c0aa26366d1c90ca3feca265751226

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page