https://github.com/timkoornstra/automatic-piano-fingering
This repository contains the code for automatically generating piano fingerings using a reinforcement learning agent that uses Q-Learning.
https://github.com/timkoornstra/automatic-piano-fingering
fingering piano piano-fingering python q-learning q-learning-algorithm reinforcement-learning
Last synced: 6 months ago
JSON representation
This repository contains the code for automatically generating piano fingerings using a reinforcement learning agent that uses Q-Learning.
- Host: GitHub
- URL: https://github.com/timkoornstra/automatic-piano-fingering
- Owner: TimKoornstra
- License: gpl-3.0
- Created: 2021-10-15T13:48:19.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-15T15:19:10.000Z (about 4 years ago)
- Last Synced: 2025-03-30T09:02:02.117Z (8 months ago)
- Topics: fingering, piano, piano-fingering, python, q-learning, q-learning-algorithm, reinforcement-learning
- Language: Python
- Homepage:
- Size: 56.6 KB
- Stars: 15
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Automatically Generated Piano Fingering using Q-Learning
This repository contains the code for automatically generating piano fingerings using a reinforcement learning agent that uses Q-Learning.
## About the code
This code allows the user to input a number of music sheets in the MusicXML file format, which will be trained using the epsilon-greedy Q-Learning algorithm. The output of the program will be a pandas dataframe with each of the notes from the right hand, along with their predicted optimal fingering. A few MusicXML sheets have been provided and are stored in the `data/train` folder. To test the program, simply follow the "How to run" subsection of this README.
Q-Learning is not good for generalization and this algorithm works best when the sheets in the test set are part of the training set. This ensures that the reinforcement learning agent has already seen the note combinations and the Q-Values are not empty (which results in standard finger 1).
## Dependencies
The required packages to run this code can be found in the `requirements.txt` file. To run this file, execute the following code block:
```
$ pip install -r requirements.txt
```
Alternatively, you can install the required packages manually like this:
```
$ pip install
```
## How to run
- Clone the repository
- Place all MusicXML `.xml` files that you want the reinforcement learning agent to train on in the `data/train` folder. Place all the MusicXML `.xml` files that you want the reinforcement learning agent to label in the `data/test` folder.
- Run `$ python src/main.py`
- See result