Example #1
0
        def makeArps(seg, oct=3, reps=4):
            arp_degrees = [1,2,3,5,8,9,10]
            if dsp.randint(0,1) == 0:
                arp_degrees.reverse()

            arp_degrees = dsp.rotate(arp_degrees, vary=True)
            arp_notes = tune.fromdegrees(arp_degrees[:reps], oct, 'e')

            arps = ''

            arp_count = 0
            for arp_length in seg:
                arp_length /= 2
                arp_pair = arp_notes[ arp_count % len(arp_notes) ], arp_notes[ (arp_count + 1) % len(arp_notes) ]

                arp_one = dsp.tone(arp_length, wavetype='tri', freq=arp_pair[0], amp=0.075)
                arp_one = dsp.env(arp_one, 'random')

                arp_two = dsp.tone(arp_length, wavetype='tri', freq=arp_pair[1], amp=0.08)
                arp_two = dsp.env(arp_two, 'random')

                arps += arp_one + arp_two
                arp_count += 2

            arps = dsp.env(arps, 'random')
            arps = dsp.pan(arps, dsp.rand())

            return arps
Example #2
0
def makeScale():
    scale = dsp.rotate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], vary=True)
    if dsp.rand() > 0.5:
        scale.reverse()

    for _ in range(4, 8):
        scale.pop(dsp.randint(0, len(scale) - 1))

    return scale
Example #3
0
def makeScale():
    scale = dsp.rotate([1,2,3,4,5,6,7,8,9,10], vary=True)
    if dsp.rand() > 0.5:
        scale.reverse()

    for _ in range(4, 8):
        scale.pop(dsp.randint(0, len(scale)-1))

    return scale
Example #4
0
def play(voice_id):
    bpm = config('bpm')
    root = config('key')
    quality = getattr(tune, config('quality'))
    ratios = getattr(tune, config('tune'))

    bendfactor = 0.05
    #    bendfactor = 0

    bdiv = 4
    bdiv *= dsp.randchoose([16, 24, 32])
    loctave = 1
    hoctave = 4

    si = 32 * dsp.randint(1, 2)
    beat = dsp.bpm2frames(bpm) / bdiv

    y = [easeOutQuad(float(i), 0, 1, si) for i in range(si)]
    z = [easeOutQuad(float(i), 0, 1, si) for i in reversed(range(si))]

    freqs = tune.fromdegrees([1, 2, 3, 4, 5, 6, 7, 8],
                             root=root,
                             octave=dsp.randint(loctave, hoctave),
                             ratios=ratios,
                             scale=quality)
    freqs = freqs[:dsp.randint(1, len(freqs))]
    if dsp.rand() > 0.5:
        freqs = [f for f in reversed(freqs)]
    freqs = dsp.rotate(freqs, dsp.randint(0, len(freqs)))

    y = y + z

    y = [dsp.mstf(v * beat) + dsp.mstf(2) for v in y]

    x = range(len(y))

    def make(length, freq):
        freq *= dsp.rand(1 - (bendfactor / 2.0), 1 + (bendfactor / 2.0))
        out = keys.chippy(length=int(length * dsp.rand(0.01, 0.4)),
                          freq=freq,
                          amp=0.7)
        out = dsp.env(out, 'phasor')
        out = dsp.pad(out, 0, length - dsp.flen(out))
        return out

    out = [make(v, freqs[i % len(freqs)]) for i, v in enumerate(y)]
    out = ''.join(out)

    out = dsp.pan(out, dsp.rand(0, 1))

    return out
Example #5
0
def play(voice_id):
    bpm = config('bpm')
    root = config('key')
    quality = getattr(tune, config('quality')) 
    ratios = getattr(tune, config('tune')) 

    bendfactor = 0.05
