def play(ctl): param = ctl.get("param") # lpd = ctl.get('midi').get('lpd') # pc = ctl.get('midi').get('pc') # pc.setOffset(111) # r = dsp.read('sounds/roll.wav').data r = dsp.read("sounds/pills.wav").data r = dsp.fill(r, dsp.stf(3)) # tr = pc.get(10, low=0.125, high=4) tr = dsp.rand(0.125, 4) r = dsp.transpose(r, dsp.rand(tr * 0.25, tr * 2)) # r = dsp.amp(r, pc.get(1, low=0, high=10)) r = dsp.amp(r, dsp.rand(0, 10)) reverse = dsp.randchoose([True, False]) # numgrains = pc.geti(2, low=5, high=20) numgrains = dsp.randint(5, 20) # numlayers = pc.geti(3, low=5, high=50) numlayers = dsp.randint(5, 50) # minlen = lpd.get(9, low=10, high=100) minlen = dsp.rand(10, 100) # lenranges = (lpd.get(9, low=10, high=50), lpd.get(9, low=50, high=500)) lenranges = (dsp.rand(10, 50), dsp.rand(50, 500)) out = fx.spider(r, numlayers, numgrains, minlen, lenranges, reverse) # out = dsp.mix([out, dsp.env(r, 'sine')]) return out
def play(ctl): param = ctl.get("param") pc = ctl.get("midi").get("pc") pc.setOffset(111) lpd = ctl.get("midi").get("lpd") amp = pc.get(7) snds = ["sounds/melodica.wav", "sounds/rhodes.wav", "sounds/chime.wav", "sounds/bell.wav", "sounds/lap.wav"] # snds = ['sounds/rhodes.wav'] m = dsp.read(dsp.randchoose(snds)).data m = dsp.transpose(m, 0.125) m = dsp.transpose(m, dsp.randchoose([1, 1.5, 2, 3]) * 2 ** dsp.randint(0, 3)) m = dsp.fill(m, dsp.stf(pc.get(15, low=0.125, high=2))) reverse = dsp.randchoose([True, False]) numlayers = dsp.randint(10, 20) numgrains = dsp.randint(pc.geti(8, low=3, high=10), pc.geti(8, low=10, high=20)) minlen = dsp.rand(10, 100) # lenranges = (dsp.rand(10, 20), dsp.rand(50, 1000)) lenranges = (pc.get(15, low=10, high=50), pc.get(15, low=50, high=500)) env = dsp.randchoose(["sine", "hann", "tri", "vary"]) # out = m out = fx.spider(m, numlayers, numgrains, minlen, lenranges, reverse) out = dsp.amp(out, amp) # out = dsp.env(out, 'sine') # out = dsp.alias(out) return out
num_grains = dsp.randint(500, 1000) grains = [] for i in range(num_grains): grain = dsp.cut(guitar, positions[ i % len(positions) ], lengths[ i % len(lengths) ]) grain = dsp.pan(grain, pans[ i % len(pans) ]) grain = dsp.amp(grain, amps[ i % len(amps) ]) grain = dsp.taper(grain, 20) grains += [ grain ] return ''.join(grains) wes = fx.spider(orc.wes.fetch()) intro = dsp.mix([ dsp.amp(makeGrains(), dsp.rand(0.01, 0.2)) for _ in range(dsp.randint(5, 10)) ]) intro = wes + dsp.env(intro, 'phasor') # Buildup ########## layers = [] nlayers = 3 length = dsp.stf(120) for _ in range(nlayers): frags = [] elapsed = 0
grains = [] for i in range(num_grains): grain = dsp.cut(guitar, positions[i % len(positions)], lengths[i % len(lengths)]) grain = dsp.pan(grain, pans[i % len(pans)]) grain = dsp.amp(grain, amps[i % len(amps)]) grain = dsp.taper(grain, 20) grains += [grain] return ''.join(grains) wes = fx.spider(orc.wes.fetch()) intro = dsp.mix([ dsp.amp(makeGrains(), dsp.rand(0.01, 0.2)) for _ in range(dsp.randint(5, 10)) ]) intro = wes + dsp.env(intro, 'phasor') # Buildup ########## layers = [] nlayers = 3 length = dsp.stf(120) for _ in range(nlayers):
track_page = requests.get(track_url) html = BeautifulSoup(track_page.text) track_url = html.find_all('a', class_='icn-arrow')[0].get('href') with open('%s.mp3' % track_id, 'wb') as track_data: r = requests.get(track_url) if r.ok: track_data.write(r.content) cmd = 'sox %s.mp3 %s.wav trim 0 5' % (track_id, track_id) p = subprocess.Popen(cmd, shell=True) p.wait() snd = dsp.read('%s.wav' % track_id).data tracks += [ dsp.amp(snd, 0.25) ] os.remove('%s.mp3' % track_id) os.remove('%s.wav' % track_id) foundtracks += 1 except Exception: pass out += dsp.mix([ fx.spider(track, dsp.randint(5, 20), dsp.randint(10, 50), dsp.rand(30, 50), (dsp.rand(5, 50), dsp.rand(200, 1500)), dsp.randchoose([True, False])) for track in tracks ]) dsp.write(out, 'fmape')