def play(voice_id): tel = bot.getTel() b = dsp.read('sounds/birds.wav').data b = dsp.split(b, dsp.randint(100, 1000)) b = b[:dsp.randint(len(b) / 10, len(b))] blen = len(b) pans = dsp.breakpoint([ dsp.rand() for i in range(dsp.randint(10, 100)) ], blen) speeds = dsp.breakpoint([ dsp.rand(0.25, 1.5) for i in range(dsp.randint(10, 100)) ], blen) amps = dsp.breakpoint([ dsp.rand(0.05, 1.5) for i in range(dsp.randint(10, 100)) ], blen) b = [ dsp.pan(b[i], pans[i]) for i in range(blen) ] b = [ dsp.transpose(b[i], speeds[i]) for i in range(blen) ] b = [ dsp.amp(b[i], amps[i]) for i in range(blen) ] b = dsp.packet_shuffle(b, dsp.randint(4, 30)) for i, bb in enumerate(b): if dsp.rand(0, 100) > 60: b[i] = bb * dsp.randint(2, 10) out = ''.join(b) dsp.log('') dsp.log('birds') dsp.log(blen) dsp.log('%s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out)))) bot.show_telemetry(tel) return out
def makecurve(length): # freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, amp wf = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for i in range(int(dsp.rand(5, 30))) ] + [0], 1024) win = dsp.breakpoint([0] + [ dsp.rand(0, 1) for i in range(4) ] + [0], 1024) mod = dsp.breakpoint([ dsp.rand(0, 1) for i in range(int(dsp.rand(4, 8))) ], 1024) smaxamp = dsp.rand(0.65, 0.95) amp = dsp.rand(0.01, smaxamp) pw = dsp.rand(0.1, 1.0) if 'upbeat' in tel['name']: wf = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for i in range(int(dsp.rand(5, 30))) ] + [0], 1024) win = dsp.breakpoint([0] + [ dsp.rand(0, 1) for i in range(4) ] + [0], 1024) mod = dsp.breakpoint([ dsp.rand(0, 1) for i in range(int(dsp.rand(5, 80))) ], 1024) pw = 1.0 if 'ballsout' in tel['name']: wf = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for i in range(int(dsp.rand(10, 40))) ] + [0], 1024) win = dsp.breakpoint([0] + [ dsp.rand(0, 1) for i in range(10) ] + [0], 1024) mod = dsp.breakpoint([ dsp.rand(0, 1) for i in range(int(dsp.rand(20, 100))) ], 1024) if 'sparse' in tel['name']: amp = dsp.rand(0.7, 3) freq = tel['register'] * tel['roughness'] * (tel['density'] * tel['pace'] * 0.25) #if dsp.rand(0, 100) > 50: #freq = dsp.rand(2, 20) modR = tel['harmonicity'] modF= tel['pace'] / 10.0 c = dsp.pulsar(freq, length, pw, wf, win, mod, modR, modF, amp) ngrains = len(c) pans = dsp.breakpoint([ dsp.rand(0,1) for i in range(100) ], ngrains) maxPad = dsp.randint(2000, 4000) if 'sparse' in tel['name']: c = dsp.vsplit(c, dsp.mstf(0.5), dsp.mstf(tel['density'] * tel['harmonicity'] * tel['roughness'] * tel['pace'])) c = [ dsp.randchoose(c) for i in range(int(dsp.rand(3, 10))) ] elif 'ballsout' in tel['name']: c = dsp.vsplit(c, dsp.mstf(0.1), dsp.mstf(400)) c = dsp.packet_shuffle(c, dsp.randint(5, 10)) speeds = dsp.breakpoint([ dsp.rand(tel['register'] * 0.1 + 0.2, tel['register'] + 0.2) for i in range(100) ], ngrains) #c = [ dsp.transpose(cg, speeds[i]) for i, cg in enumerate(c) ] #c = [ dsp.amp(cg, dsp.rand(0.25, 1.25)) for i, cg in enumerate(c) ] for ic, cc in enumerate(c): if dsp.rand(0, 100) > 70: c[ic] = dsp.tone(dsp.flen(cc), 11000, amp=0.5) elif 'upbeat' in tel['name']: beat = dsp.bpm2frames(bpm) c = dsp.split(c, beat) maxPad = 0 c = [ dsp.pad(cg, 0, dsp.mstf(dsp.rand(10, beat / 4))) for i, cg in enumerate(c) ] else: c = dsp.vsplit(c, dsp.mstf(10), dsp.mstf(tel['density'] * tel['harmonicity'] * tel['roughness'] * tel['pace'] * dsp.rand(1, 10))) c = [ dsp.pan(cg, pans[i]) for i, cg in enumerate(c) ] c = [ dsp.env(cg, 'sine') for i, cg in enumerate(c) ] if 'sparse' in tel['name'] or 'ballsout' in tel['name']: speeds = dsp.breakpoint([ dsp.rand(0.5, 1.99) for i in range(100) ], ngrains) for ic, cc in enumerate(c): if dsp.flen(cc) < dsp.mstf(100): c[ic] = cc + ''.join([ dsp.amp(cc, dsp.rand(0.1, 1.0)) for buh in range(dsp.randint(1, int(tel['density']))) ]) #c = [ dsp.transpose(cg, speeds[i]) for i, cg in enumerate(c) ] c = [ dsp.pan(cg, dsp.rand(0.0, 1.0)) for i, cg in enumerate(c) ] if 'ballsout' not in tel['name']: c = [ dsp.pad(cg, 0, dsp.mstf(dsp.rand(10, maxPad))) for i, cg in enumerate(c) ] out = ''.join(c) return out
from pippi import dsp snd = dsp.read('sounds/seneca3bars.wav').data snd = dsp.split(snd, 0, 1) snd = dsp.packet_shuffle(snd, 3) snd = [s * dsp.randint(1, 10) for s in snd] out = ''.join(snd) dsp.write(out, 'seero')