Spaces:
Runtime error
Runtime error
File size: 1,279 Bytes
bfe0bce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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)
|