Exemple #1
0
def play(ctl):
    mpk = ctl.get('midi').get('mpk')

    ccs = [ i + 48 for i in range(24) ]
    notes = []
    for cc in ccs:
        if mpk.get(cc) < 1:

            notes += [ cc ]

    ssnd = dsp.read('/home/hecanjog/sounds/drums/78sd.wav').data
    ssnd = dsp.read('jesssnare.wav').data
    hsnd = dsp.read('/home/hecanjog/sounds/drums/Shaker.wav').data
    ksnd = dsp.read('/home/hecanjog/sounds/drums/Drybd2.wav').data
    #ksnd = dsp.read('jesskick.wav').data

    beat = dsp.bpm2frames(90)
    #beat = dsp.mstf(290 * 2)
    length = beat * 4

    hat = 'xxx '
    kick =  'x       '
    snare =  '  x '
    #snare =  '  x  xx'
    #snare =  '    '

    def makeHat(length, i, amp):
        h = hsnd
        h = dsp.env(h, 'phasor')
        h = dsp.pad(h, 0, length - dsp.flen(h))

        return h

    def makeKick(length, i, amp):
        k = dsp.mix([ ksnd, drums.sinekick(length, i, amp) ])
        #k = dsp.env(ksnd, 'phasor')

        k = dsp.fill(k, length, silence=True)
        k = dsp.amp(k, 1)

        return k

    def makeSnare(length, i, amp):
        s = ssnd
        s = dsp.amp(s, 1.2)
        s = dsp.transpose(s, dsp.rand(1.5, 3))
        s = dsp.fill(s, length, silence=True)
        #ss = dsp.drift(s, dsp.rand(0.001, 0.1))
        #s = dsp.mix([s, ss])

        return s

    #hats = drums.parsebeat(hat, 16, beat, length, makeHat, 25)
    hats = drums.parsebeat(hat, 16, beat, length, makeHat, 0)
    kicks = drums.parsebeat(kick, 16, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)

    out = dsp.mix([hats,kicks,snares])

    shuf = True
    shuf = False

    if shuf:
        out = dsp.split(out, beat)
        out = dsp.randshuffle(out)
        out = ''.join(out)

    out = dsp.amp(out, 2)

    cuts = True if dsp.rand() > 0.5 else False
    cuts = True
    #cuts = False

    if cuts:
        o = dsp.split(out, beat / 2)
        o = dsp.randshuffle(o)
        o = [ dsp.amp(oo, dsp.rand(0, 2.5)) for oo in o ]
        o = [ dsp.env(oo, 'random') for oo in o ]

        out = dsp.mix([ ''.join(o), out ])

    dsp.log(notes)


    synthy = False
    #synthy = True

    if synthy == True:
        s = ''
        for ii in range(dsp.flen(out) / (beat/2)):
            layers = []

            if len(notes) > 0:
                scale = [ n - 47 for n in notes ]
                scale = [1,5,8,12]
                scale = tune.fromdegrees(scale, octave=3, root='d')
                p = ''.join([ keys.pulsar(scale[ii % len(scale)], pulsewidth=dsp.rand(0.1, 1), amp=0.5, length=(beat/2) / 3) for _ in range(3) ])
                layers += [ p ]
            else:
                layers += [ dsp.pad('', beat / 2, 0) ]

            s += dsp.mix(layers)

        out = dsp.mix([ s, out ])

    #out = dsp.alias(out)

    #out = dsp.drift(out, dsp.rand(0.5, 2))

    return out
