Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
|
5 |
import torch
|
6 |
import random
|
7 |
|
8 |
-
# Use
|
9 |
-
MODEL_NAME = "
|
10 |
|
11 |
# Initialize model with pipeline for easier usage
|
12 |
try:
|
@@ -162,14 +162,15 @@ WORKING_PATTERNS = {
|
|
162 |
"""stack(
|
163 |
s("bd ~ sn ~").gain(0.9),
|
164 |
s("hh ~ hh hh ~ hh ~ hh").gain(0.5),
|
165 |
-
n("0 0 3 5").s("sawtooth").octave(
|
166 |
s("~ ~ ~ [clap clap]").slow(2).gain(0.6)
|
167 |
).scale("c:minor")""",
|
168 |
|
169 |
"""stack(
|
170 |
s("bd ~ [bd sn] ~").gain(0.9),
|
171 |
s("[hh ch]*4").degradeBy(0.1).gain(0.5),
|
172 |
-
n("[0 3 5]*2").s("
|
|
|
173 |
s("~ ~ clap ~").room(0.3).gain(0.7),
|
174 |
s("~ [perc:0]/4 ~ [perc:1]/4").gain(0.4)
|
175 |
).scale("a:minor")""",
|
@@ -177,14 +178,16 @@ WORKING_PATTERNS = {
|
|
177 |
"""stack(
|
178 |
s("bd ~ sn [~ bd]").sometimes(fast(2)).gain(0.9),
|
179 |
s("hh*8").degradeBy(0.2).gain(0.4),
|
180 |
-
n("0 ~ 3 ~").s("sawtooth").octave(
|
|
|
181 |
s("~ ~ [clap rim] ~").gain(0.6).room(0.4)
|
182 |
).scale("d:minor")""",
|
183 |
|
184 |
"""stack(
|
185 |
s("[bd bd] ~ sn ~").gain(0.9),
|
186 |
s("~ hh ~ [hh ch hh]").gain(0.5),
|
187 |
-
n("[0 3] [5 0] [7 3] [5 0]").s("sine").octave(
|
|
|
188 |
s("~ ~ clap ~").delay(0.125).gain(0.7)
|
189 |
).scale("g:minor")"""
|
190 |
]
|
@@ -202,7 +205,7 @@ def get_random_working_pattern(genre, complexity="moderate"):
|
|
202 |
"ambient": 'n("[0 2 4]/3").s("sine").octave(3).slow(8).room(0.9).gain(0.6).scale("d:minor")',
|
203 |
"breakbeat": 's("[bd sn]*2, hh*8").speed(0.9).gain(0.8)',
|
204 |
"experimental": 's("bd ~ [perc:0 perc:1]").degradeBy(0.4).speed(rand.range(0.8,1.2)).gain(0.7)',
|
205 |
-
"hiphop": 's("bd ~ sn ~, hh ~ hh hh ~ hh ~ hh").gain(0.8)'
|
206 |
}
|
207 |
return simple_patterns.get(genre, simple_patterns["techno"])
|
208 |
|
@@ -402,7 +405,7 @@ with gr.Blocks(title="Working Strudel Generator", theme=gr.themes.Soft()) as app
|
|
402 |
ποΈ **Real Strudel syntax** - copy & paste ready
|
403 |
π¨ **Reactive Hydra visuals** included
|
404 |
π΅ **6 genres** with authentic patterns
|
405 |
-
π€ **Optional AI
|
406 |
|
407 |
**Usage:** Describe music β Generate β Copy to [strudel.cc](https://strudel.cc) β Play!
|
408 |
""")
|
@@ -435,7 +438,7 @@ with gr.Blocks(title="Working Strudel Generator", theme=gr.themes.Soft()) as app
|
|
435 |
)
|
436 |
|
437 |
use_ai = gr.Checkbox(
|
438 |
-
label="π€ Use AI
|
439 |
value=False
|
440 |
)
|
441 |
|
|
|
5 |
import torch
|
6 |
import random
|
7 |
|
8 |
+
# Use much faster, smaller model
|
9 |
+
MODEL_NAME = "microsoft/DialoGPT-small"
|
10 |
|
11 |
# Initialize model with pipeline for easier usage
|
12 |
try:
|
|
|
162 |
"""stack(
|
163 |
s("bd ~ sn ~").gain(0.9),
|
164 |
s("hh ~ hh hh ~ hh ~ hh").gain(0.5),
|
165 |
+
n("0 0 3 5").s("sawtooth").octave(1).lpf(1000).gain(0.8),
|
166 |
s("~ ~ ~ [clap clap]").slow(2).gain(0.6)
|
167 |
).scale("c:minor")""",
|
168 |
|
169 |
"""stack(
|
170 |
s("bd ~ [bd sn] ~").gain(0.9),
|
171 |
s("[hh ch]*4").degradeBy(0.1).gain(0.5),
|
172 |
+
n("[0 3 5]*2").s("sine").octave(1).lpf(800).gain(0.9),
|
173 |
+
n("0 3 5 7").s("square").octave(3).lpf(1200).gain(0.4),
|
174 |
s("~ ~ clap ~").room(0.3).gain(0.7),
|
175 |
s("~ [perc:0]/4 ~ [perc:1]/4").gain(0.4)
|
176 |
).scale("a:minor")""",
|
|
|
178 |
"""stack(
|
179 |
s("bd ~ sn [~ bd]").sometimes(fast(2)).gain(0.9),
|
180 |
s("hh*8").degradeBy(0.2).gain(0.4),
|
181 |
+
n("0 ~ 3 ~").s("sawtooth").octave(1).lpf(1200).gain(0.9),
|
182 |
+
n("[0 3 5 7]*2").s("triangle").octave(3).gain(0.5),
|
183 |
s("~ ~ [clap rim] ~").gain(0.6).room(0.4)
|
184 |
).scale("d:minor")""",
|
185 |
|
186 |
"""stack(
|
187 |
s("[bd bd] ~ sn ~").gain(0.9),
|
188 |
s("~ hh ~ [hh ch hh]").gain(0.5),
|
189 |
+
n("[0 3] [5 0] [7 3] [5 0]").s("sine").octave(1).lpf(1500).gain(0.8),
|
190 |
+
n("0 7 4 2").s("square").octave(3).delay(0.125).gain(0.4),
|
191 |
s("~ ~ clap ~").delay(0.125).gain(0.7)
|
192 |
).scale("g:minor")"""
|
193 |
]
|
|
|
205 |
"ambient": 'n("[0 2 4]/3").s("sine").octave(3).slow(8).room(0.9).gain(0.6).scale("d:minor")',
|
206 |
"breakbeat": 's("[bd sn]*2, hh*8").speed(0.9).gain(0.8)',
|
207 |
"experimental": 's("bd ~ [perc:0 perc:1]").degradeBy(0.4).speed(rand.range(0.8,1.2)).gain(0.7)',
|
208 |
+
"hiphop": 's("bd ~ sn ~, hh ~ hh hh ~ hh ~ hh").gain(0.8).add(n("0 0 3 5").s("sine").octave(1).gain(0.8))'
|
209 |
}
|
210 |
return simple_patterns.get(genre, simple_patterns["techno"])
|
211 |
|
|
|
405 |
ποΈ **Real Strudel syntax** - copy & paste ready
|
406 |
π¨ **Reactive Hydra visuals** included
|
407 |
π΅ **6 genres** with authentic patterns
|
408 |
+
π€ **Optional AI** (recommended: keep AI off for speed)
|
409 |
|
410 |
**Usage:** Describe music β Generate β Copy to [strudel.cc](https://strudel.cc) β Play!
|
411 |
""")
|
|
|
438 |
)
|
439 |
|
440 |
use_ai = gr.Checkbox(
|
441 |
+
label="π€ Use AI (slower)",
|
442 |
value=False
|
443 |
)
|
444 |
|