Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
Gradio app for classical music generation with a grid-based Transformer.
|
| 3 |
-
Completely native, optimized
|
| 4 |
-
synthesis
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
|
@@ -45,6 +45,7 @@ CSS_ESTHETIC = """
|
|
| 45 |
color: #c9d1e8 !important;
|
| 46 |
text-align: right;
|
| 47 |
align-self: center;
|
|
|
|
| 48 |
}
|
| 49 |
.matrix-cell {
|
| 50 |
min-width: 20px !important;
|
|
@@ -60,9 +61,9 @@ CSS_ESTHETIC = """
|
|
| 60 |
border: 1px solid rgba(255, 255, 255, 0.02) !important;
|
| 61 |
}
|
| 62 |
.cell-strings-on { background-color: #63b3ed !important; box-shadow: inset 0 0 5px #fff !important; }
|
| 63 |
-
.cell-brass-on { background-color: #fbbf24 !important; box-shadow: inset 0 0
|
| 64 |
-
.cell-woodwinds-on { background-color: #6ed29b !important; box-shadow: inset 0 0
|
| 65 |
-
.cell-perc-on { background-color: #fc814a !important; box-shadow: inset 0 0
|
| 66 |
|
| 67 |
/* Timeline Bar Separations */
|
| 68 |
.bar-line-left {
|
|
@@ -77,6 +78,16 @@ CSS_ESTHETIC = """
|
|
| 77 |
padding: 12px !important;
|
| 78 |
border-radius: 6px !important;
|
| 79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
"""
|
| 81 |
|
| 82 |
# Dynamic Web Audio JS script to synthesize accurate note pitches
|
|
@@ -247,7 +258,8 @@ with gr.Blocks(title="Classical Music Grid Generator", css=CSS_ESTHETIC) as demo
|
|
| 247 |
s_buttons = []
|
| 248 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 249 |
with gr.Row():
|
| 250 |
-
gr.
|
|
|
|
| 251 |
for c in range(config.INPUT_STEPS):
|
| 252 |
cls = "cell-off"
|
| 253 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
@@ -262,7 +274,8 @@ with gr.Blocks(title="Classical Music Grid Generator", css=CSS_ESTHETIC) as demo
|
|
| 262 |
w_buttons = []
|
| 263 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 264 |
with gr.Row():
|
| 265 |
-
gr.
|
|
|
|
| 266 |
for c in range(config.INPUT_STEPS):
|
| 267 |
cls = "cell-off"
|
| 268 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
@@ -277,7 +290,8 @@ with gr.Blocks(title="Classical Music Grid Generator", css=CSS_ESTHETIC) as demo
|
|
| 277 |
b_buttons = []
|
| 278 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 279 |
with gr.Row():
|
| 280 |
-
gr.
|
|
|
|
| 281 |
for c in range(config.INPUT_STEPS):
|
| 282 |
cls = "cell-off"
|
| 283 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
@@ -292,7 +306,8 @@ with gr.Blocks(title="Classical Music Grid Generator", css=CSS_ESTHETIC) as demo
|
|
| 292 |
p_buttons = []
|
| 293 |
for r in reversed(range(config.PITCHES_PERC)):
|
| 294 |
with gr.Row():
|
| 295 |
-
gr.
|
|
|
|
| 296 |
for c in range(config.INPUT_STEPS):
|
| 297 |
cls = "cell-off"
|
| 298 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
@@ -372,4 +387,4 @@ with gr.Blocks(title="Classical Music Grid Generator", css=CSS_ESTHETIC) as demo
|
|
| 372 |
)
|
| 373 |
|
| 374 |
if __name__ == "__main__":
|
| 375 |
-
demo.launch()
|
|
|
|
| 1 |
"""
|
| 2 |
Gradio app for classical music generation with a grid-based Transformer.
|
| 3 |
+
Completely native, optimized engine with variable frequency pitch
|
| 4 |
+
synthesis, active coordinate control HUD, and production-safe layout configurations.
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
|
|
|
| 45 |
color: #c9d1e8 !important;
|
| 46 |
text-align: right;
|
| 47 |
align-self: center;
|
| 48 |
+
line-height: 26px !important;
|
| 49 |
}
|
| 50 |
.matrix-cell {
|
| 51 |
min-width: 20px !important;
|
|
|
|
| 61 |
border: 1px solid rgba(255, 255, 255, 0.02) !important;
|
| 62 |
}
|
| 63 |
.cell-strings-on { background-color: #63b3ed !important; box-shadow: inset 0 0 5px #fff !important; }
|
| 64 |
+
.cell-brass-on { background-color: #fbbf24 !important; box-shadow: inset 0 0 5px #fff !important; }
|
| 65 |
+
.cell-woodwinds-on { background-color: #6ed29b !important; box-shadow: inset 0 0 5px #fff !important; }
|
| 66 |
+
.cell-perc-on { background-color: #fc814a !important; box-shadow: inset 0 0 5px #fff !important; }
|
| 67 |
|
| 68 |
/* Timeline Bar Separations */
|
| 69 |
.bar-line-left {
|
|
|
|
| 78 |
padding: 12px !important;
|
| 79 |
border-radius: 6px !important;
|
| 80 |
}
|
| 81 |
+
.hud-container h3,
|
| 82 |
+
.hud-container h2,
|
| 83 |
+
.hud-container h1,
|
| 84 |
+
.hud-container p,
|
| 85 |
+
.hud-container span,
|
| 86 |
+
.hud-container li,
|
| 87 |
+
.hud-container em,
|
| 88 |
+
.hud-container strong {
|
| 89 |
+
color: #ffffff !important;
|
| 90 |
+
}
|
| 91 |
"""
|
| 92 |
|
| 93 |
# Dynamic Web Audio JS script to synthesize accurate note pitches
|
|
|
|
| 258 |
s_buttons = []
|
| 259 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 260 |
with gr.Row():
|
| 261 |
+
with gr.Column(min_width=40, scale=0):
|
| 262 |
+
gr.HTML(f"<div class='grid-label'>{_MELODIC_NOTE_NAMES[r]}</div>")
|
| 263 |
for c in range(config.INPUT_STEPS):
|
| 264 |
cls = "cell-off"
|
| 265 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
|
|
| 274 |
w_buttons = []
|
| 275 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 276 |
with gr.Row():
|
| 277 |
+
with gr.Column(min_width=40, scale=0):
|
| 278 |
+
gr.HTML(f"<div class='grid-label'>{_MELODIC_NOTE_NAMES[r]}</div>")
|
| 279 |
for c in range(config.INPUT_STEPS):
|
| 280 |
cls = "cell-off"
|
| 281 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
|
|
| 290 |
b_buttons = []
|
| 291 |
for r in reversed(range(config.PITCHES_MELODIC)):
|
| 292 |
with gr.Row():
|
| 293 |
+
with gr.Column(min_width=40, scale=0):
|
| 294 |
+
gr.HTML(f"<div class='grid-label'>{_MELODIC_NOTE_NAMES[r]}</div>")
|
| 295 |
for c in range(config.INPUT_STEPS):
|
| 296 |
cls = "cell-off"
|
| 297 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
|
|
| 306 |
p_buttons = []
|
| 307 |
for r in reversed(range(config.PITCHES_PERC)):
|
| 308 |
with gr.Row():
|
| 309 |
+
with gr.Column(min_width=40, scale=0):
|
| 310 |
+
gr.HTML(f"<div class='grid-label'>{_PERC_NOTE_NAMES[r]}</div>")
|
| 311 |
for c in range(config.INPUT_STEPS):
|
| 312 |
cls = "cell-off"
|
| 313 |
if c > 0 and c % config.STEPS_PER_BAR == 0:
|
|
|
|
| 387 |
)
|
| 388 |
|
| 389 |
if __name__ == "__main__":
|
| 390 |
+
demo.launch()
|