Update README.md
Browse files
README.md
CHANGED
|
@@ -105,6 +105,23 @@ from datasets import load_dataset
|
|
| 105 |
dataset = load_dataset('TiMauzi/imslp-midi-by-nc-sa')
|
| 106 |
```
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
## License Merging
|
| 110 |
While most files in IMSLP are stored as public domain or open source, different and sometimes incompatible licensing agreements exacerbate the conflation of individual pieces into a single data collection.
|
|
|
|
| 105 |
dataset = load_dataset('TiMauzi/imslp-midi-by-nc-sa')
|
| 106 |
```
|
| 107 |
|
| 108 |
+
The data in the column `midi` are raw bytes. You may want to use packages like `mido` to analyze them. For example, to view the content of the first MIDI file, you can use a script as follows:
|
| 109 |
+
|
| 110 |
+
```python
|
| 111 |
+
train_data = dataset['train'] # assuming you already loaded the dataset as described
|
| 112 |
+
|
| 113 |
+
# Take the first example
|
| 114 |
+
midi_bytes = train_data[0]['midi'] # this is raw bytes
|
| 115 |
+
|
| 116 |
+
# Load with mido
|
| 117 |
+
midi_file = mido.MidiFile(file=io.BytesIO(midi_bytes))
|
| 118 |
+
|
| 119 |
+
# Inspect tracks and messages
|
| 120 |
+
for i, track in enumerate(midi_file.tracks):
|
| 121 |
+
print(f"Track {i}: {track.name}")
|
| 122 |
+
for msg in track[:10]: # print first 10 messages
|
| 123 |
+
print(msg)
|
| 124 |
+
```
|
| 125 |
|
| 126 |
## License Merging
|
| 127 |
While most files in IMSLP are stored as public domain or open source, different and sometimes incompatible licensing agreements exacerbate the conflation of individual pieces into a single data collection.
|