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