#    bendfactor = 0 

    bdiv = 4
    bdiv *= dsp.randchoose([16, 24, 32]) 
    loctave = 1
    hoctave = 4

    si = 32 * dsp.randint(1, 2)
    beat = dsp.bpm2frames(bpm) / bdiv

    y = [ easeOutQuad(float(i), 0, 1, si) for i in range(si) ]
    z = [ easeOutQuad(float(i), 0, 1, si) for i in reversed(range(si)) ]

    freqs = tune.fromdegrees([1,2,3,4,5,6,7,8], root=root, octave=dsp.randint(loctave, hoctave), ratios=ratios, scale=quality)
    freqs = freqs[:dsp.randint(1, len(freqs))]
    if dsp.rand() > 0.5:
        freqs = [ f for f in reversed(freqs) ]
    freqs = dsp.rotate(freqs, dsp.randint(0, len(freqs)))

    y = y + z

    y = [ dsp.mstf(v * beat) + dsp.mstf(2) for v in y ]

    x = range(len(y))

    def make(length, freq):
        freq *= dsp.rand(1 - (bendfactor / 2.0), 1 + (bendfactor / 2.0))
        out = keys.chippy(length=int(length*dsp.rand(0.01, 0.4)), freq=freq, amp=0.7)
        out = dsp.env(out, 'phasor')
        out = dsp.pad(out, 0, length - dsp.flen(out))
        return out

    out = [ make(v, freqs[i % len(freqs)]) for i,v in enumerate(y) ]
    out = ''.join(out)

    out = dsp.pan(out, dsp.rand(0,1))

    return out
Example #6
0
def play(voice_id):
    reload(keys)

    bpm = config('bpm')
    root = config('key')
    quality = getattr(tune, config('quality')) 
    ratios = getattr(tune, config('tune')) 

    scale = [1,5,8]

    if dsp.rand() > 0.5:
        scale = reversed(scale)

    freqs = tune.fromdegrees(scale, root=root, octave=dsp.randint(1, 3), ratios=ratios, scale=quality)

    freqs = dsp.rotate(freqs, dsp.randint(0, len(freqs)))

    out = ''

    length = int(dsp.bpm2frames(bpm) * dsp.randchoose([0.25, 0.5, 1]) * 0.5) 
    length = dsp.bpm2frames(bpm) * 4
    length = dsp.stf(dsp.rand(1, 8))
    for n in range(dsp.randint(1, 3)):
        amp = dsp.rand(0.3, 0.65)
        freq = dsp.randchoose(freqs)
        freq = freqs[n%len(freqs)]
        b = keys.chippy(length=length, freq=freq, amp=amp)

        b = dsp.split(b, 100)

        oenvs = dsp.breakpoint([0,0,0,0] + [ dsp.rand() for i in range(len(b) / 10) ], len(b))
        opans = dsp.breakpoint([dsp.rand(0.4, 0.6)] + [ dsp.rand() for i in range(len(b) / 100) ] + [0.5], len(b))
        b = [ dsp.amp(b[i], oenvs[i]) for i in range(len(b)) ]
        b = [ dsp.pan(b[i], opans[i]) for i in range(len(b)) ]

        b = ''.join(b)
        #b = dsp.env(b, 'phasor')
        b = dsp.env(b, 'sine')

        out += b

    return out
Example #7
0
        def makeArps(seg, oct=3, reps=4):
            arp_degrees = [1, 2, 3, 5, 8, 9, 10]
            if dsp.randint(0, 1) == 0:
                arp_degrees.reverse()

            arp_degrees = dsp.rotate(arp_degrees, vary=True)
            arp_notes = tune.fromdegrees(arp_degrees[:reps], oct, 'e')

            arps = ''

            arp_count = 0
            for arp_length in seg:
                arp_length /= 2
                arp_pair = arp_notes[arp_count %
                                     len(arp_notes)], arp_notes[(arp_count + 1)
                                                                %
                                                                len(arp_notes)]

                arp_one = dsp.tone(arp_length,
                                   wavetype='tri',
                                   freq=arp_pair[0],
                                   amp=0.075)
                arp_one = dsp.env(arp_one, 'random')

                arp_two = dsp.tone(arp_length,
                                   wavetype='tri',
                                   freq=arp_pair[1],
                                   amp=0.08)
                arp_two = dsp.env(arp_two, 'random')

                arps += arp_one + arp_two
                arp_count += 2

            arps = dsp.env(arps, 'random')
            arps = dsp.pan(arps, dsp.rand())

            return arps
