Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
4d01fa5
1
Parent(s):
d24f07f
Update app.py
Browse files
app.py
CHANGED
@@ -3,14 +3,21 @@ import gradio as gr
|
|
3 |
import pedalboard
|
4 |
import soundfile as sf
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
def inference(audio):
|
7 |
y, sr = librosa.load(audio.name, sr=44100)
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
with sf.SoundFile('./processed-output-stereo.wav', 'w', samplerate=sr, channels=len(effected.shape)) as f:
|
15 |
f.write(effected)
|
16 |
return './processed-output-stereo.wav'
|
@@ -26,4 +33,4 @@ article = "<p style='text-align: center'><a href='https://engineering.atspotify.
|
|
26 |
|
27 |
examples = [['sample.wav']]
|
28 |
|
29 |
-
gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples).launch(debug=True)
|
|
|
3 |
import pedalboard
|
4 |
import soundfile as sf
|
5 |
|
6 |
+
from pedalboard import Compressor, Gain, Phaser, Reverb
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
def inference(audio):
|
12 |
y, sr = librosa.load(audio.name, sr=44100)
|
13 |
+
board = pedalboard.Pedalboard([
|
14 |
+
Compressor(ratio=10, threshold_db=-20),
|
15 |
+
Gain(gain_db=20),
|
16 |
+
Phaser(),
|
17 |
+
Reverb()
|
18 |
+
], sample_rate=sr)
|
19 |
+
|
20 |
+
effected = board.process(y)
|
21 |
with sf.SoundFile('./processed-output-stereo.wav', 'w', samplerate=sr, channels=len(effected.shape)) as f:
|
22 |
f.write(effected)
|
23 |
return './processed-output-stereo.wav'
|
|
|
33 |
|
34 |
examples = [['sample.wav']]
|
35 |
|
36 |
+
gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples, enable_queue=True).launch(debug=True)
|