Exemple #2
0
        commontone = commontone + dsp.randchoose([-1,1])
        if commontone == 0:
            commontone = 1

    layers = dsp.split(layers, beat / 3)
    layers = dsp.randshuffle(layers)
    layers = ''.join(layers)

    drone = dsp.split(drone, beat)
    drone = dsp.randshuffle(drone)
    drone = ''.join(drone)

    #hats = dsp.fill(dsp.fill(hat, beat / 4), dsp.flen(layers))
    #kicks = dsp.fill(kick, dsp.flen(layers), silence=True)

    hats = drums.parsebeat(hatp, 8, beat, dsp.flen(layers), makeHat, 12)
    kicks = drums.parsebeat(kickp, 4, beat, dsp.flen(layers), makeKick, 0)
    snares = drums.parsebeat(snarep, 8, beat, dsp.flen(layers), makeSnare, 0)

    #dr = dsp.mix([ hats, kicks, snares ])
    dr = dsp.mix([ kicks, snares ])
    d = dsp.split(dr, beat / 8)
    d = dsp.randshuffle(d)
    #print len(d)
    #d = dsp.packet_shuffle(d, dsp.randint(2, 4))
    #print len(d)
    d = [ dd * dsp.randint(1, 2) for dd in d ]
    d = ''.join(d)
    d = dsp.fill(dsp.mix([d, dr]), dsp.flen(layers))

    d = dsp.amp(d, 3)
        h = dsp.env(h, 'phasor')
        return h

    def makeKick(length, i, amp):
        k = dsp.fill(ksnd, length, silence=True)
        return dsp.amp(k, 3)

    def makeSnare(length, i, amp):
        s = dsp.fill(ssnd, length, silence=True)
        return dsp.amp(s, 3)

    def makeLSnare(length, i, amp):
        s = dsp.fill(lssnd, length, silence=True)
        return dsp.amp(s, 2)

    hats = drums.parsebeat(hat, 8, beat, length, makeHat, 5)
    ohats = drums.parsebeat(ohat, 8, beat, length, makeOHat, 0)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)
    lsnares = drums.parsebeat(lsnare, 8, beat, length, makeLSnare, 0)

    snaresnstuff = dsp.mix([ohats,snares])
    snaresnstuff= dsp.split(snaresnstuff, dsp.flen(snaresnstuff) / 32)
    snaresnstuff = dsp.randshuffle(snaresnstuff)
    snaresnstuff = [ dsp.env(sns, 'phasor') for sns in snaresnstuff ]
    snaresnstuff = ''.join(snaresnstuff)
    snaresnstuff = dsp.amp(snaresnstuff, 0.5)

    bar = dsp.mix([kicks,lsnares,snares,hats,ohats,snaresnstuff])
    #bar = dsp.mix([hats,ohats])
Exemple #4
0
def play(ctl):
    mpk = ctl.get('midi').get('mpk')

    ccs = [i + 48 for i in range(24)]
    notes = []
    for cc in ccs:
        if mpk.get(cc) < 1:

            notes += [cc]

    ssnd = dsp.read('/home/hecanjog/sounds/drums/78sd.wav').data
    ssnd = dsp.read('jesssnare.wav').data
    hsnd = dsp.read('/home/hecanjog/sounds/drums/Shaker.wav').data
    ksnd = dsp.read('/home/hecanjog/sounds/drums/Drybd2.wav').data
    #ksnd = dsp.read('jesskick.wav').data

    beat = dsp.bpm2frames(90)
    #beat = dsp.mstf(290 * 2)
    length = beat * 4

    hat = 'xxx '
    kick = 'x       '
    snare = '  x '

    #snare =  '  x  xx'
    #snare =  '    '

    def makeHat(length, i, amp):
        h = hsnd
        h = dsp.env(h, 'phasor')
        h = dsp.pad(h, 0, length - dsp.flen(h))

        return h

    def makeKick(length, i, amp):
        k = dsp.mix([ksnd, drums.sinekick(length, i, amp)])
        #k = dsp.env(ksnd, 'phasor')

        k = dsp.fill(k, length, silence=True)
        k = dsp.amp(k, 1)

        return k

    def makeSnare(length, i, amp):
        s = ssnd
        s = dsp.amp(s, 1.2)
        s = dsp.transpose(s, dsp.rand(1.5, 3))
        s = dsp.fill(s, length, silence=True)
        #ss = dsp.drift(s, dsp.rand(0.001, 0.1))
        #s = dsp.mix([s, ss])

        return s

    #hats = drums.parsebeat(hat, 16, beat, length, makeHat, 25)
    hats = drums.parsebeat(hat, 16, beat, length, makeHat, 0)
    kicks = drums.parsebeat(kick, 16, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)

    out = dsp.mix([hats, kicks, snares])

    shuf = True
    shuf = False

    if shuf:
        out = dsp.split(out, beat)
        out = dsp.randshuffle(out)
        out = ''.join(out)

    out = dsp.amp(out, 2)

    cuts = True if dsp.rand() > 0.5 else False
    cuts = True
    #cuts = False

    if cuts:
        o = dsp.split(out, beat / 2)
        o = dsp.randshuffle(o)
        o = [dsp.amp(oo, dsp.rand(0, 2.5)) for oo in o]
        o = [dsp.env(oo, 'random') for oo in o]

        out = dsp.mix([''.join(o), out])

    dsp.log(notes)

    synthy = False
    #synthy = True

    if synthy == True:
        s = ''
        for ii in range(dsp.flen(out) / (beat / 2)):
            layers = []

            if len(notes) > 0:
                scale = [n - 47 for n in notes]
                scale = [1, 5, 8, 12]
                scale = tune.fromdegrees(scale, octave=3, root='d')
                p = ''.join([
                    keys.pulsar(scale[ii % len(scale)],
                                pulsewidth=dsp.rand(0.1, 1),
                                amp=0.5,
                                length=(beat / 2) / 3) for _ in range(3)
                ])
                layers += [p]
            else:
                layers += [dsp.pad('', beat / 2, 0)]

            s += dsp.mix(layers)

        out = dsp.mix([s, out])

    #out = dsp.alias(out)

    #out = dsp.drift(out, dsp.rand(0.5, 2))

    return out
