tee342 commited on
Commit
a72447c
Β·
verified Β·
1 Parent(s): 055867e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -37
app.py CHANGED
@@ -281,7 +281,8 @@ def process_audio(audio_file, selected_effects, isolate_vocals, preset_name, exp
281
  "Stage Mode": apply_stage_mode
282
  }
283
 
284
- for effect_name in selected_effects:
 
285
  if effect_name in effect_map:
286
  audio = effect_map[effect_name](audio)
287
 
@@ -360,9 +361,17 @@ preset_choices = {
360
  "🌫 ASMR Vocal": ["Auto Gain", "Low-Pass Filter (3000Hz)", "Noise Gate"],
361
  "🎼 Stage Mode": ["Reverb", "Bass Boost", "Limiter"],
362
  "🎡 Auto-Tune Style": ["Pitch Shift (+1 semitone)", "Normalize", "Treble Boost"],
 
 
 
 
 
363
  "🎀 R&B Vocal": ["Noise Reduction", "Bass Boost (100-300Hz)", "Treble Boost (2000-4000Hz)"],
364
  "πŸ’ƒ Soul Vocal": ["Noise Reduction", "Bass Boost (80-200Hz)", "Treble Boost (1500-3500Hz)"],
365
- "πŸ•Ί Funk Groove": ["Bass Boost (80-200Hz)", "Treble Boost (1000-3000Hz)"]
 
 
 
366
  }
367
 
368
  preset_names = list(preset_choices.keys())
@@ -403,7 +412,6 @@ def auto_tune_vocal(audio_path, target_key="C"):
403
  def visualize_spectrum(audio_path):
404
  y, sr = torchaudio.load(audio_path)
405
  y_np = y.numpy().flatten()
406
-
407
  stft = librosa.stft(y_np)
408
  db = librosa.amplitude_to_db(abs(stft))
409
 
