asigalov61
commited on
Commit
•
b7340d2
1
Parent(s):
2f847f1
Update README.md
Browse files
README.md
CHANGED
@@ -39,6 +39,10 @@ configs:
|
|
39 |
|
40 |
## Installation and use
|
41 |
|
|
|
|
|
|
|
|
|
42 |
```python
|
43 |
from datasets import load_dataset
|
44 |
|
@@ -58,5 +62,51 @@ print(midi_score[:15])
|
|
58 |
|
59 |
***
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
### Project Los Angeles
|
62 |
### Tegridy Code 2024
|
|
|
39 |
|
40 |
## Installation and use
|
41 |
|
42 |
+
***
|
43 |
+
|
44 |
+
### Load dataset
|
45 |
+
|
46 |
```python
|
47 |
from datasets import load_dataset
|
48 |
|
|
|
62 |
|
63 |
***
|
64 |
|
65 |
+
### Decode to MIDI
|
66 |
+
|
67 |
+
```python
|
68 |
+
import TMIDIX
|
69 |
+
|
70 |
+
#===================================================================
|
71 |
+
|
72 |
+
def decode_to_ms_MIDI_score(midi_score):
|
73 |
+
|
74 |
+
score = []
|
75 |
+
|
76 |
+
time = 0
|
77 |
+
|
78 |
+
for m in midi_score:
|
79 |
+
|
80 |
+
if 0 <= m < 128:
|
81 |
+
time += m * 32
|
82 |
+
|
83 |
+
elif 128 < m < 256:
|
84 |
+
dur = (m-128) * 32
|
85 |
+
|
86 |
+
elif 256 < m < 384:
|
87 |
+
pitch = (m-256)
|
88 |
+
|
89 |
+
elif 384 < m < 512:
|
90 |
+
vel = (m-384)
|
91 |
+
|
92 |
+
score.append(['note', time, dur, 0, pitch, vel, 0])
|
93 |
+
|
94 |
+
return score
|
95 |
+
|
96 |
+
#===================================================================
|
97 |
+
|
98 |
+
ms_MIDI_score = decode_to_ms_MIDI_score(midi_score)
|
99 |
+
|
100 |
+
#===================================================================
|
101 |
+
|
102 |
+
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(ms_MIDI_score,
|
103 |
+
output_signature = midi_hash,
|
104 |
+
output_file_name = midi_hash,
|
105 |
+
track_name='Project Los Angeles'
|
106 |
+
)
|
107 |
+
```
|
108 |
+
|
109 |
+
***
|
110 |
+
|
111 |
### Project Los Angeles
|
112 |
### Tegridy Code 2024
|