def play(ctl): freqs = tune.fromdegrees([1,3,6,8,9], octave=4, root='a') freq = dsp.randchoose(freqs) length = dsp.stf(dsp.rand(3, 5)) out = keys.rhodes(length, freq) return out
def makeRhodes(length, beat, freqs): root = tune.ntf(key, 2) for i, freq in enumerate(freqs): if freq > root * 2.5: freqs[i] = freq * 0.5 chord = [ keys.rhodes(length, freq, dsp.rand(0.4, 0.6)) for freq in freqs ] chord = dsp.randshuffle(chord) pause = 0 for i, c in enumerate(chord): pause = pause + (dsp.randint(1, 4) * beat) c = dsp.pan(c, dsp.rand()) chord[i] = dsp.pad(dsp.fill(c, length - pause), pause, 0) chord = dsp.mix(chord) chord = dsp.split(chord, dsp.flen(chord) / 16) chord = dsp.randshuffle(chord) chord = [ dsp.env(ch, 'phasor') for ch in chord ] chord = [ dsp.mix([ dsp.amp(dsp.pan(grain, dsp.rand()), dsp.rand(0.1, 0.8)), dsp.amp(dsp.pan(dsp.randchoose(chord), dsp.rand()), dsp.rand(0.1, 0.8)) ]) for grain in chord ] chord = ''.join(chord) return chord
def play(ctl): freq = tune.ntf(dsp.randchoose(['eb']), octave=dsp.randint(0,2)) synth = keys.rhodes(dsp.stf(4), freq) s = dsp.vsplit(synth, dsp.mstf(50), dsp.mstf(2000)) s = dsp.randshuffle(s) #s = [ dsp.alias(ss) for ss in s ] s = [ dsp.amp(ss, dsp.rand(0.5, 0.75)) for ss in s ] s = [ dsp.pan(ss, dsp.rand(0, 1)) for ss in s ] s = ''.join(s) s = dsp.fill(s, dsp.flen(synth)) s2 = dsp.vsplit(synth, dsp.mstf(150), dsp.mstf(1500)) s2 = dsp.randshuffle(s2) s2 = [ dsp.transpose(ss, dsp.randchoose([1,1.5,2,3,4,8])) for ss in s2 ] s2 = [ dsp.env(ss, 'phasor') for ss in s2 ] s2 = ''.join(s2) out = dsp.mix([ s, s2 ]) out = dsp.amp(out, 1.5) out = dsp.transpose(out, 1.01) #synth = dsp.fill(synth, dsp.flen(main)) #out = synth return out
def makeRhodes(length, beat, freqs): root = tune.ntf(key, 2) for i, freq in enumerate(freqs): if freq > root * 2.5: freqs[i] = freq * 0.5 chord = [keys.rhodes(length, freq, dsp.rand(0.4, 0.6)) for freq in freqs] chord = dsp.randshuffle(chord) pause = 0 for i, c in enumerate(chord): pause = pause + (dsp.randint(1, 4) * beat) c = dsp.pan(c, dsp.rand()) chord[i] = dsp.pad(dsp.fill(c, length - pause), pause, 0) chord = dsp.mix(chord) chord = dsp.split(chord, dsp.flen(chord) / 16) chord = dsp.randshuffle(chord) chord = [dsp.env(ch, "phasor") for ch in chord] chord = [ dsp.mix( [ dsp.amp(dsp.pan(grain, dsp.rand()), dsp.rand(0.1, 0.8)), dsp.amp(dsp.pan(dsp.randchoose(chord), dsp.rand()), dsp.rand(0.1, 0.8)), ] ) for grain in chord ] chord = "".join(chord) return chord
def chord(length, freqs, amp): layers = [ keys.rhodes(length, freq, amp * dsp.rand(0.25, 0.5)) for freq in freqs ] layers = [dsp.pan(layer, dsp.rand()) for layer in layers] return dsp.mix(layers)
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 play(voice_id): bpm = config('bpm') root = config('key') quality = getattr(tune, config('quality')) ratios = getattr(tune, config('tune')) beat = dsp.bpm2frames(bpm) amp = dsp.rand(0.1, 0.65) nlens = [ beat * 4, beat * 3, beat * 2, beat + (beat / 2), beat, beat / 2, beat / 4, ] scale = [2,4,6,9] scale = [1,4,6,8] # scale = [1,3,4,5,6,8,9] # scale = [1,2,3,5,6,8,9] # scale = [1,5,8] freqs = tune.fromdegrees(scale, root=root, octave=dsp.randint(2,4), ratios=ratios, scale=quality) # length of pattern (in beats) elen = 0 tlen = beat * dsp.randint(2, 8) # beat lengths (from a set of bpm-derived note lengths defined in the nlens list) blens = [] while elen < tlen: l = dsp.randchoose(nlens) blens += [ l ] elen += l # beat pulsewidths bpws = [ dsp.rand(0.1, 1) for pw in range(len(blens)) ] out = '' # choose a pitch from the scale freq = dsp.randchoose(freqs) # synthesize the tones for i in range(len(blens)): # find the length of the pulse blen = int(round(blens[i] * bpws[i])) # find the length of the rest brest = blens[i] - blen # make a rhodes tone with a random amplitude #beat = keys.rhodes(length=blen, freq=freq, amp=dsp.rand(0.3, 0.5)) beat = keys.rhodes(length=blen, freq=freq, amp=amp) # pan the tone to a random position beat = dsp.pan(beat, dsp.rand()) # bitcrush the tone a random amount # beat = dsp.alias(beat) # pad the tone with silence beat = dsp.pad(beat, 0, brest) # add it to the output out += beat out *= dsp.randint(1, 2) if dsp.rand() > 0.75: out = dsp.split(out, dsp.bpm2frames(bpm) / dsp.randchoose([1,2,4])) out = dsp.randshuffle(out) out = ''.join(out) return out
def rhodesChord(length, chord, amp): layers = [ keys.rhodes(length, freq, amp * dsp.rand(0.25, 0.5)) for freq in chord ] layers = [ dsp.pan(layer, dsp.rand()) for layer in layers ] return dsp.mix(layers)
def play(voice_id): bpm = config('bpm') root = config('key') quality = getattr(tune, config('quality')) ratios = getattr(tune, config('tune')) beat = dsp.bpm2frames(bpm) amp = dsp.rand(0.1, 0.65) nlens = [ beat * 4, beat * 3, beat * 2, beat + (beat / 2), beat, beat / 2, beat / 4, ] scale = [2, 4, 6, 9] scale = [1, 4, 6, 8] # scale = [1,3,4,5,6,8,9] # scale = [1,2,3,5,6,8,9] # scale = [1,5,8] freqs = tune.fromdegrees(scale, root=root, octave=dsp.randint(2, 4), ratios=ratios, scale=quality) # length of pattern (in beats) elen = 0 tlen = beat * dsp.randint(2, 8) # beat lengths (from a set of bpm-derived note lengths defined in the nlens list) blens = [] while elen < tlen: l = dsp.randchoose(nlens) blens += [l] elen += l # beat pulsewidths bpws = [dsp.rand(0.1, 1) for pw in range(len(blens))] out = '' # choose a pitch from the scale freq = dsp.randchoose(freqs) # synthesize the tones for i in range(len(blens)): # find the length of the pulse blen = int(round(blens[i] * bpws[i])) # find the length of the rest brest = blens[i] - blen # make a rhodes tone with a random amplitude #beat = keys.rhodes(length=blen, freq=freq, amp=dsp.rand(0.3, 0.5)) beat = keys.rhodes(length=blen, freq=freq, amp=amp) # pan the tone to a random position beat = dsp.pan(beat, dsp.rand()) # bitcrush the tone a random amount # beat = dsp.alias(beat) # pad the tone with silence beat = dsp.pad(beat, 0, brest) # add it to the output out += beat out *= dsp.randint(1, 2) if dsp.rand() > 0.75: out = dsp.split(out, dsp.bpm2frames(bpm) / dsp.randchoose([1, 2, 4])) out = dsp.randshuffle(out) out = ''.join(out) return out
return s commontone = dsp.randchoose(tune.fromdegrees(chord, octave=1, root='c')) commontone = dsp.randint(1, 9) for b in range(numbars): if b % 4 == 0: chord = [ dsp.randint(1, 15) for _ in range(4) ] layers = [] length = beat * dsp.randchoose([2, 3, 4, 6]) for freq in tune.fromdegrees(chord, octave=2, root='c'): #freq = freq * 2**dsp.randint(0,3) amp = dsp.rand(0.25, 0.75) layer = keys.rhodes(length, freq, amp) layer = dsp.pan(layer, dsp.rand()) layers += [ layer ] layers = dsp.mix(layers) ctf = tune.fromdegrees([ commontone ], octave=2, root='c')[0] drone = dsp.mix([ keys.pulsar(ctf, dsp.flen(layers), amp=0.3) for _ in range(4) ]) chord = nextChord(chord) if b % 2 == 0: commontone = commontone + dsp.randchoose([-1,1]) if commontone == 0: commontone = 1 layers = dsp.split(layers, beat / 3)
from pippi import dsp from pippi import tune from hcj import keys chords = tune.chords(['i', 'vi9', 'iii7', 'v'], 'a', octave=3, ratios=tune.terry) out = '' for chord in chords * 4: layers = [] length = dsp.stf(dsp.rand(3, 4)) for freq in chord: layer = keys.rhodes(length, freq, dsp.rand(0.1, 0.2)) layer = dsp.pan(layer, dsp.rand()) layer = dsp.drift(layer, dsp.rand(0, 0.01)) layers += [layer] chord = dsp.mix(layers) chord = dsp.drift(chord, dsp.rand(0, 0.01)) out += chord dsp.write(out, 'chordsweep')
print 'Rendering bar %s' % (b + 1) #bpm = bpm + dsp.randint(-5, 5) #beat = dsp.bpm2frames(bpm) if b % 4 == 0: chord = [dsp.randint(1, 15) for _ in range(4)] layers = [] #length = beat * dsp.randchoose([2, 3, 4, 6]) length = beat * 4 for freq in tune.fromdegrees(chord, octave=2, root='c'): amp = dsp.rand(0.25, 0.5) layer = keys.rhodes(length, freq, amp) layer = dsp.pan(layer, dsp.rand()) layers += [layer] layers = dsp.mix(layers) ctf = tune.fromdegrees([commontone], octave=2, root='c')[0] drone = dsp.mix([ keys.pulsar(ctf, dsp.flen(layers), amp=dsp.rand(0.01, 0.1)) for _ in range(4) ]) chord = nextChord(chord) if b % 2 == 0: commontone = commontone + dsp.randchoose([-1, 1]) if commontone == 0: