Generate music by training a Markov chain on your own MIDI files!
Project description
markovmusic
What is it?
Using markovmusic, you can make a Markov chain generate music using patterns learned from your own MIDI files.
Minimal use
- Install this package
pip install markovmusic
- Instantiate a composer
from markovmusic import MarkovComposer
model = MarkovComposer()
- Specify a a MIDI file to train the composer on
model.fit("allmanbros/jessica.mid")
- Compose and play new music
model.compose()
Advanced features
Usage of the following advanced features is in the docstrings for the following methods of MarkovComposer:
fit(): you can specify:- how many previous chords you want the composer to learn to use to predict the next chord (
look_back) - whether to play the music while training or not (
play)
- how many previous chords you want the composer to learn to use to predict the next chord (
compose(): you can specify:- how long the generated music should be (
piece_length) - how creative or restrictive you want the generated music to be (
temperature) - whether to play the music while generating or not (
play) - a path to save the music as a WAV file (
wav_path)
- how long the generated music should be (
save_chain(): save a trained composer to diskload_chain(): load a saved composer from disk
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markovmusic-0.1.0.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markovmusic-0.1.0.tar.gz.
File metadata
- Download URL: markovmusic-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad4b8bbd7296238e23569efebcff6709ed3ab5a89355317655bbf8cee7f091f
|
|
| MD5 |
4aadbd2f97ea26bb4ddf14b13169388e
|
|
| BLAKE2b-256 |
9a87381e1c7c04771b34e4c98eeb6981932c60aac25532e3f2a4fe09d3656dd1
|
File details
Details for the file markovmusic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: markovmusic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
137823e43e9e2ef9116652b0d47295135d5a18ff035f439d30bc794b8a5ebe82
|
|
| MD5 |
03286e5aab77d65adad0c6c754a1f8de
|
|
| BLAKE2b-256 |
552eced4669a5ab742c32d53a8b43984d2417f31720ab7f70fc67b31c888aaf8
|