Example #8
0
                hats = mixdrift(hats)

                if dsp.randint(0, 3) == 0:
                    hats = dsp.pine(hats, tlen, dsp.randchoose(scale))

                if canPlay('breakdown', bigoldsection):
                    hats = mixdrift(hats)

                hatsPlay += 1
                layers += [ hats ]

            # Percussion
            if bigoldsection > 9:
                kpat = single
            else:
                kpat = dsp.rotate(single, vary=True)

            kicks = drums.make(drums.kick, kpat, seg)

            if dsp.randint(0, 3) == 0:
                if dsp.randint(0,1):
                    kicks = dsp.pine(kicks, tlen, dsp.randchoose(scale))
                else:
                    kdivs = dsp.randint(2, 4)
                    kicks = dsp.pine(kicks, tlen / kdivs, dsp.randchoose(scale)) * kdivs


            if canPlay('breakdown', bigoldsection):
                kicks = mixdrift(kicks)

            kicksPlay += 1
Example #9
0
    # snares
    pattern = parseBeat(snarep)
    subseg = splitSeg(seg, 2)
    snares = makeBeat(pattern, subseg, makeSnare)

    # hats
    pattern = parseBeat(hatp)
    subseg = splitSeg(seg, 4)
    hats = makeBeat(pattern, subseg, makeHat)


    # stabs
    bar_length = dsp.randint(4, 13)
    num_pulses = dsp.randint(1, bar_length)
    pattern = dsp.eu(bar_length, num_pulses)
    pattern = dsp.rotate(pattern, vary=True)
    subseg = splitSeg(seg, 3)

    stabs = makeBeat(pattern, subseg, makeStab)
    
    # pulses
    pattern = parseBeat(pulsep)
    pulses = makeBeat(pattern, seg, makePulse)

    section = dsp.mix([ kicks, snares, stabs, hats, pulses ])

    chord = [ dsp.randint(1, 9) for _ in range(dsp.randint(2,4)) ]
    long_chord = rhodesChord(sum(seg), tune.fromdegrees(chord, octave=dsp.randint(2,4), root=key), dsp.rand(0.6, 0.75))
    long_chord = dsp.fill(long_chord, sum(seg))

    def makeGlitch(length, i):
Example #10
0
    return blip

def make_vary(index, length, freq):
    def i(index, offset):
        return ((index + offset) % nump) / float(nump) 

    pulsewidth = int(pnoise1(i(index, 100), 2) * (length / 2))
    
    snd = dsp.tone(pulsewidth, freq, amp=pnoise1(i(index, 99), 3) * 0.5)
    snd = dsp.env(snd, 'sine')

    snd = dsp.pad(snd, 0, length - pulsewidth)

    return snd

p = 'XxxXxxxXxXxxXxxxxXx'

beats = seq.toFrames(p, beat) * 100

layers = []

for l in range(2):
    beats = dsp.rotate(beats, dsp.randint(50, 100))
    layers += [ ''.join([ make_pulse(dsp.tone(length, freqs[i % len(freqs)], amp=dsp.rand(0.1, 0.5))) for i, length in enumerate(beats) ]) ]

out = dsp.mix(layers)

dsp.write(out, 'buchla-perlin')

Example #11
0
                hats = mixdrift(hats)

                if dsp.randint(0, 3) == 0:
                    hats = dsp.pine(hats, tlen, dsp.randchoose(scale))

                if canPlay('breakdown', bigoldsection):
                    hats = mixdrift(hats)

                hatsPlay += 1
                layers += [hats]

            # Percussion
            if bigoldsection > 9:
                kpat = single
            else:
                kpat = dsp.rotate(single, vary=True)

            kicks = drums.make(drums.kick, kpat, seg)

            if dsp.randint(0, 3) == 0:
                if dsp.randint(0, 1):
                    kicks = dsp.pine(kicks, tlen, dsp.randchoose(scale))
                else:
                    kdivs = dsp.randint(2, 4)
                    kicks = dsp.pine(kicks, tlen / kdivs,
                                     dsp.randchoose(scale)) * kdivs

            if canPlay('breakdown', bigoldsection):
                kicks = mixdrift(kicks)

            kicksPlay += 1
