4
Apply spectral delays on a sound.
11
snd = "../snds/ounkmaster.aif"
12
chnls = sndinfo(snd)[3]
15
num = olaps*chnls # number of streams for ffts
17
src = SfPlayer(snd, loop=True, mul=.15)
18
delsrc = Delay(src, delay=size/s.getSamplingRate()*2).out()
20
# duplicates bin regions and delays to match the number of channels * overlaps
21
def duplicate(li, num):
22
tmp = [x for x in li for i in range(num)]
25
binmin = duplicate([3,10,20,27,55,100], num)
26
binmax = duplicate([5,15,30,40,80,145], num)
27
delays = duplicate([80,20,40,100,60,120], num)
28
# delays conversion : number of frames -> seconds
29
for i in range(len(delays)):
30
delays[i] = delays[i] * (size/2) / s.getSamplingRate()
32
fin = FFT(src*1.25, size=size, overlaps=olaps)
34
# splits regions between `binmins` and `binmaxs` with time variation
35
lfo = Sine(.1, mul=.65, add=1.35)
36
bins = Between(fin["bin"], min=binmin, max=binmax*lfo)
37
swre = fin["real"] * bins; swim = fin["imag"] * bins
38
# apply delays with mix to match `num` audio streams
39
delre = Delay(swre, delay=delays, feedback=.7, maxdelay=2).mix(num)
40
delim = Delay(swim, delay=delays, feedback=.7, maxdelay=2).mix(num)
42
fout = IFFT(delre, delim, size=size, overlaps=olaps).mix(chnls).out()