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 with reinforcement learning solely. Here, creation of fifth species counterpoint is considered and environment is based on a special data structure that represents musical piece with pre-defined cantus firmus. An action is adding a new note to a counterpoint line, an episode is finished when counterpoint duration becomes equal to that of cantus firmus, and reward is determined by applying evaluational rules to the resulting piece.

Some pieces generated with this package are uploaded to a publicly available cloud storage. A cantus firmus attributed to Fux is used in all of them.

To find more details, look at a draft of a paper. Also, if you are interested in algorithmic composition without too strict limitations of species counterpoint, look at the tools named Geniartor and Dodecaphony.

Installation

To install a stable version, run:

pip install rl-musician

Usage

To create a reward-maximizing musical piece and some its variations, run:

python -m rlmusician [-c path_to_your_config]

Default config is used if -c argument is not passed. Search of optimal piece with these default settings takes about 5 minutes on a CPU of a regular laptop. Before creating a new config, it might be useful to look at an example with explanations.

If you are on Mac OS, please check that parallelism is enabled.

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

  • MIDI file;
  • WAV file;
  • Events file in sinethesizer TSV format;
  • PDF file with sheet music and its Lilypond source.

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.4.6.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rl_musician-0.4.6-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rl-musician-0.4.6.tar.gz
Algorithm Hash digest
SHA256 a85471d1fd58f84d124fba488746a4da2ae20b670bdcfa01f5518cdbb8fd63b2
MD5 4a0960ea50b34d5d10635455e618556b
BLAKE2b-256 2f81dfd302e4e15305d2c0984b5b1694954a4b94c849a7904cfce632aafa0a41

See more details on using hashes here.

File details

Details for the file rl_musician-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: rl_musician-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 44.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for rl_musician-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 44e0213a10bcce7e496477ef256cfcf81cb7f1368535e1ee1360b3717b0d301b
MD5 296dd7939f6ec7580d215696d5cd2084
BLAKE2b-256 f3d5a851073c4fe4cd8a59eafdcdf200201245122b6a98e6efb944131b0cdcac

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