Mike0021 commited on
Commit
010a4f9
·
verified ·
1 Parent(s): f5b863e

Add one-click synthetic audio examples

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ examples/clockwork-waltz.mp3 filter=lfs diff=lfs merge=lfs -text
37
+ examples/glass-arpeggio.mp3 filter=lfs diff=lfs merge=lfs -text
38
+ examples/neon-groove.mp3 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -16,6 +16,8 @@ A custom ZeroGPU interface for [MuScriptor](https://github.com/muscriptor/muscri
16
 
17
  The app runs the 307M-parameter medium checkpoint, streams transcription progress after each 5-second audio window, renders an interactive color-coded piano roll, and exports both the full arrangement and isolated instrument MIDI files.
18
 
 
 
19
  The checkpoint is gated under CC BY-NC 4.0. This Space requires an `HF_TOKEN` secret whose owner has accepted access to [`MuScriptor/muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium).
20
 
21
  ## API
 
16
 
17
  The app runs the 307M-parameter medium checkpoint, streams transcription progress after each 5-second audio window, renders an interactive color-coded piano roll, and exports both the full arrangement and isolated instrument MIDI files.
18
 
19
+ Three one-click example sessions are included: a synth-funk groove, a drumless glass arpeggio, and a clockwork 3/4 waltz. They are original procedural recordings made entirely from generated oscillators and seeded noise, with no third-party samples. Example results are cached lazily after first use so startup never consumes ZeroGPU quota.
20
+
21
  The checkpoint is gated under CC BY-NC 4.0. This Space requires an `HF_TOKEN` secret whose owner has accepted access to [`MuScriptor/muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium).
22
 
23
  ## API
app.py CHANGED
@@ -38,6 +38,7 @@ from safetensors.torch import load_file
38
 
39
  APP_ROOT = Path(__file__).resolve().parent
40
  ASSET_ROOT = APP_ROOT / "assets"
 
41
  MODEL_ID = "MuScriptor/muscriptor-medium"
42
  MODEL_VARIANT = "medium"
43
  MAX_AUDIO_SECONDS = 60.0
@@ -580,6 +581,44 @@ RESULT_HEADING = """
580
  </div>
581
  """
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  FOOTNOTE = """
584
  <div class="footnote">
585
  <span>Your audio is processed ephemerally and is not retained.</span>
@@ -652,6 +691,35 @@ with gr.Blocks(title="MuScriptor — Audio to MIDI") as demo:
652
  )
653
  manifest_output = gr.JSON(label="Transcription manifest", visible=False)
654
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  gr.HTML(FOOTNOTE)
656
 
657
  transcribe_button.click(
 
38
 
39
  APP_ROOT = Path(__file__).resolve().parent
40
  ASSET_ROOT = APP_ROOT / "assets"
41
+ EXAMPLE_ROOT = APP_ROOT / "examples"
42
  MODEL_ID = "MuScriptor/muscriptor-medium"
43
  MODEL_VARIANT = "medium"
44
  MAX_AUDIO_SECONDS = 60.0
 
581
  </div>
582
  """
583
 
584
+ EXAMPLES_HEADING = """
585
+ <div class="examples-heading">
586
+ <div>
587
+ <span class="examples-kicker">Try a session</span>
588
+ <h2>Start with an example</h2>
589
+ <p>Original procedural clips with different rhythms, textures and instrument roles.</p>
590
+ </div>
591
+ <span class="examples-hint">One click · 9–12 seconds</span>
592
+ </div>
593
+ """
594
+
595
+ EXAMPLE_ROWS = [
596
+ [
597
+ str(EXAMPLE_ROOT / "neon-groove.mp3"),
598
+ ["electric_bass", "synth_lead", "drums"],
599
+ False,
600
+ 1.0,
601
+ ],
602
+ [
603
+ str(EXAMPLE_ROOT / "glass-arpeggio.mp3"),
604
+ ["electric_piano", "synth_pad", "electric_bass"],
605
+ False,
606
+ 1.0,
607
+ ],
608
+ [
609
+ str(EXAMPLE_ROOT / "clockwork-waltz.mp3"),
610
+ ["chromatic_percussion", "acoustic_bass", "drums"],
611
+ False,
612
+ 1.0,
613
+ ],
614
+ ]
615
+
616
+ EXAMPLE_LABELS = [
617
+ "Neon Groove · synth-funk, bass & drums · 12s",
618
+ "Glass Arpeggio · keys, pad & sub-bass · 10s",
619
+ "Clockwork Waltz · bells, bass & 3/4 drums · 9s",
620
+ ]
621
+
622
  FOOTNOTE = """
623
  <div class="footnote">
624
  <span>Your audio is processed ephemerally and is not retained.</span>
 
691
  )
692
  manifest_output = gr.JSON(label="Transcription manifest", visible=False)
693
 
694
+ with gr.Column(elem_id="examples-section"):
695
+ gr.HTML(EXAMPLES_HEADING)
696
+ gr.Examples(
697
+ examples=EXAMPLE_ROWS,
698
+ inputs=[
699
+ audio_input,
700
+ instrument_input,
701
+ use_sampling_input,
702
+ temperature_input,
703
+ ],
704
+ outputs=[
705
+ full_midi_output,
706
+ track_files_output,
707
+ visualizer_output,
708
+ manifest_output,
709
+ ],
710
+ fn=transcribe_audio,
711
+ cache_examples=True,
712
+ cache_mode="lazy",
713
+ run_on_click=True,
714
+ preload=False,
715
+ examples_per_page=3,
716
+ example_labels=EXAMPLE_LABELS,
717
+ label=None,
718
+ elem_id="examples-gallery",
719
+ api_visibility="private",
720
+ api_name="load_example",
721
+ )
722
+
723
  gr.HTML(FOOTNOTE)
724
 
725
  transcribe_button.click(
assets/app.css CHANGED
@@ -1233,3 +1233,245 @@ body::after {
1233
  transition-duration: 0.01ms !important;
1234
  }
1235
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1233
  transition-duration: 0.01ms !important;
1234
  }
1235
  }
1236
+
1237
+ /* Click-to-transcribe audio examples */
1238
+ #examples-section {
1239
+ position: relative;
1240
+ isolation: isolate;
1241
+ overflow: hidden;
1242
+ min-width: 0;
1243
+ gap: 14px !important;
1244
+ padding: clamp(16px, 2.2vw, 24px) !important;
1245
+ border: 1px solid var(--ms-border) !important;
1246
+ border-radius: var(--ms-radius-xl) !important;
1247
+ background:
1248
+ radial-gradient(680px 170px at 8% 0%, rgba(139, 124, 255, 0.085), transparent 68%),
1249
+ linear-gradient(145deg, rgba(20, 23, 32, 0.86), rgba(13, 16, 22, 0.84)) !important;
1250
+ box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.025) !important;
1251
+ backdrop-filter: blur(20px);
1252
+ }
1253
+
1254
+ #examples-section::before {
1255
+ position: absolute;
1256
+ top: 0;
1257
+ right: 9%;
1258
+ left: 9%;
1259
+ height: 1px;
1260
+ content: "";
1261
+ pointer-events: none;
1262
+ background: linear-gradient(90deg, transparent, rgba(193, 187, 255, 0.2), transparent);
1263
+ }
1264
+
1265
+ .examples-heading {
1266
+ display: flex;
1267
+ align-items: flex-end;
1268
+ justify-content: space-between;
1269
+ min-width: 0;
1270
+ gap: 18px;
1271
+ padding: 0 2px !important;
1272
+ border: 0 !important;
1273
+ background: transparent !important;
1274
+ }
1275
+
1276
+ .examples-heading > .wrap,
1277
+ .examples-heading > .prose,
1278
+ .examples-heading .html-container {
1279
+ width: 100%;
1280
+ padding: 0 !important;
1281
+ border: 0 !important;
1282
+ background: transparent !important;
1283
+ }
1284
+
1285
+ .examples-heading h2 {
1286
+ margin: 0 0 5px;
1287
+ color: var(--ms-text);
1288
+ font-size: 0.92rem;
1289
+ font-weight: 630;
1290
+ letter-spacing: -0.022em;
1291
+ line-height: 1.2;
1292
+ }
1293
+
1294
+ .examples-heading p {
1295
+ margin: 0;
1296
+ color: var(--ms-muted);
1297
+ font-size: 0.7rem;
1298
+ line-height: 1.5;
1299
+ }
1300
+
1301
+ .examples-heading .examples-kicker,
1302
+ .examples-heading .step-number {
1303
+ color: #aaa1ff;
1304
+ font-family: var(--ms-mono);
1305
+ font-size: 0.62rem;
1306
+ font-weight: 650;
1307
+ letter-spacing: 0.09em;
1308
+ text-transform: uppercase;
1309
+ }
1310
+
1311
+ .examples-heading .examples-hint {
1312
+ flex: none;
1313
+ color: var(--ms-faint);
1314
+ font-family: var(--ms-mono);
1315
+ font-size: 0.59rem;
1316
+ letter-spacing: 0.02em;
1317
+ white-space: nowrap;
1318
+ }
1319
+
1320
+ #examples-gallery,
1321
+ #examples-gallery > .wrap,
1322
+ #examples-gallery > div {
1323
+ min-width: 0;
1324
+ padding: 0 !important;
1325
+ border: 0 !important;
1326
+ background: transparent !important;
1327
+ box-shadow: none !important;
1328
+ }
1329
+
1330
+ /* The custom heading replaces Gradio's generic "Examples" label. */
1331
+ #examples-gallery > .label,
1332
+ #examples-gallery > .wrap > .label,
1333
+ #examples-gallery .label:first-child {
1334
+ display: none !important;
1335
+ }
1336
+
1337
+ #examples-gallery .gallery {
1338
+ display: grid !important;
1339
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1340
+ width: 100% !important;
1341
+ max-width: none !important;
1342
+ gap: 9px !important;
1343
+ }
1344
+
1345
+ #examples-gallery button.gallery-item,
1346
+ #examples-gallery .gallery > button {
1347
+ position: relative;
1348
+ display: flex !important;
1349
+ align-items: center;
1350
+ width: 100%;
1351
+ min-width: 0;
1352
+ min-height: 68px;
1353
+ gap: 11px;
1354
+ padding: 11px 12px !important;
1355
+ border: 1px solid var(--ms-border) !important;
1356
+ border-radius: 12px !important;
1357
+ background: rgba(6, 8, 12, 0.44) !important;
1358
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.018) !important;
1359
+ color: var(--ms-text-soft) !important;
1360
+ text-align: left;
1361
+ cursor: pointer;
1362
+ transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease !important;
1363
+ }
1364
+
1365
+ #examples-gallery button.gallery-item::before,
1366
+ #examples-gallery .gallery > button::before {
1367
+ display: grid;
1368
+ width: 34px;
1369
+ height: 34px;
1370
+ flex: none;
1371
+ border: 1px solid rgba(139, 124, 255, 0.2);
1372
+ border-radius: 10px;
1373
+ content: "\266A";
1374
+ background: linear-gradient(145deg, rgba(139, 124, 255, 0.14), rgba(95, 140, 255, 0.055));
1375
+ color: #bbb4ff;
1376
+ font-size: 0.87rem;
1377
+ line-height: 1;
1378
+ place-items: center;
1379
+ }
1380
+
1381
+ #examples-gallery button.gallery-item::after,
1382
+ #examples-gallery .gallery > button::after {
1383
+ width: 6px;
1384
+ height: 6px;
1385
+ flex: none;
1386
+ margin-left: auto;
1387
+ border-top: 1px solid var(--ms-faint);
1388
+ border-right: 1px solid var(--ms-faint);
1389
+ content: "";
1390
+ transform: rotate(45deg);
1391
+ transition: border-color 150ms ease, transform 150ms ease;
1392
+ }
1393
+
1394
+ #examples-gallery button.gallery-item:hover,
1395
+ #examples-gallery .gallery > button:hover {
1396
+ border-color: rgba(139, 124, 255, 0.34) !important;
1397
+ background: rgba(139, 124, 255, 0.075) !important;
1398
+ box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16), inset 0 1px rgba(255, 255, 255, 0.035) !important;
1399
+ transform: translateY(-1px);
1400
+ }
1401
+
1402
+ #examples-gallery button.gallery-item:hover::after,
1403
+ #examples-gallery .gallery > button:hover::after {
1404
+ border-color: #c9c4ff;
1405
+ transform: translateX(2px) rotate(45deg);
1406
+ }
1407
+
1408
+ #examples-gallery button.gallery-item:focus-visible,
1409
+ #examples-gallery .gallery > button:focus-visible {
1410
+ outline: 2px solid rgba(139, 124, 255, 0.72) !important;
1411
+ outline-offset: 2px;
1412
+ }
1413
+
1414
+ #examples-gallery button.gallery-item:has(.selected),
1415
+ #examples-gallery .gallery > button:has(.selected) {
1416
+ border-color: rgba(139, 124, 255, 0.42) !important;
1417
+ background: rgba(139, 124, 255, 0.1) !important;
1418
+ }
1419
+
1420
+ #examples-gallery .gallery-item > div,
1421
+ #examples-gallery .gallery > button > div {
1422
+ min-width: 0 !important;
1423
+ flex: 1;
1424
+ padding: 0 !important;
1425
+ color: var(--ms-text-soft) !important;
1426
+ font-family: var(--ms-font) !important;
1427
+ font-size: 0.75rem !important;
1428
+ font-weight: 580;
1429
+ letter-spacing: -0.008em;
1430
+ line-height: 1.35;
1431
+ white-space: normal !important;
1432
+ }
1433
+
1434
+ #examples-gallery .gallery-item p {
1435
+ margin: 0;
1436
+ color: var(--ms-text-soft) !important;
1437
+ font-size: 0.75rem !important;
1438
+ font-weight: 580;
1439
+ line-height: 1.35;
1440
+ }
1441
+
1442
+ #examples-gallery .gallery-item audio {
1443
+ width: min(100%, 210px);
1444
+ height: 32px;
1445
+ margin-top: 6px;
1446
+ color-scheme: dark;
1447
+ filter: saturate(0.72) contrast(0.94);
1448
+ }
1449
+
1450
+ @media (max-width: 700px) {
1451
+ #examples-section {
1452
+ gap: 12px !important;
1453
+ padding: 15px !important;
1454
+ border-radius: 17px !important;
1455
+ }
1456
+
1457
+ .examples-heading {
1458
+ align-items: flex-start;
1459
+ flex-direction: column;
1460
+ gap: 7px;
1461
+ }
1462
+
1463
+ .examples-heading .examples-hint {
1464
+ white-space: normal;
1465
+ }
1466
+
1467
+ #examples-gallery .gallery {
1468
+ grid-template-columns: minmax(0, 1fr);
1469
+ gap: 7px !important;
1470
+ }
1471
+
1472
+ #examples-gallery button.gallery-item,
1473
+ #examples-gallery .gallery > button {
1474
+ min-height: 60px;
1475
+ padding: 9px 10px !important;
1476
+ }
1477
+ }
examples/README.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Example audio
2
+
3
+ These three short clips are original procedural recordings created for MuScriptor Studio. They use only synthesized oscillators and deterministically seeded noise; no third-party samples or compositions are present. They may be reused royalty-free.
4
+
5
+ - `neon-groove.mp3` — 12 seconds of synth-funk lead, root-motion bass, kick, snare, and hi-hat.
6
+ - `glass-arpeggio.mp3` — 10 seconds of drumless four-chord arpeggio, sustained pad, and sub-bass.
7
+ - `clockwork-waltz.mp3` — 9 seconds of 3/4 bell melody, walking bass, kick, rim, and hi-hat.
8
+
9
+ All files are stereo 44.1 kHz MP3 audio encoded at approximately 96 kbps.
examples/clockwork-waltz.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92a241512dea927b85f8cd4c090b4437c1f0f0932a793a799b5d44a4e769f1ec
3
+ size 108818
examples/glass-arpeggio.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2b7b88a3cfa83fd7e7495f5f1612f5bf44efa2573726d0cb798070d34d70f77
3
+ size 120730
examples/neon-groove.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae0da40b49b9ebafad5ecd356545fa4a40139019d14f88a2b0002b08827316b1
3
+ size 144867