Spaces:
Sleeping
Sleeping
updated UI
Browse files
app.py
CHANGED
@@ -8,25 +8,30 @@ from audio_utils import play_audio
|
|
8 |
from fx import get_fx
|
9 |
|
10 |
# Streamlit UI
|
11 |
-
st.title("
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
if st.toggle("Use a different prompt for audio effects?"):
|
19 |
-
fx_prompt = st.text_input("Describe your desired FX tone:", "soft and ethereal telephone")
|
20 |
-
else:
|
21 |
-
fx_prompt = prompt
|
22 |
-
|
23 |
-
# Run the inference
|
24 |
-
if st.button("Generate Drum Kit"):
|
25 |
-
drum_kit = generate_drum_kit(prompt, kit_size)
|
26 |
if use_fx:
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
# Display results
|
32 |
if "drum_kit" in st.session_state:
|
@@ -40,4 +45,11 @@ if "drum_kit" in st.session_state:
|
|
40 |
for i, sound_file in enumerate(sounds):
|
41 |
with cols[i]:
|
42 |
if st.button(f"▶️ {os.path.basename(sound_file)}", key=sound_file):
|
43 |
-
play_audio(sound_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
from fx import get_fx
|
9 |
|
10 |
# Streamlit UI
|
11 |
+
st.title("text2kit")
|
12 |
+
st.subheader("generate drum kits and audio effects with text prompts")
|
13 |
+
st.write("uses publicly available samples from [freesound](https://zenodo.org/records/4687854) and [CLAP embeddings](https://github.com/LAION-AI/CLAP) for text-based querying")
|
14 |
+
st.write("hint: turn audio effects on! try weird prompts!")
|
15 |
|
16 |
+
with st.container(border=True):
|
17 |
+
# User Inputs
|
18 |
+
prompt = st.text_input("Describe your drum kit:", "warm vintage acoustic")
|
19 |
+
kit_size = st.slider("Number of sounds per instrument:", 1, 10, 4)
|
20 |
+
use_fx = st.toggle("Apply audio effects?", value=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if use_fx:
|
22 |
+
if st.toggle("Use a different prompt for audio effects?", value=True):
|
23 |
+
fx_prompt = st.text_input("Describe your desired FX tone:", "soft and ethereal space")
|
24 |
+
else:
|
25 |
+
fx_prompt = prompt
|
26 |
+
|
27 |
+
# Run the inference
|
28 |
+
if st.button("Generate Drum Kit"):
|
29 |
+
drum_kit = generate_drum_kit(prompt, kit_size)
|
30 |
+
st.session_state["dry_kit"] = drum_kit
|
31 |
+
if use_fx:
|
32 |
+
drum_kit, fx_params = get_fx(drum_kit, fx_prompt)
|
33 |
+
st.session_state["fx_params"] = fx_params
|
34 |
+
st.session_state["drum_kit"] = drum_kit # Store results
|
35 |
|
36 |
# Display results
|
37 |
if "drum_kit" in st.session_state:
|
|
|
45 |
for i, sound_file in enumerate(sounds):
|
46 |
with cols[i]:
|
47 |
if st.button(f"▶️ {os.path.basename(sound_file)}", key=sound_file):
|
48 |
+
play_audio(sound_file)
|
49 |
+
|
50 |
+
if st.toggle("Show parameters?"):
|
51 |
+
if "fx_params" in st.session_state:
|
52 |
+
st.subheader("FX Parameters")
|
53 |
+
st.write(st.session_state["fx_params"])
|
54 |
+
if "dry_kit" in st.session_state:
|
55 |
+
st.write(st.session_state["dry_kit"])
|
fx.py
CHANGED
@@ -87,7 +87,7 @@ search_space = [
|
|
87 |
Real(5000, 15000, name="lowpass"),
|
88 |
Real(50, 1000, name="highpass"),
|
89 |
Real(0.0, 0.8, name="reverb_size"),
|
90 |
-
Real(0.0, 0
|
91 |
Real(0.0, 20.0, name="drive_db"),
|
92 |
Real(6.0, 32.0, name="bit_depth")
|
93 |
]
|
|
|
87 |
Real(5000, 15000, name="lowpass"),
|
88 |
Real(50, 1000, name="highpass"),
|
89 |
Real(0.0, 0.8, name="reverb_size"),
|
90 |
+
Real(0.0, 1.0, name="reverb_wet"),
|
91 |
Real(0.0, 20.0, name="drive_db"),
|
92 |
Real(6.0, 32.0, name="bit_depth")
|
93 |
]
|