Skip to content

Commit b490897

Browse files
authored
Readme do-over (#10)
* Start readme do-over * Update README.md * Update README.md * Update README.md
1 parent c8dd706 commit b490897

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
11
# Fortepyan :musical_keyboard:
2+
23
![GitHub CI](https://github.com/Nospoko/Fortepyan/actions/workflows/ci_tests.yaml/badge.svg?branch=master) [![Python 3.9](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads) [![PyPI version](https://img.shields.io/pypi/v/fortepyan.svg)](https://pypi.org/project/fortepyan/) [![PyPI download month](https://img.shields.io/pypi/dm/fortepyan.svg)](https://pypi.org/project/fortepyan/)
34

5+
**fortepyan** is a glorified pandas wrapper for midi files with piano music.
6+
7+
The main class to operate with is `MidiPiece`, which gives you access to the notes dataframe, and some useful utilities:
8+
9+
```python
10+
from fortepyan import MidiPiece
11+
12+
piece = MidiPiece.from_file("foo.mid")
13+
14+
piece.df
15+
# pitch velocity start end duration
16+
# 0 52 70 0.000000 0.538542 0.538542
17+
# 1 52 62 0.660417 0.951562 0.291146
18+
# 2 57 62 20.769792 21.207812 0.438021
19+
# 3 67 65 62.172917 62.510937 0.338021
20+
# 4 69 56 62.179167 62.232292 0.053125
21+
```
22+
23+
Using with HuggingFace datasets:
24+
25+
26+
```python
27+
from datasets import load_datasets
28+
29+
dataset = load_dataset("epr-labs/maestro-sustain-v2", split="train")
30+
piece = MidiPiece.from_huggingface(dataset[312])
31+
piece.source
32+
# {
33+
# 'composer': 'Franz Liszt',
34+
# 'title': 'Dante Sonata',
35+
# 'split': 'train',
36+
# 'year': 2009,
37+
# 'midi_filename': '2009/MIDI-Unprocessed_11_R1_2009_06-09_ORIG_MID--AUDIO_11_R1_2009_11_R1_2009_09_WAV.midi',
38+
# 'dataset': 'maestro'
39+
# }
40+
```
41+
442
### Usage
543

644
```python
@@ -12,6 +50,8 @@ ff.view.draw_pianoroll_with_velocities(piece)
1250
ff.view.make_piano_roll_video(piece, "tmp.mp4")
1351
```
1452

53+
## Contributing
54+
1555
### Development
1656

1757
Pre-commit hooks with forced python formatting ([black](https://github.com/psf/black), [flake8](https://flake8.pycqa.org/en/latest/), and [isort](https://pycqa.github.io/isort/)):

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ dev = [
3838
"pytest-watch == 4.2.0",
3939
"streamlit-pianoroll == 0.7.1"
4040
]
41+
test = [
42+
"pytest ~= 8.0.0",
43+
"pytest-watch == 4.2.0"
44+
]
45+
4146

4247
[project.urls]
4348
Homepage = "https://github.com/Nospoko/fortepyan"

0 commit comments

Comments
 (0)