def makePaper(out): tail = dsp.cut(paper, dsp.mstf(60), dsp.flen(out) - dsp.mstf(60)) tail = [ dsp.transpose(tail, dsp.rand(0.95, 1.05)) for _ in range(dsp.randint(3,6)) ] tail = [ fx.penv(t) for t in tail ] out = dsp.mix(tail + [ out ]) return out
def make(length, i): #h = dsp.bln(length / 4, dsp.rand(6000, 8000), dsp.rand(9000, 16000)) #h = dsp.amp(h, dsp.rand(0.5, 1)) #h = dsp.env(h, 'phasor') h = hat h = dsp.fill(h, length, silence=True) if dsp.rand() > 0.5: h = fx.penv(h) return h
def makeRhodes(length, beat, freqs, maxbend=0.05): backup = Sampler(snds.load('tones/nycrhodes01.wav'), tune.ntf('c'), direction='fw-bw-loop', tails=False) chord = [ keys.rhodes(length, freq, dsp.rand(0.4, 0.7)) for freq in freqs ] chord = dsp.randshuffle(chord) chord = [ dsp.mix([ dsp.env(fx.penv(backup.play(freq * 2**dsp.randint(0,2), length, dsp.rand(0.4, 0.6))), 'line'), c ]) for freq, c in zip(freqs, chord) ] pause = 0 for i, c in enumerate(chord): pause = pause + (dsp.randint(1, 4) * beat) c = dsp.pan(c, dsp.rand()) c = fx.bend(c, [ dsp.rand() for _ in range(dsp.randint(5, 10)) ], dsp.rand(0, maxbend)) chord[i] = dsp.pad(dsp.fill(c, length - pause), pause, 0) return dsp.mix(chord)
def makeLong(seg): g = dsp.randchoose(guitars) g = dsp.amp(g, 0.4) long_guitar = dsp.fill(g, sum(seg)) fade_guitar = dsp.randchoose(guitars) fade_guitar = dsp.amp(fade_guitar, dsp.rand(0.1, 0.3)) fade_guitar = fx.penv(fade_guitar) fade_guitar = dsp.fill(fade_guitar, sum(seg)) out = dsp.mix([ long_guitar, fade_guitar ]) return out
def makeLong(seg): g = dsp.randchoose(guitars) g = dsp.amp(g, 0.4) long_guitar = dsp.fill(g, sum(seg)) fade_guitar = dsp.randchoose(guitars) fade_guitar = dsp.amp(fade_guitar, dsp.rand(0.1, 0.3)) fade_guitar = fx.penv(fade_guitar) fade_guitar = dsp.fill(fade_guitar, sum(seg)) out = dsp.mix([long_guitar, fade_guitar]) return out
def makeArps(length, beat, cname): freqs = tune.chord(cname, key, dsp.randint(1,4)) tone = Sampler(snds.load('tones/nick.wav'), direction='fw-bw-loop', tails=False) freqs = dsp.randshuffle(freqs) beat = int((beat * 2) / dsp.randchoose([0.5, 1, 2, 3, 1.5])) numbeats = length / beat out = '' for i in range(numbeats): out += tone.play(freqs[i % len(freqs)], beat) out = dsp.fill(out, length) out = fx.penv(out) return out
frags += [ g ] # concat all frags layer = ''.join(frags) # add frags to layers layers += [ layer ] # mix down frag layers out = dsp.mix(layers) # Add sine buildup sines = [] lowfreq = tune.ntf('g', octave=2) sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq, amp=0.4) ] sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.067, amp=0.4) ] sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.667, amp=0.25) ] sines = [ dsp.mix([ fx.penv(s), s ]) for s in sines ] sines = dsp.mix(sines) sines = dsp.env(sines, 'line') sines = dsp.pad(sines, dsp.flen(out) - dsp.flen(sines), 0) out = dsp.mix([ intro, out, sines ]) dsp.write(out, '01-friction_i')
elif dsp.rand() > 0.75: dl[i] = dsp.split(b, dsp.flen(b) / 2)[0] * 2 dl[i] = dsp.amp(dl[i], dsp.rand(0.9, 2)) dl[i] = dsp.fill(dl[i], beat, silence=True) dl = ''.join(dl) layers += [ dl ] if canPlay('swells', section): octave = 1 if section == 'float' else dsp.randint(2, 3) sdivs = [ dsp.randint(2, 8) for _ in range(dsp.randint(2, 4)) ] swells = dsp.mix([ makeSwells(cname, nswell, bar_length, key, octave) for nswell in sdivs ]) if section not in ('float', 'ending'): swells = fx.penv(swells) swells = dsp.env(swells, 'random') layers += [ swells ] if canPlay('rushes', section): rushes = [ drums.roll(dsp.randchoose([paper, smash, snare, rimshot, kickhard]), bar_length, dsp.randint(1, 3)) for _ in range(3) ] layers += [ dsp.amp(dsp.mix(rushes), 0.5)] if canPlay('snares', section): snarep = '....x...' if elapsed > dsp.stf(90) and dsp.rand() > 0.75: snarep = '....xx..' if elapsed > dsp.stf(120) and dsp.rand() > 0.75: snarep = '..x..x..x'
frags += [g] # concat all frags layer = ''.join(frags) # add frags to layers layers += [layer] # mix down frag layers out = dsp.mix(layers) # Add sine buildup sines = [] lowfreq = tune.ntf('g', octave=2) sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq, amp=0.4)] sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.067, amp=0.4)] sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.667, amp=0.25)] sines = [dsp.mix([fx.penv(s), s]) for s in sines] sines = dsp.mix(sines) sines = dsp.env(sines, 'line') sines = dsp.pad(sines, dsp.flen(out) - dsp.flen(sines), 0) out = dsp.mix([intro, out, sines]) dsp.write(out, '01-friction_i')
layers = [] numlayers = dsp.randint(4, dsp.randint(10, 250)) for _ in range(numlayers): freq = dsp.rand(0.1, 5000) length = dsp.stf(slen) pulsewidth = dsp.rand(0.15, 1) waveform = [0] + dsp.breakpoint([ dsp.rand(-1, 1) for _ in range(dsp.randint(6, dsp.randint(10, 300))) ], 512) + [0] window = dsp.wavetable(dsp.randchoose(['tri', 'hann', 'sine']), 512) mod = dsp.breakpoint([ dsp.rand() for _ in range(dsp.randint(5, 2000)) ], 1024*4) modrange = dsp.rand(0.01, 10) modfreq = 1.0 / slen amp = dsp.rand(0.05, 0.25) layer = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modrange, modfreq, amp) layer = fx.penv(layer) bits = [] layer = dsp.vsplit(layer, dsp.mstf(1), dsp.stf(0.2)) for bit in layer: if dsp.rand() > 0.75: bit = ''.join([ dsp.pan(dsp.amp(bit, dsp.rand(0.1, 10)), dsp.rand()) for _ in range(dsp.randint(2, 10)) ]) bits += [ bit ] layer = ''.join(bits) layers += [ layer ]
freq = dsp.rand(0.1, 5000) length = dsp.stf(slen) pulsewidth = dsp.rand(0.15, 1) waveform = [0] + dsp.breakpoint( [dsp.rand(-1, 1) for _ in range(dsp.randint(6, dsp.randint(10, 300)))], 512) + [0] window = dsp.wavetable(dsp.randchoose(['tri', 'hann', 'sine']), 512) mod = dsp.breakpoint([dsp.rand() for _ in range(dsp.randint(5, 2000))], 1024 * 4) modrange = dsp.rand(0.01, 10) modfreq = 1.0 / slen amp = dsp.rand(0.05, 0.25) layer = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modrange, modfreq, amp) layer = fx.penv(layer) bits = [] layer = dsp.vsplit(layer, dsp.mstf(1), dsp.stf(0.2)) for bit in layer: if dsp.rand() > 0.75: bit = ''.join([ dsp.pan(dsp.amp(bit, dsp.rand(0.1, 10)), dsp.rand()) for _ in range(dsp.randint(2, 10)) ]) bits += [bit] layer = ''.join(bits)