@@ -422,7 +430,7 @@ def visualize_spectrum(audio_path):
422
  with gr.Blocks(css="""
423
  body {
424
  font-family: 'Segoe UI', sans-serif;
425
- background-color: #0d1117;
426
  color: white;
427
  padding: 20px;
428
  }
@@ -435,69 +443,80 @@ with gr.Blocks(css="""
435
 
436
  .studio-header h3 {
437
  font-size: 18px;
438
- color: #8892aa;
439
  margin-top: -5px;
440
  font-style: italic;
441
  }
442
 
 
 
 
 
 
443
  .gr-box, .gr-interface {
444
  background-color: #161b22 !important;
445
  border-radius: 12px;
446
  padding: 15px;
447
  box-shadow: 0 0 10px #1f7bbd44;
448
- border: 1px solid #2a3036;
 
 
 
 
 
449
  }
450
 
451
  .gr-button {
452
- background-color: #1f7bbd !important;
453
  color: white !important;
454
  border-radius: 10px;
455
  padding: 10px 20px;
456
  font-weight: bold;
457
- box-shadow: 0 0 10px #1f7bbd44;
458
  border: none;
459
  font-size: 16px;
460
  }
461
 
462
  .gr-button:hover {
463
- background-color: #298eff !important;
464
- box-shadow: 0 0 15px #298effaa;
465
  }
466
 
467
  .gr-tabs button {
468
  font-size: 16px;
469
  padding: 10px 20px;
470
  border-radius: 8px;
471
- background: #161b22;
472
  color: white;
473
  transition: all 0.3s ease;
474
  }
475
 
476
  .gr-tabs button:hover {
477
- background: #298eff;
478
  color: black;
479
- box-shadow: 0 0 10px #298effaa;
480
  }
481
 
482
  input[type="text"], input[type="number"], select, textarea {
483
- background-color: #21262d;
484
- color: white;
485
- border: 1px solid #30363f;
486
- border-radius: 8px;
487
  width: 100%;
 
488
  }
489
 
490
  .gr-checkboxgroup label {
491
- background: #21262d;
492
  color: white;
493
- border: 1px solid #30363f;
494
- border-radius: 8px;
495
- padding: 8px;
496
  transition: background 0.3s;
497
  }
498
 
499
  .gr-checkboxgroup label:hover {
500
- background: #2a3036;
501
  cursor: pointer;
502
  }
503
 
@@ -509,11 +528,11 @@ with gr.Blocks(css="""
509
 
510
  .gr-gallery__items > div:hover {
511
  transform: scale(1.02);
512
- box-shadow: 0 0 12px #298eff44;
513
  }
514
 
515
  .gr-gallery__item-label {
516
- background: rgba(0, 0, 0, 0.6);
517
  backdrop-filter: blur(3px);
518
  border-radius: 0 0 12px 12px;
519
  padding: 10px;
@@ -522,11 +541,6 @@ with gr.Blocks(css="""
522
  text-align: center;
523
  }
524
 
525
- @keyframes float {
526
- 0%, 100% { transform: translateY(0); }
527
- 50% { transform: translateY(-10px); }
528
- }
529
-
530
  @media (max-width: 768px) {
531
  .gr-column {
532
  min-width: 100%;
@@ -536,6 +550,10 @@ with gr.Blocks(css="""
536
  flex-direction: column;
537
  }
538
 
 
 
 
 
539
  .gr-button {
540
  width: 100%;
541
  }
@@ -717,7 +735,10 @@ with gr.Blocks(css="""
717
  gr.Dropdown(choices=preset_names, label="Used Preset", value=preset_names[0]),
718
  gr.CheckboxGroup(choices=preset_choices["Default"], label="Applied Effects")
719
  ],
720
- outputs=gr.File(label="Project File (.aiproj)")
 
 
 
721
  )
722
 
723
  gr.Interface(
@@ -735,13 +756,13 @@ with gr.Blocks(css="""
735
  with gr.Tab("πŸŽ› Preset Gallery"):
736
  gr.Markdown("### Select a preset visually")
737
  preset_gallery = gr.Gallery(value=[
738
- ("images/pop_card.png", "Pop"),
739
- ("images/edm_card.png", "EDM"),
740
- ("images/rock_card.png", "Rock"),
741
- ("images/hiphop_card.png", "Hip-Hop"),
742
- ("images/r&b_card.png", "R&B"),
743
- ("images/funk_card.png", "Soul"),
744
- ("images/funk_card.png", "Funk")
745
  ], label="Preset Cards", columns=4, height="auto")
746
 
747
  preset_name_out = gr.Dropdown(choices=preset_names, label="Selected Preset")
 
281
  "Stage Mode": apply_stage_mode
282
  }
283
 
284
+ effects_to_apply = selected_effects
285
+ for effect_name in effects_to_apply:
286
  if effect_name in effect_map:
287
  audio = effect_map[effect_name](audio)
288
 
 
361
  "🌫 ASMR Vocal": ["Auto Gain", "Low-Pass Filter (3000Hz)", "Noise Gate"],
362
  "🎼 Stage Mode": ["Reverb", "Bass Boost", "Limiter"],
363
  "🎡 Auto-Tune Style": ["Pitch Shift (+1 semitone)", "Normalize", "Treble Boost"],
364
+ "🎷 Jazz Vocal": ["Bass Boost (-200-400Hz)", "Treble Boost (-3000Hz)", "Normalize"],
365
+ "🎹 Jazz Piano": ["Treble Boost (4000-6000Hz)", "Normalize", "Stereo Widening"],
366
+ "🎻 Classical Strings": ["Bass Boost (100-500Hz)", "Treble Boost (3000-6000Hz)", "Reverb"],
367
+ "β˜• Chillhop": ["Noise Gate", "Treble Boost (-3000Hz)", "Reverb"],
368
+ "🌌 Ambient": ["Reverb", "Noise Gate", "Treble Boost (6000-12000Hz)"],
369
  "🎀 R&B Vocal": ["Noise Reduction", "Bass Boost (100-300Hz)", "Treble Boost (2000-4000Hz)"],
370
  "πŸ’ƒ Soul Vocal": ["Noise Reduction", "Bass Boost (80-200Hz)", "Treble Boost (1500-3500Hz)"],
371
+ "πŸ•Ί Funk Groove": ["Bass Boost (80-200Hz)", "Treble Boost (1000-3000Hz)", "Stereo Widening"],
372
+ "🎹 Jazz Piano Solo": ["Treble Boost (2000-5000Hz)", "Normalize", "Stage Mode"],
373
+ "🎸 Trap EDM": ["Bass Boost (60-120Hz)", "Treble Boost (2000-5000Hz)", "Limiter"],
374
+ "🎸 Indie Rock": ["Bass Boost (150-400Hz)", "Treble Boost (2000-5000Hz)", "Compress Dynamic Range"]
375
  }
376
 
377
  preset_names = list(preset_choices.keys())
 
412
  def visualize_spectrum(audio_path):
413
  y, sr = torchaudio.load(audio_path)
414
  y_np = y.numpy().flatten()
 
415
  stft = librosa.stft(y_np)
416
  db = librosa.amplitude_to_db(abs(stft))
417
 
 
430
  with gr.Blocks(css="""
431
  body {
432
  font-family: 'Segoe UI', sans-serif;
433
+ background-color: #1f2937;
434
  color: white;
435
  padding: 20px;
436
  }
 
443
 
444
  .studio-header h3 {
445
  font-size: 18px;
446
+ color: #9ca3af;
447
  margin-top: -5px;
448
  font-style: italic;
449
  }
450
 
451
+ @keyframes float {
452
+ 0%, 100% { transform: translateY(0); }
453
+ 50% { transform: translateY(-10px); }
454
+ }
455
+
456
  .gr-box, .gr-interface {
457
  background-color: #161b22 !important;
458
  border-radius: 12px;
459
  padding: 15px;
460
  box-shadow: 0 0 10px #1f7bbd44;
461
+ border: none;
462
+ transition: all 0.3s ease;
463
+ }
464
+
465
+ .gr-box:hover, .gr-interface:hover {
466
+ box-shadow: 0 0 15px #1f7bbd88;
467
  }
468
 
469
  .gr-button {
470
+ background-color: #2563eb !important;
471
  color: white !important;
472
  border-radius: 10px;
473
  padding: 10px 20px;
474
  font-weight: bold;
475
+ box-shadow: 0 0 10px #2563eb88;
476
  border: none;
477
  font-size: 16px;
478
  }
479
 
480
  .gr-button:hover {
481
+ background-color: #3b82f6 !important;
482
+ box-shadow: 0 0 15px #3b82f6aa;
483
  }
484
 
485
  .gr-tabs button {
486
  font-size: 16px;
487
  padding: 10px 20px;
488
  border-radius: 8px;
489
+ background: #1e293b;
490
  color: white;
491
  transition: all 0.3s ease;
492
  }
493
 
494
  .gr-tabs button:hover {
495
+ background: #3b82f6;
496
  color: black;
497
+ box-shadow: 0 0 10px #3b82f6aa;
498
  }
499
 
500
  input[type="text"], input[type="number"], select, textarea {
501
+ background-color: #334155 !important;
502
+ color: white !important;
503
+ border: 1px solid #475569 !important;
504
+ border-radius: 6px;
505
  width: 100%;
506
+ padding: 10px;
507
  }
508
 
509
  .gr-checkboxgroup label {
510
+ background: #334155;
511
  color: white;
512
+ border: 1px solid #475569;
513
+ border-radius: 6px;
514
+ padding: 8px 12px;
515
  transition: background 0.3s;
516
  }
517
 
518
  .gr-checkboxgroup label:hover {
519
+ background: #475569;
520
  cursor: pointer;
521
  }
522
 
 
528
 
529
  .gr-gallery__items > div:hover {
530
  transform: scale(1.02);
531
+ box-shadow: 0 0 12px #2563eb44;
532
  }
533
 
534
  .gr-gallery__item-label {
535
+ background: rgba(0, 0, 0, 0.7);
536
  backdrop-filter: blur(3px);
537
  border-radius: 0 0 12px 12px;
538
  padding: 10px;
 
541
  text-align: center;
542
  }
543
 
 
 
 
 
 
544
  @media (max-width: 768px) {
545
  .gr-column {
546
  min-width: 100%;
 
550
  flex-direction: column;
551
  }
552
 
553
+ .studio-header img {
554
+ width: 90%;
555
+ }
556
+
557
  .gr-button {
558
  width: 100%;
559
  }
 
735
  gr.Dropdown(choices=preset_names, label="Used Preset", value=preset_names[0]),
736
  gr.CheckboxGroup(choices=preset_choices["Default"], label="Applied Effects")
737
  ],
738
+ outputs=gr.File(label="Project File (.aiproj)"),
739
+ title="Save Everything Together",
740
+ description="Save your session, effects, and settings in one file to reuse later.",
741
+ allow_flagging="never"
742
  )
743
 
744
  gr.Interface(
 
756
  with gr.Tab("πŸŽ› Preset Gallery"):
757
  gr.Markdown("### Select a preset visually")
758
  preset_gallery = gr.Gallery(value=[
759
+ ("https://picsum.photos/id/10/150/100", "Pop"),
760
+ ("https://picsum.photos/id/20/150/100", "EDM"),
761
+ ("https://picsum.photos/id/30/150/100", "Rock"),
762
+ ("https://picsum.photos/id/40/150/100", "Hip-Hop"),
763
+ ("https://picsum.photos/id/50/150/100", "R&B"),
764
+ ("https://picsum.photos/id/60/150/100", "Soul"),
765
+ ("https://picsum.photos/id/70/150/100", "Funk")
766
  ], label="Preset Cards", columns=4, height="auto")
767
 
768
  preset_name_out = gr.Dropdown(choices=preset_names, label="Selected Preset")