Example #12
0
def play(ctl):
    param = ctl.get("param")

    lpd = ctl.get("midi").get("pc")
    lpd.setOffset(111)

    key = "g"

    # bd = dsp.read('/home/hecanjog/sounds/drums/Tinyrim2.wav').data
    # bd = dsp.read('/home/hecanjog/sounds/drums/Jngletam.wav').data
    # bd = dsp.read('/home/hecanjog/sounds/drums/78oh.wav').data
    # bd = dsp.amp(bd, 1)
    # bd = dsp.transpose(bd, dsp.rand(0.65, 0.72) / 1)
    # bd = dsp.transpose(bd, dsp.rand(0.3, 0.32) / 1)

    chord = tune.fromdegrees([1, 8], root="g", octave=dsp.randint(0, 2))
    chord.reverse()
    chord = dsp.rotate(chord, lpd.geti(4, low=0, high=len(chord) - 1))
    # chord = dsp.randshuffle(chord)

    reps = param.get("reps", default=16)
    rep = param.get("rep", default=0)
    beat = dsp.bpm2frames(130) / 4
    beat = dsp.mstf(4100) / 32
    # length = beat

    out = ""
    for n in range(4):
        freq = chord[int(rep) % len(chord)]

        if dsp.rand() > 0.5:
            freq *= 2 ** dsp.randint(0, lpd.geti(7, low=0, high=8, default=0))

        pw = lpd.get(8, low=0.1, high=1, default=1)
        # length = dsp.mstf(lpd.get(2, low=50, high=2500, default=500) * dsp.rand(0.5, 2))
        length = dsp.mstf(lpd.get(14, low=50, high=5000, default=500))

        wf = dsp.wavetable("tri", 512)
        wf = dsp.wavetable("impulse", 512)
        wf = dsp.wavetable("sine2pi", 512)
        wf = dsp.breakpoint([0] + [dsp.rand(-1, 1) for w in range(lpd.geti(15, low=4, high=200, default=4))] + [0], 512)

        win = dsp.wavetable("sine", 512)
        mod = [dsp.rand(0, 1) for m in range(512)]

        modr = dsp.rand(0.01, 0.02)
        modr = lpd.get(16, low=0.01, high=1, default=1)

        modf = dsp.rand(0.5, 2)

        amp = lpd.get(6, low=0, high=2, default=0)
        amp = dsp.rand(0, 2)

        o = dsp.pulsar(freq, length, pw, wf, win, mod, modr, modf, amp)
        o = dsp.env(o, "random")
        o = dsp.taper(o, dsp.mstf(10))
        o = dsp.pan(o, dsp.rand())

        rep = rep + 1

        out += o

    # out = dsp.mix([ dsp.fill(bd, dsp.flen(out), silence=True), out ])

    param.set("rep", (rep + 1) % reps)

    return out
Example #13
0
        layers += [hats]

    if dsp.rand() < suiteguitarprob[segi]:
        pattern = ctl.parseBeat('x  x')
        orc.suiteguitar.scale = orc.suiteguitar.makeScale()
        guitars = ctl.makeBeat(pattern, seg, orc.suiteguitar.make)

        layers += [guitars]

    if dsp.rand() < stabprob[segi]:
        bar_length = dsp.randint(4, 13)
        num_pulses = dsp.randint(1, bar_length)
        orc.rhodes.key = key
        pattern = dsp.eu(bar_length, num_pulses)
        pattern = dsp.rotate(pattern, vary=True)
        subseg = ctl.splitSeg(seg, 3)
        stabs = ctl.makeBeat(pattern, subseg, orc.rhodes.makeStab)

        layers += [stabs]

    if dsp.rand() < pulseprob[segi]:
        orc.rhodes.key = key
        pulsep = 'x..'
        pattern = ctl.parseBeat(pulsep)
        pulses = ctl.makeBeat(pattern, seg, orc.rhodes.makePulse)

        layers += [pulses]

    orc.rhodes.key = key
    long_chord = orc.rhodes.makeLongChord(seg)