Exemple #5
0
def play(ctl):
    mpk = ctl.get('midi').get('mpk')

    ssnd = dsp.read('/home/hecanjog/sounds/drums/78sd.wav').data
    lssnd = dsp.read('jesssnare.wav').data
    hsnd = dsp.read('/home/hecanjog/sounds/drums/78ch.wav').data
    ohsnd = dsp.read('/home/hecanjog/sounds/drums/78oh.wav').data
    ksnd = dsp.read('jesskick.wav').data

    beat = dsp.bpm2frames(166)
    length = beat * 8

    if dsp.rand() > 0.5:
        kick =   'x--x-x-x--------'
    else:
        kick =   'x----x----------'

    hat =    'x-x-x-x-xx-x-x-x'
    ohat =   'x------x--------'
    lsnare = '---------x--x---'

    if dsp.rand() > 0.5:
        lsnare = '---------x--x---'
    else:
        lsnare = '--x--x--x--x--x-'

    snare =  '--x--x--x--x--x-'

    def makeOHat(length, i, amp):
        return dsp.fill(hsnd, length, silence=True)

    def makeHat(length, i, amp):
        return dsp.fill(ohsnd, length, silence=True)

    def makeKick(length, i, amp):
        k = dsp.fill(ksnd, length, silence=True)
        return dsp.amp(k, 3)

    def makeSnare(length, i, amp):
        s = dsp.fill(ssnd, length, silence=True)
        return dsp.amp(s, 2)

    def makeLSnare(length, i, amp):
        s = dsp.fill(lssnd, length, silence=True)
        return dsp.amp(s, 1)

    hats = drums.parsebeat(hat, 8, beat, length, makeHat, 5)
    ohats = drums.parsebeat(ohat, 8, beat, length, makeOHat, 0)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)
    lsnares = drums.parsebeat(lsnare, 8, beat, length, makeLSnare, 0)

    snaresnstuff = dsp.mix([ohats,snares])
    snaresnstuff= dsp.split(snaresnstuff, dsp.flen(snaresnstuff) / 32)
    snaresnstuff = dsp.randshuffle(snaresnstuff)
    snaresnstuff = ''.join(snaresnstuff)
    snaresnstuff = dsp.amp(snaresnstuff, 0.35)

    out = dsp.mix([kicks,lsnares,snares,hats,ohats,snaresnstuff])

    return out
