| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Two frequency shifters with optional cross-delay and feedback" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
This module implements two frequency shifters from which the output |
| 8 |
sound of both one can be fed back in the input of the other. Cross- |
| 9 |
feedback occurs after a user-defined delay of the output sounds. |
| 10 |
|
| 11 |
Sliders |
| 12 |
|
| 13 |
# Filter Freq : |
| 14 |
Cutoff or center frequency of the pre-filtering stage |
| 15 |
# Filter Q : |
| 16 |
Q factor of the pre-filtering stage |
| 17 |
# Frequency Shift 1 : |
| 18 |
Frequency shift, in Hz, of the first voice |
| 19 |
# Frequency Shift 2 : |
| 20 |
Frequency shift, in Hz, of the second voice |
| 21 |
# Feedback Delay : |
| 22 |
Delay time before the signal is fed back into the delay lines |
| 23 |
# Feedback : |
| 24 |
Amount of signal fed back into the delay lines |
| 25 |
# Feedback Gain : |
| 26 |
Amount of delayed signal cross-fed back into the frequency shifters. |
| 27 |
Signal from delay 1 into shifter 2 and signal from delay 2 into shifter 1. |
| 28 |
# Dry / Wet : |
| 29 |
Mix between the original signal and the shifted signals |
| 30 |
|
| 31 |
Graph Only |
| 32 |
|
| 33 |
# Overall Amplitude : |
| 34 |
The amplitude curve applied on the total duration of the performance |
| 35 |
|
| 36 |
Popups & Toggles |
| 37 |
|
| 38 |
# Filter Type : |
| 39 |
Type of filter |
| 40 |
# Balance : |
| 41 |
Compression mode. Off, balanced with a fixed signal |
| 42 |
or balanced with the input source. |
| 43 |
# Polyphony Voices : |
| 44 |
Number of voices played simultaneously (polyphony), |
| 45 |
only available at initialization time |
| 46 |
# Polyphony Spread : |
| 47 |
Pitch variation between voices (chorus), |
| 48 |
only available at initialization time |
| 49 |
|
| 50 |
""" |
| 51 |
def __init__(self): |
| 52 |
BaseModule.__init__(self) |
| 53 |
self.snd = self.addSampler("snd") |
| 54 |
self.biquad = Biquadx(self.snd, freq=self.filter, q=self.filterq, type=self.filttype_index, stages=2, mul=1) |
| 55 |
self.feed1 = Sig(0, add=self.biquad) |
| 56 |
self.feed2 = Sig(0, add=self.biquad) |
| 57 |
self.up1 = FreqShift(input=self.feed1, shift=self.shift1, mul=0.5) |
| 58 |
self.up2 = FreqShift(input=self.feed2, shift=self.shift2, mul=0.5) |
| 59 |
self.feeddelay1 = Delay(self.up1, delay=self.delay, feedback=self.feedback, mul=self.gain) |
| 60 |
self.feeddelay2 = Delay(self.up2, delay=self.delay, feedback=self.feedback, mul=self.gain) |
| 61 |
self.feed1.value = self.feeddelay2 |
| 62 |
self.feed2.value = self.feeddelay1 |
| 63 |
self.deg = Interp(self.snd, self.up1+self.up2, self.drywet, mul=self.env) |
| 64 |
|
| 65 |
self.osc = Sine(10000,mul=.1) |
| 66 |
self.balanced = Balance(self.deg, self.osc, freq=10) |
| 67 |
self.out = Interp(self.deg, self.balanced) |
| 68 |
|
| 69 |
#INIT |
| 70 |
self.balance(self.balance_index, self.balance_value) |
| 71 |
|
| 72 |
def filttype(self, index, value): |
| 73 |
self.biquad.type = index |
| 74 |
|
| 75 |
def balance(self,index,value): |
| 76 |
if index == 0: |
| 77 |
self.out.interp = 0 |
| 78 |
elif index ==1: |
| 79 |
self.out.interp = 1 |
| 80 |
self.balanced.input2 = self.osc |
| 81 |
elif index == 2: |
| 82 |
self.out.interp = 1 |
| 83 |
self.balanced.input2 = self.snd |
| 84 |
|
| 85 |
Interface = [ csampler(name="snd"), |
| 86 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"), |
| 87 |
cslider(name="filter", label="Filter Freq", min=30, max=20000, init=15000, rel="log", unit="Hz", col="green1",half=True), |
| 88 |
cslider(name="filterq", label="Filter Q", min=0.5, max=10, init=0.707, rel="log", unit="Q", col="green2",half=True), |
| 89 |
cslider(name="shift1", label="Frequency Shift 1", min=-2000, max=2000, init=500, rel="lin", unit="Hz", col="red1"), |
| 90 |
cslider(name="shift2", label="Frequency Shift 2", min=-2000, max=2000, init=100, rel="lin", unit="Hz", col="red2"), |
| 91 |
cslider(name="delay", label="Feedback Delay", min=0.001, max=1, init=.1, rel="lin", unit="sec", col="orange1"), |
| 92 |
cslider(name="feedback", label="Feedback", min=0, max=0.999, init=0.5, rel="lin", unit="x", col="orange2",half=True), |
| 93 |
cslider(name="gain", label="Feedback Gain", min=0, max=1, init=0, rel="lin", unit="x", col="orange3",half=True), |
| 94 |
cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"), |
| 95 |
cpopup(name="filttype", label="Filter Type", init="Lowpass", col="green1", value=["Lowpass","Highpass","Bandpass","Bandstop"]), |
| 96 |
cpopup(name="balance", label = "Balance", init= "Off", col="blue1", value=["Off","Compress", "Source"]), |
| 97 |
cpoly() |
| 98 |
] |