import numpy as np import io import soundfile as sf import streamlit as st from audio_recorder_streamlit import audio_recorder import pedalboard as pb st.title("👹 Voice Refuckulator") audio_bytes = audio_recorder() board = pb.Pedalboard([pb.Reverb(room_size=0.100), pb.Gain(-10)]) if audio_bytes: # data must be transposed, maybe before processing? wave, sr = sf.read(io.BytesIO(audio_bytes)) effected = board(wave, sr, reset=False) cols = st.columns(5) stretch_factor = cols[0].slider("🧌 Trollizer", 1, 32, 16) chunk_factor = cols[1].slider("🕋 Chunkinator", 1, 16, 8) chunk_dividend = cols[2].slider("🫀 Dechunkizer", 1, 32, 16) shuffle = cols[3].slider("🤡 Impredictidiblize", 1, 32, 16) sr_factor = cols[4].slider("🏃‍♀️ Chirpidize", 1, 16, 8) stretched = [] for chunk in np.array_split(effected, chunk_dividend): for i in range(chunk_factor): if i % shuffle == 0: for c in chunk: for _ in range(stretch_factor): stretched.append(c) else: for c in chunk: stretched.append(c) stretched = np.array(stretched) st.audio(stretched.T, sample_rate=sr*sr_factor)