Metadata-Version: 2.4
Name: markovmusic
Version: 0.1.0
Summary: Generate music by training a Markov chain on your own MIDI files!
Author-email: Ronit Kunkolienker <ronitkunk@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Ronit Kunkolienker
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy
Requires-Dist: sounddevice
Requires-Dist: scipy
Requires-Dist: mido
Dynamic: license-file

# 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
```sh
pip install markovmusic
```
- Instantiate a composer
```python
from markovmusic import MarkovComposer

model = MarkovComposer()
```
- Specify a a MIDI file to train the composer on
```python
model.fit("allmanbros/jessica.mid")
```
- Compose and play new music
```python
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`)
- `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`)
- `save_chain()`: save a trained composer to disk
- `load_chain()`: load a saved composer from disk
