Spaces:
Running
Running
UPDATE
Browse files
app.py
CHANGED
@@ -3,50 +3,46 @@ import gradio as gr
|
|
3 |
from AudioFusion import Fusion
|
4 |
|
5 |
def process_audio(input_file,
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
):
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
# output_file = secrets.token_hex(5)
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
# # Save the processed sound and return the output file
|
25 |
-
# output = Fusion.saveSound(sound, output_file, effect_reverb, "temp"+output_file+".wav")
|
26 |
-
return input_file
|
27 |
|
28 |
-
except Fusion.InvalidMusicFileError as e:
|
29 |
-
return str(e)
|
30 |
-
except Exception as e:
|
31 |
-
return f"An error occurred: {str(e)}"
|
32 |
|
33 |
iface = gr.Interface(
|
34 |
fn=process_audio,
|
35 |
inputs=[
|
36 |
gr.Audio(label="Upload your music file"),
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
],
|
51 |
outputs=gr.Audio(label="Download processed music"),
|
52 |
title="Audio Fusion"
|
|
|
3 |
from AudioFusion import Fusion
|
4 |
|
5 |
def process_audio(input_file,
|
6 |
+
effect_8d, effect_slowed, effect_reverb,
|
7 |
+
pan_boundary, jump_percentage, time_l_to_r, volume_multiplier,
|
8 |
+
speed_multiplier,
|
9 |
+
room_size, damping, width, wet_level, dry_level
|
10 |
):
|
11 |
+
# Load the sound file
|
12 |
+
sound = Fusion.loadSound(input_file)
|
13 |
+
output_file = secrets.token_hex(5)
|
|
|
14 |
|
15 |
+
# Apply effects based on user choices
|
16 |
+
if effect_8d:
|
17 |
+
sound = Fusion.effect8D(sound, pan_boundary, jump_percentage, time_l_to_r, volume_multiplier)
|
18 |
+
if effect_slowed:
|
19 |
+
sound = Fusion.effectSlowed(sound, speed_multiplier)
|
20 |
+
if effect_reverb:
|
21 |
+
sound = Fusion.effectReverb(sound, room_size, damping, width, wet_level, dry_level, "temp"+output_file+".wav")
|
22 |
+
|
23 |
+
# Save the processed sound and return the output file
|
24 |
+
output = Fusion.saveSound(sound, output_file, effect_reverb, "temp"+output_file+".wav")
|
25 |
+
return output
|
26 |
|
|
|
|
|
|
|
27 |
|
|
|
|
|
|
|
|
|
28 |
|
29 |
iface = gr.Interface(
|
30 |
fn=process_audio,
|
31 |
inputs=[
|
32 |
gr.Audio(label="Upload your music file"),
|
33 |
+
gr.Checkbox(label="Apply 8D effect"),
|
34 |
+
gr.Slider(label="8D - Pan Boundary", minimum=0, maximum=100, value=50),
|
35 |
+
gr.Slider(label="8D - Jump Percentage", minimum=1, maximum=100, value=5),
|
36 |
+
gr.Slider(label="8D - Time L to R (ms)", minimum=1, value=10000),
|
37 |
+
gr.Checkbox(label="Apply slowed effect"),
|
38 |
+
gr.Slider(label="8D - Volume Multiplier", minimum=1, value=6),
|
39 |
+
gr.Slider(label="Slowed - Speed Multiplier", minimum=0.1, maximum=2, step=0.1, value=0.92),
|
40 |
+
gr.Checkbox(label="Apply reverb effect"),
|
41 |
+
gr.Slider(label="Reverb - Room Size", minimum=0, maximum=1, step=0.1, value=0.8),
|
42 |
+
gr.Slider(label="Reverb - Damping", minimum=0, maximum=10, value=1),
|
43 |
+
gr.Slider(label="Reverb - Width", minimum=0, maximum=1, step=0.1, value=0.5),
|
44 |
+
gr.Slider(label="Reverb - Wet Level", minimum=0, maximum=1, step=0.1, value=0.3),
|
45 |
+
gr.Slider(label="Reverb - Dry Level", minimum=0, maximum=1, step=0.1, value=0.8),
|
46 |
],
|
47 |
outputs=gr.Audio(label="Download processed music"),
|
48 |
title="Audio Fusion"
|