Update README.md
Browse files
README.md
CHANGED
@@ -72,6 +72,16 @@ response = model.generate(
|
|
72 |
)
|
73 |
response = tokenizer.decode(response[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
|
74 |
print(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
```
|
76 |
|
77 |
## Limitations
|
|
|
72 |
)
|
73 |
response = tokenizer.decode(response[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
|
74 |
print(response)
|
75 |
+
|
76 |
+
# to render abc notation, you need to install symusic
|
77 |
+
# pip install symusic
|
78 |
+
from symusic import Score, Synthesizer, BuiltInSF3, dump_wav
|
79 |
+
|
80 |
+
abc_pattern = r'(X:\d+\n(?:[^\n]*\n)+)'
|
81 |
+
abc_notation = re.findall(abc_pattern, response+'\n')
|
82 |
+
s = Score.from_abc(abc_notation)
|
83 |
+
audio = synth.render(s, stereo=True)
|
84 |
+
dump_wav('cm_music_piece.wav', audio, sample_rate=44100, use_int16=True)
|
85 |
```
|
86 |
|
87 |
## Limitations
|