def bitcrusher(sound, start, end): def process(nbits): y = bitcrush(sound.frames[start:end], nbits) sound.paste(start, end, y) def callback(parameters): nbits = parameters["Bit Width"] global nbits_last nbits_last = nbits process(nbits) d = EffectDialog("BitCrusher") global nbits_last d.add_slider("Bit Width", nbits_last, 2, 12) d.callback = callback return d
def bitcrusher(sound, start, end): def process(nbits): y = bitcrush(sound.frames[start:end], nbits) sound.paste(start, end, y) def callback(parameters): nbits = parameters['Bit Width'] global nbits_last nbits_last = nbits process(nbits) d = EffectDialog('BitCrusher') global nbits_last d.add_slider('Bit Width', nbits_last, 2, 12) d.callback = callback return d
def volume(sound, start, end): def process(volume): gain = volume / 100. x = sound.frames[start:end] y = x * gain sound.paste(start, end, y) def callback(parameters): global volume_last volume = parameters['Volume'] volume_last = volume process(volume) global volume_last d = EffectDialog('Volume') d.add_slider('Volume', volume_last, 0, 200, 0) d.callback = callback return d
def svf_fx(type, sound, start, end): def process(freq, damp): def apply(channel): filtered = svf(channel, freq, damp, sound.samplerate) i = svf_index[type] return filtered[i] y = process_each_channel(apply, sound.frames[start:end]) sound.paste(start, end, y) def callback(parameters): freq = parameters['Frequency'] damp = parameters['Damping'] process(freq, damp) d = EffectDialog(type + ' State Variable Filter') d.add_slider('Frequency', 500, 0, 5000) d.add_slider('Damping', 0.5, 0.01, 3, 1) d.callback = callback return d