Exemple #6
0
def play(ctl):
    lpd = ctl.get('midi').get('lpd')

    ssnd = dsp.read('/home/hecanjog/sounds/drums/Tinysd.wav').data
    hsnd = dsp.read('/home/hecanjog/sounds/drums/Shaker.wav').data
    ksnd = dsp.read('/home/hecanjog/sounds/drums/Drybd2.wav').data

    beat = dsp.bpm2frames(120)
    length = beat * 4 

    hat =   'xx'
    kick =  'x '
    #kick = ''.join([ dsp.randchoose([' ', 'x']) for s in range(dsp.randint(3, 5))])
    #hat = ''.join([ dsp.randchoose([' ', 'x']) for s in range(dsp.randint(3, 5))])
    if dsp.rand() > 0.75:
        snare = ''.join([ dsp.randchoose([' ', 'x']) for s in range(dsp.randint(6, 8))])
    else:
        snare =  '  x '
    #        x.-.x.-.x.-.x.-.x.-.

    def makeHat(length, i, amp):
        """
        h = dsp.tone(dsp.mstf(dsp.rand(1, 3)), dsp.rand(11900, 12000))
        h = dsp.env(h, 'phasor')
        h = dsp.pad(h, 0, length - dsp.flen(h))
        h = dsp.amp(h, amp * 0.25)
        """

        #h = dsp.cut(hsnd, 0, dsp.mstf(dsp.rand(3, 10)))
        h = hsnd
        h = dsp.env(h, 'phasor')
        h = dsp.pad(h, 0, length - dsp.flen(h))
        #h = dsp.amp(h, amp * 0.75)

        return h

    def makeKick(length, i, amp):
        #k = drums.sinekick(length, i, amp)
        k = dsp.fill(ksnd, length, silence=True)
        k = dsp.amp(k, 2)

        return k

    def makeSnare(length, i, amp):
        s = ssnd
        s = dsp.amp(s, 10)
        s = dsp.transpose(s, dsp.rand(0.8, 1))
        s = dsp.fill(s, length, silence=True)
        ss = dsp.drift(s, dsp.rand(0.001, 0.1))
        s = dsp.mix([s, ss])

        return s

    hats = drums.parsebeat(hat, 16, beat, length, makeHat, 25)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 10)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)

    out = dsp.mix([hats,kicks,snares])

    out = dsp.split(out, beat)
    out = dsp.randshuffle(out)
    out = ''.join(out)

    out = dsp.amp(out, 2)

    #out = dsp.drift(out, dsp.rand(0.5, 2))

    return out
        h = dsp.env(h, "phasor")
        return h

    def makeKick(length, i, amp):
        k = dsp.fill(ksnd, length, silence=True)
        return dsp.amp(k, 3)

    def makeSnare(length, i, amp):
        s = dsp.fill(ssnd, length, silence=True)
        return dsp.amp(s, 3)

    def makeLSnare(length, i, amp):
        s = dsp.fill(lssnd, length, silence=True)
        return dsp.amp(s, 2)

    hats = drums.parsebeat(hat, 8, beat, length, makeHat, 5)
    ohats = drums.parsebeat(ohat, 8, beat, length, makeOHat, 0)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)
    lsnares = drums.parsebeat(lsnare, 8, beat, length, makeLSnare, 0)

    snaresnstuff = dsp.mix([ohats, snares])
    snaresnstuff = dsp.split(snaresnstuff, dsp.flen(snaresnstuff) / 32)
    snaresnstuff = dsp.randshuffle(snaresnstuff)
    snaresnstuff = [dsp.env(sns, "phasor") for sns in snaresnstuff]
    snaresnstuff = "".join(snaresnstuff)
    snaresnstuff = dsp.amp(snaresnstuff, 0.5)

    bar = dsp.mix([kicks, lsnares, snares, hats, ohats, snaresnstuff])
    # bar = dsp.mix([hats,ohats])
Exemple #8
0
    chord = nextChord(chord)

    if b % 2 == 0:
        commontone = commontone + dsp.randchoose([-1, 1])
        if commontone == 0:
            commontone = 1

    layers = dsp.split(layers, beat / 3)
    layers = dsp.randshuffle(layers)
    layers = ''.join(layers)

    drone = dsp.split(drone, beat)
    drone = dsp.randshuffle(drone)
    drone = ''.join(drone)

    hats = drums.parsebeat(hatp, 16, beat, dsp.flen(layers), makeHat, 12)
    kicks = drums.parsebeat(kickp, 4, beat, dsp.flen(layers), makeKick, 0)
    snares = drums.parsebeat(snarep, 8, beat, dsp.flen(layers), makeSnare, 0)

    dr = dsp.mix([kicks, snares])

    d = dsp.split(dr, beat / 8)
    d = dsp.randshuffle(d)
    d = [dd * dsp.randint(1, 2) for dd in d]
    d = ''.join(d)
    d = dsp.fill(dsp.mix([d, dr, dsp.env(hats, 'hann')]), dsp.flen(layers))

    d = dsp.amp(d, 3)

    layers = dsp.mix([layers, d, drone])