tee342 commited on
Commit
b92c2bd
Β·
verified Β·
1 Parent(s): 8ee9321

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -31
app.py CHANGED
@@ -574,28 +574,31 @@ def ai_mastering_chain(audio_path, genre="Pop", target_lufs=-14.0):
574
  audio.export(out_path, format="wav")
575
  return out_path
576
 
577
- # === Generate PDF Report ===
 
578
  try:
579
  from fpdf import FPDF
580
  pdf_available = True
581
  except ImportError:
582
- pdf_available = False
583
-
584
- class PDFReport(FPDF):
585
- def header(self):
586
- self.set_font('Arial', 'B', 12)
587
- self.cell(0, 10, 'Studio Pulse AI - Session Report', ln=True, align='C')
588
-
589
- def export_session_report(session_data):
590
- if not pdf_available:
 
 
 
 
 
 
 
 
 
591
  return None
592
- pdf = PDFReport()
593
- pdf.add_page()
594
- pdf.set_font("Arial", size=10)
595
- pdf.multi_cell(0, 10, txt=session_data)
596
- out_path = os.path.join(tempfile.gettempdir(), "session_report.pdf")
597
- pdf.output(out_path)
598
- return out_path
599
 
600
  # === Main UI – With Studio Pulse Branding ===
601
  with gr.Blocks(css="""
@@ -836,7 +839,7 @@ with gr.Blocks(css="""
836
  gr.Textbox(label="Status", value="βœ… Ready", lines=1)
837
  ],
838
  title="Batch Audio Processor",
839
- description="Upload multiple files, apply effects in bulk, and download all results in a single ZIP.",
840
  flagging_mode="never",
841
  submit_btn="Process All Files"
842
  )
@@ -875,9 +878,7 @@ with gr.Blocks(css="""
875
  gr.Interface(
876
  fn=visualize_spectrum,
877
  inputs=gr.Audio(label="Upload Track", type="filepath"),
878
- outputs=gr.Image(label="Spectrum Analysis"),
879
- title="Real-Time Spectrum Analyzer",
880
- description="See the frequency breakdown of your audio"
881
  )
882
 
883
  # --- Loudness Graph Tab – EBU R128 Matching ===
@@ -994,14 +995,6 @@ with gr.Blocks(css="""
994
  description="Apply custom EQ based on genre"
995
  )
996
 
997
- # --- AI Suggest Effects Based on Genre ===
998
- with gr.Tab("🧩 AI Effect Suggestions"):
999
- gr.Interface(
1000
- fn=suggest_by_genre,
1001
- inputs=gr.Audio(label="Upload Track", type="filepath"),
1002
- outputs=gr.CheckboxGroup(choices=preset_choices["Default"], label="Suggested Effects")
1003
- )
1004
-
1005
  # --- Time-Stretch & BPM Match ===
1006
  with gr.Tab("⏱ Time-Stretch & BPM Match"):
1007
  gr.Interface(
@@ -1012,7 +1005,7 @@ with gr.Blocks(css="""
1012
  ],
1013
  outputs=gr.Audio(label="Stretched Output", type="filepath"),
1014
  title="Match Track to BPM",
1015
- description="Stretch audio to match a specific tempo"
1016
  )
1017
 
1018
  # --- A/B Compare ===
@@ -1072,11 +1065,14 @@ with gr.Blocks(css="""
1072
  ### Keyboard Controls
1073
  - `Ctrl + Z`: Undo last effect
1074
  - `Ctrl + Y`: Redo
1075
- - `Spacebar`: Play/Stop
1076
  - `Ctrl + S`: Save current session
1077
  - `Ctrl + O`: Open session
1078
  - `Ctrl + C`: Copy effect chain
1079
  - `Ctrl + V`: Paste effect chain
 
 
 
1080
  """)
1081
 
1082
  # --- Vocal Formant Correction – Now Defined! ===
 
574
  audio.export(out_path, format="wav")
575
  return out_path
576
 
577
+ # === Generate PDF Report – Safely Wrapped ===
578
+ pdf_available = False
579
  try:
580
  from fpdf import FPDF
581
  pdf_available = True
582
  except ImportError:
583
+ pass
584
+
585
+ if pdf_available:
586
+ class PDFReport(FPDF):
587
+ def header(self):
588
+ self.set_font('Arial', 'B', 12)
589
+ self.cell(0, 10, 'Studio Pulse AI - Session Report', ln=True, align='C')
590
+
591
+ def export_session_report(session_data):
592
+ pdf = PDFReport()
593
+ pdf.add_page()
594
+ pdf.set_font("Arial", size=10)
595
+ pdf.multi_cell(0, 10, txt=session_data)
596
+ out_path = os.path.join(tempfile.gettempdir(), "session_report.pdf")
597
+ pdf.output(out_path)
598
+ return out_path
599
+ else:
600
+ def export_session_report(session_data):
601
  return None
 
 
 
 
 
 
 
602
 
603
  # === Main UI – With Studio Pulse Branding ===
604
  with gr.Blocks(css="""
 
839
  gr.Textbox(label="Status", value="βœ… Ready", lines=1)
840
  ],
841
  title="Batch Audio Processor",
842
+ description="Upload multiple files, apply effects in bulk, and download all results in a ZIP.",
843
  flagging_mode="never",
844
  submit_btn="Process All Files"
845
  )
 
878
  gr.Interface(
879
  fn=visualize_spectrum,
880
  inputs=gr.Audio(label="Upload Track", type="filepath"),
881
+ outputs=gr.Image(label="Spectrum Analysis")
 
 
882
  )
883
 
884
  # --- Loudness Graph Tab – EBU R128 Matching ===
 
995
  description="Apply custom EQ based on genre"
996
  )
997
 
 
 
 
 
 
 
 
 
998
  # --- Time-Stretch & BPM Match ===
999
  with gr.Tab("⏱ Time-Stretch & BPM Match"):
1000
  gr.Interface(
 
1005
  ],
1006
  outputs=gr.Audio(label="Stretched Output", type="filepath"),
1007
  title="Match Track to BPM",
1008
+ description="Stretch or shrink audio to match a specific tempo"
1009
  )
1010
 
1011
  # --- A/B Compare ===
 
1065
  ### Keyboard Controls
1066
  - `Ctrl + Z`: Undo last effect
1067
  - `Ctrl + Y`: Redo
1068
+ - `Spacebar`: Play/Stop playback
1069
  - `Ctrl + S`: Save current session
1070
  - `Ctrl + O`: Open session
1071
  - `Ctrl + C`: Copy effect chain
1072
  - `Ctrl + V`: Paste effect chain
1073
+ - `Ctrl + Shift + L`: Loop selection
1074
+ - `Ctrl + Shift + P`: Export PDF report
1075
+ - `Ctrl + Shift + M`: Export full mix ZIP
1076
  """)
1077
 
1078
  # --- Vocal Formant Correction – Now Defined! ===