File size: 4,256 Bytes
db82bcc
 
 
 
 
 
 
 
 
 
 
 
3469834
 
 
 
 
 
3939d7f
 
 
3469834
 
3939d7f
3469834
3939d7f
 
3469834
 
 
 
 
178d5c9
 
 
 
07471a6
178d5c9
 
 
 
 
2f847f1
 
b7340d2
 
 
 
2f847f1
9cdc052
 
2f847f1
 
9cdc052
 
2f847f1
 
 
 
 
 
 
 
 
9cdc052
2f847f1
 
 
9cdc052
2f847f1
 
 
 
3d1d34b
b7340d2
 
4190c66
 
 
 
b7340d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143d19a
 
 
4defa34
 
 
 
 
143d19a
 
4defa34
 
143d19a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178d5c9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
license: cc-by-sa-4.0
language:
- en
tags:
- MIDI
- Monster
- Piano
- Representations
pretty_name: monsterpiano
size_categories:
- 100K<n<1M
dataset_info:
  features:
  - name: midi_hash
    dtype: string
  - name: midi_score
    sequence: int64
  - name: midi_signature
    sequence:
      sequence: int64
  splits:
  - name: train
    num_bytes: 30593499836
    num_examples: 580204
  download_size: 4082220299
  dataset_size: 30593499836
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

# Monster Piano

## 580204 solo Piano MIDI scores representations from [Monster MIDI dataset](https://huggingface.co/datasets/projectlosangeles/Monster-MIDI-Dataset)

![Monster-Piano-Logo.jpg](https://cdn-uploads.huggingface.co/production/uploads/5f57ea2d3f32f12a3c0692e6/b0Skg7NBSHipbTIFVXvc4.jpeg)

***

## Installation and use

***

### Load dataset

```python
#===================================================================

from datasets import load_dataset

#===================================================================

monster_piano = load_dataset('asigalov61/Monster-Piano')

dataset_split = 'train'
dataset_entry_index = 0

dataset_entry = monster_piano[dataset_split][dataset_entry_index]

midi_hash = dataset_entry['midi_hash']
midi_score = dataset_entry['midi_score']
midi_signature = dataset_entry['midi_signature']

print(midi_hash)
print(midi_score[:15])
print(midi_signature[:4])
```

***

### Decode score to MIDI

```python
#===================================================================
# !git clone --depth 1 https://github.com/asigalov61/tegridy-tools
#===================================================================

import TMIDIX

#===================================================================

def decode_to_ms_MIDI_score(midi_score):

    score = []

    time = 0
    
    for m in midi_score:

        if 0 <= m < 128:
            time += m * 32

        elif 128 < m < 256:
            dur = (m-128) * 32

        elif 256 < m < 384:
            pitch = (m-256)

        elif 384 < m < 512:
            vel = (m-384)

            score.append(['note', time, dur, 0, pitch, vel, 0])

    return score
    
#===================================================================

ms_MIDI_score = decode_to_ms_MIDI_score(midi_score)

#===================================================================

detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(ms_MIDI_score,
                                                          output_signature = midi_hash,
                                                          output_file_name = midi_hash,
                                                          track_name='Project Los Angeles'
                                                          )
```

***

### Calculate MIDI score signature

```python
#===================================================================
# !git clone --depth 1 https://github.com/asigalov61/tegridy-tools
#===================================================================

from collections import Counter
import TMIDIX

#===================================================================

def get_score_signature(midi_score):

    score = []

    time = 0
    pt = 0
    
    for m in midi_score:

        if 0 <= m < 128:
            time = m

        elif 256 < m < 384:
            pitch = (m-256)

            if time == pt:
                score.append([0, pitch])
            else:
                score.append([time, pitch])

            pt = time

    chords = []
    cho = []
    
    for s in score:
        if s[0] == 0:
            cho.append(s[1])

        else:
            if cho:
                chords.append(cho)

            cho = [s[1]]

    pitches_chords = []

    for c in chords:

        if len(c) > 1:
            
            tones_chord = sorted(set([p % 12 for p in c]))
    
            while tones_chord not in TMIDIX.ALL_CHORDS_SORTED:
                tones_chord = tones_chord[:-1]

            pitches_chords.append(TMIDIX.ALL_CHORDS_SORTED.index(tones_chord)+128)

        else:
            pitches_chords.append(c[0])
            
    return list(Counter(pitches_chords).most_common())
```

***

### Project Los Angeles
### Tegridy Code 2024