Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
def play(voice_id):
    bpm = config('bpm')
    key = config('key')
    quality = getattr(tune, config('quality')) 
    ratios = getattr(tune, config('tune')) 

    beat = dsp.bpm2frames(bpm)
    nlen = beat / dsp.randchoose([4,5,6,7,8,9,10])

    root = 340.0
    target = tune.ntf(key)

    n = dsp.read('sounds/mike.wav').data
    n = dsp.transpose(n, target / root)
    n = dsp.amp(n, 0.4)

    length = dsp.randint(16, 64) * beat
    ngrains = length / nlen

    n = dsp.transpose(n, dsp.randchoose([0.5, 1, 2, 2, 4, 4]))
    n = dsp.split(n, nlen)

    snd = dsp.randchoose(n)
    snd = dsp.env(snd, 'sine')

    grains = [ snd for i in range(ngrains) ]
    grains = [ dsp.pan(grain, dsp.rand()) for grain in grains ]

    out = ''.join(grains)
    out = dsp.env(out, 'sine')

#    out = dsp.pad(out, 0, dsp.stf(dsp.randint(0.5, 3)))

    return out
Exemplo n.º 4
0
def bell(length=22050, freq=220, amp=0.5):
    ding = dsp.read('/home/hecanjog/sounds/vibesc1.wav').data
    ding = dsp.amp(ding, dsp.rand(0.5, 0.8))

    bell = dsp.read('/home/hecanjog/sounds/tones/bellc.wav').data
    bell = dsp.amp(bell, dsp.rand(10, 50))
    bell = dsp.amp(bell, 0.3)

    rhodes = dsp.read('/home/hecanjog/sounds/tones/rhodes.wav').data
    rhodes = dsp.transpose(rhodes, 1.2)
    rhodes = dsp.pan(rhodes, dsp.rand())

    glade = dsp.read('/home/hecanjog/sounds/glade.wav').data
    numgs = dsp.randint(2, 6)

    gs = []
    for _ in range(numgs):
        g = dsp.rcut(glade, dsp.mstf(100, 500))
        g = dsp.amp(g, dsp.rand(0.2, 0.5))
        g = dsp.pan(g, dsp.rand())
        g = dsp.transpose(g, dsp.rand(0.15, 0.75))

        gs += [ g ]

    gs = dsp.mix(gs)
    gs = dsp.env(gs, 'phasor')

    clump = dsp.mix([ ding, gs, bell, rhodes ])

    clump = dsp.transpose(clump, freq / tune.ntf('c', octave=4))
    clump = dsp.fill(clump, length, silence=True)
    clump = dsp.env(clump, 'phasor')
    clump = dsp.amp(clump, amp)

    return clump
Exemplo n.º 5
0
                def bendit(out=''):
                    if bbend == True:
                        bendtable = dsp.randchoose([
                            'impulse', 'sine', 'line', 'phasor', 'cos',
                            'impulse'
                        ])
                        lowbend = dsp.rand(0.8, 0.99)
                        highbend = dsp.rand(1.0, 1.25)
                    else:
                        bendtable = 'sine'
                        lowbend = 0.99
                        #                        lowbend = 0.75
                        highbend = 1.01
#                        highbend = 1.5

                    out = dsp.split(out, 441)

                    freqs = dsp.wavetable(bendtable, len(out))

                    freqs = [
                        math.fabs(f) * (highbend - lowbend) + lowbend
                        for f in freqs
                    ]

                    out = [
                        dsp.transpose(out[i], freqs[i])
                        for i in range(len(out))
                    ]
                    return ''.join(out)
Exemplo n.º 6
0
    def clap2(beat):
        nlens = [
            beat * 2,
            beat,
            beat / 2,
        ]

        # length of pattern (in beats)
        nbeats = dsp.randint(10, 15)

        # beat lengths (from a set of bpm-derived note lengths defined in the nlens list)
        blens = [ dsp.randchoose(nlens) for b in range(nbeats) ]

        out = ''
     
        # synthesize the tones
        for i in range(nbeats):
            beat = dsp.transpose(dsp.randchoose([c1,c2]), dsp.rand(0.25, 40.0))
            beat = dsp.pad(beat, 0, blens[i] - dsp.flen(beat))
            beat = dsp.amp(beat, dsp.rand(1, 4))

            # add it to the output
            out += beat

        return out
Exemplo n.º 7
0
    def play(self, freq, length, amp=1):
        snd = dsp.transpose(self.snd, freq / self.freq)
        snd = dsp.taper(snd, 40)
        snd = dsp.amp(snd, amp)

        if self.direction == 'fw':
            snd = dsp.env(snd, self.env)
            snd = dsp.fill(snd, length, silence=True)

        if self.direction == 'fw-loop':
            snd = dsp.fill(snd, length, silence=False)
            snd = dsp.env(snd, self.env)

        if self.direction == 'fw-loop-rand':
            snd = dsp.env(snd, self.env)
            elapsed = 0
            sndout = ''
            while elapsed < length:
                sndout += dsp.pad(snd, 0, dsp.randint(0, dsp.flen(snd)))
                elapsed = dsp.flen(sndout)

            snd = dsp.fill(sndout, length, silence=False)

        if self.direction == 'fw-bw-loop':
            snd = dsp.fill(snd + dsp.reverse(snd), length, silence=False)
            snd = dsp.env(snd, self.env)

        if self.tails:
            snd = dsp.mix([ snd, self.makeTails(freq, length) ])

        return snd
Exemplo n.º 8
0
def ding(tone, tlength=88200, nlength=1000):

    def sequence(tonic='g'):
        numdegrees = dsp.randint(2, 8)
        degrees = [1,5,8,11,12]
        #scale = [ dsp.randchoose(degrees) for i in range(numdegrees) ]
        scale = degrees[dsp.randint(0, 3):]
        scale = dsp.randshuffle(scale)
        scale = tune.fromdegrees(scale, 1, tonic, tune.major, tune.terry) 
        
        return scale

    numtones = tlength / nlength
    numtones = 1 if numtones < 1 else numtones

    freqs = [ note / tune.ntf('g', 4) for note in sequence('g') ]

    tones = [ dsp.transpose(tone, freq) for freq in freqs ]
    #tones = [ dsp.cut(tones[i % len(tones)], dsp.mstf(dsp.rand(0, 100)), nlength + dsp.randint(0, 500)) for i in range(numtones) ]
    tones = [ dsp.cut(tones[i % len(tones)], dsp.mstf(dsp.rand(0, 100)), nlength) for i in range(numtones) ]

    #tones = [ dsp.drift(tone, 0.03) for tone in tones ]
    curve = dsp.breakpoint([0] + [ dsp.rand(0, 0.01) for i in range(3) ], len(tones))
    tones = [ dsp.drift(tone, curve[index % len(curve)]) for index, tone in enumerate(tones) ]

    tones = [ fade(tone) for tone in tones ]
    
    return dsp.amp(''.join(tones), 0.5)
Exemplo n.º 9
0
def fracture(snd):
    numpoints = dsp.randint(3, 20)
    poscurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0], numpoints)
    poscurve = [ p * (dsp.flen(snd) - dsp.mstf(210)) for p in poscurve ]

    lencurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0], numpoints)
    lencurve = [ l * dsp.mstf(200) + dsp.mstf(10) for l in lencurve ]

    pancurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0], numpoints)

    prepadcurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0], numpoints)
    prepadcurve = [ int(p * dsp.mstf(20)) for p in prepadcurve ]

    postpadcurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0], numpoints)
    postpadcurve = [ int(p * dsp.mstf(20)) for p in postpadcurve ]

    speeds = [1.0, 2.0, 0.5, 0.75]

    grains = [ dsp.cut(snd, poscurve[i], lencurve[i]) for i in range(numpoints) ]
    grains = [ dsp.pan(grains[i], pancurve[i]) for i in range(numpoints) ]
    grains = [ dsp.env(grain, 'gauss', True) for grain in grains ]
    grains = [ dsp.transpose(grain, dsp.randchoose(speeds)) for grain in grains ]
    grains = [ dsp.pad(grains[i], prepadcurve[i], postpadcurve[i]) for i in range(numpoints) ]

    for i in range(numpoints):
        if dsp.randint(0, 3) == 0:
            grains[i] = slurp(grains[i])

    etypes = ['line', 'phasor', 'tri', 'sine', 'gauss']

    snd = dsp.env(''.join(grains), dsp.randchoose(etypes))
    snd = dsp.pad(snd, 0, dsp.mstf(dsp.rand(100, 400)))

    return snd
Exemplo n.º 10
0
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
Exemplo n.º 11
0
def ding(tone, tlength=88200, nlength=1000):
    def sequence(tonic='g'):
        numdegrees = dsp.randint(2, 8)
        degrees = [1, 5, 8, 11, 12]
        #scale = [ dsp.randchoose(degrees) for i in range(numdegrees) ]
        scale = degrees[dsp.randint(0, 3):]
        scale = dsp.randshuffle(scale)
        scale = tune.fromdegrees(scale, 1, tonic, tune.major, tune.terry)

        return scale

    numtones = tlength / nlength
    numtones = 1 if numtones < 1 else numtones

    freqs = [note / tune.ntf('g', 4) for note in sequence('g')]

    tones = [dsp.transpose(tone, freq) for freq in freqs]
    #tones = [ dsp.cut(tones[i % len(tones)], dsp.mstf(dsp.rand(0, 100)), nlength + dsp.randint(0, 500)) for i in range(numtones) ]
    tones = [
        dsp.cut(tones[i % len(tones)], dsp.mstf(dsp.rand(0, 100)), nlength)
        for i in range(numtones)
    ]

    #tones = [ dsp.drift(tone, 0.03) for tone in tones ]
    curve = dsp.breakpoint([0] + [dsp.rand(0, 0.01) for i in range(3)],
                           len(tones))
    tones = [
        dsp.drift(tone, curve[index % len(curve)])
        for index, tone in enumerate(tones)
    ]

    tones = [fade(tone) for tone in tones]

    return dsp.amp(''.join(tones), 0.5)
Exemplo n.º 12
0
    def clap2(beat):
        nlens = [
            beat * 2,
            beat,
            beat / 2,
        ]

        # length of pattern (in beats)
        nbeats = dsp.randint(10, 15)

        # beat lengths (from a set of bpm-derived note lengths defined in the nlens list)
        blens = [dsp.randchoose(nlens) for b in range(nbeats)]

        out = ''

        # synthesize the tones
        for i in range(nbeats):
            beat = dsp.transpose(dsp.randchoose([c1, c2]),
                                 dsp.rand(0.25, 40.0))
            beat = dsp.pad(beat, 0, blens[i] - dsp.flen(beat))
            beat = dsp.amp(beat, dsp.rand(1, 4))

            # add it to the output
            out += beat

        return out
Exemplo n.º 13
0
def play(voice_id):
    bpm = config('bpm')
    beat = dsp.bpm2frames(bpm)

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

    bar = beat * dsp.randchoose([8, 16, 32])

    groot = tune.ntf('c') 

    scale = tune.fromdegrees([1,3,5,6,8,9], root=root, octave=2, ratios=ratios)

    v = dsp.read('sounds/vibesc1.wav').data

    out = ''

#    lens = [ bar / 5, bar / 8, bar / 12 ]
    lens = [ bar / 6, bar / 8, bar / 16 ]

    maxbend = 2
    maxbend = 0.02

    layers = []

    for nlen in lens:
        layer = ''

        nlen /= 2

        note = dsp.transpose(v, (dsp.randchoose(scale) * 2**dsp.randint(0, 3)) / groot)
        note = dsp.fill(note, nlen)
        note = dsp.env(note, 'phasor')
        note = dsp.amp(note, 0.125)

        nbeats = bar / nlen
        for b in range(nbeats):
            b = dsp.pan(note, dsp.rand())
            b = dsp.drift(b, dsp.rand(0, dsp.rand(0.01, maxbend)))

            if dsp.flen(b) < nlen:
                b = dsp.pad(b, 0, nlen - dsp.flen(b))

#            if dsp.rand() > 0.5:
#                b = dsp.vsplit(b, dsp.flen(b) / 3, dsp.flen(b) / 2)
#                b = dsp.randshuffle(b)
#                b = [ dsp.amp(bb, dsp.rand(0.5, 2)) for bb in b ]
#                b = ''.join(b)

            layer += b

#        layer = dsp.fill(layer, bar)

        layers += [ layer ]

    out = dsp.mix(layers)
    out = dsp.fill(out, bar)

    return out
Exemplo n.º 14
0
def makeGrains():
    guitar = dsp.randchoose(guitars)
    guitar = dsp.transpose(guitar, dsp.randchoose([1, 2, 3, 4, 8]))

    max_grain_length = dsp.mstf(dsp.rand(10, 500))

    positions = [
        math.floor(pos * (dsp.flen(guitar) - max_grain_length))
        for pos in makeShape()
    ]
    lengths = [
        math.floor(length * (max_grain_length - 1) + 1)
        for length in makeShape()
    ]
    pans = makeShape()
    amps = [amp * dsp.rand(0, 10) for amp in makeShape()]

    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)
Exemplo n.º 15
0
Arquivo: fx.py Projeto: hecanjog/o-ou
def smear(input, mingrain=2205, maxgrain=4410, waveform='hann', spread=0.1, drift=0.05, minpan=0.0, maxpan=1.0, minamp=0.0, maxamp=1.0):
    out = dsp.vsplit(input, mingrain, maxgrain)
    out = [ dsp.amp(grain, dsp.rand(minamp, maxamp)) for grain in out ]
    out = [ dsp.env(grain, waveform) for grain in out ]
    out = [ dsp.pan(grain, dsp.rand(minpan, maxpan)) for grain in out ]
    drift_delta = drift / 2.0
    minspeed = 1.0 - drift_delta
    maxspeed = 1.0 + drift_delta

    out = [ dsp.transpose(grain, dsp.rand(minspeed, maxspeed)) for grain in out ]

    num_shuffled_grains = int(len(out) * spread)

    # Pull a random set of grains
    shuffled_grains = []
    for i in range(num_shuffled_grains):
        index = dsp.randint(0, len(out) - 1)
        shuffled_grains += [ out.pop(index) ] 

    # Insert them back into random positions
    for grain in shuffled_grains:
        index = dsp.randint(0, len(out) - 1)
        out.insert(index, grain)

    out = ''.join(out)

    return out
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def ping(maxlen=44100, freqs=None):
    out = ''

    if freqs is None:
        freqs = [ dsp.rand(20,10000) for i in range(4) ]

    tlen = dsp.randint(10, maxlen)

    tones = [ dsp.tone(length=tlen, freq=freq, amp=0.1, wavetype='random') 
            for freq in freqs ]

    tones = [ dsp.split(tone, 64) for tone in tones ]

    pcurves = [ dsp.breakpoint([ dsp.rand() for t in range(len(tones[i]) / 20) ],
            len(tones[i])) for i in range(len(tones)) ]

    tones = [ [ dsp.pan(t, pcurves[i][ti]) for ti, t in enumerate(tones[i]) ] 
            for i in range(len(tones)) ]

    fcurves = [ dsp.breakpoint([ dsp.rand(0.0, 0.1) + 0.9 for t in range(len(tones[i]) / 20) ],
            len(tones[i])) for i in range(len(tones)) ]

    tones = [ [ dsp.transpose(t, fcurves[i][ti] + 0.1) for ti, t in enumerate(tones[i]) ] 
            for i in range(len(tones)) ]

    out = dsp.mix([ dsp.env(''.join(tone), 'random') for tone in tones ])
    out = dsp.env(out, 'random')
    out = dsp.pad(out, 0, dsp.randint(0, maxlen * 3))

    return out
Exemplo n.º 18
0
def play(voice_id):
    bpm = config('bpm')
    key = config('key')
    quality = getattr(tune, config('quality')) 
    ratios = getattr(tune, config('tune')) 

    beat = dsp.bpm2frames(bpm)
    beat = beat / 4

    glitch = False
    alias = False
    nbeats = P(voice_id, 'multiple', dsp.randchoose([8, 16]))

    gs = ['gC1', 'gC2']
    g = dsp.randchoose(gs)
    n = dsp.read('sounds/%s.wav' % g).data

#    speeds = [1, 1.25, 1.5, 1.666, 2, 4]
    speeds = [1, 1.25, 1.5, 2, 3, 4, 6, 8, 16]

    root = tune.ntf('c')
    target = tune.ntf(key)

    n = dsp.transpose(n, target / root)
    n = dsp.fill(n, dsp.stf(20))
    n = dsp.transpose(n, dsp.randchoose(speeds))
    n = dsp.split(n, beat)
    n = dsp.randshuffle(n)
    n = n[:nbeats + 1]

    if alias:
        n = [ dsp.alias(nn) for nn in n ]

    n = [ dsp.amp(nn, dsp.rand(0.1, 0.75)) for nn in n ]
    n = [ dsp.pan(nn, dsp.rand()) for nn in n ]

    n = ''.join(n)

    out = n

    if glitch:
        out = dsp.vsplit(out, dsp.mstf(dsp.rand(80, 140)), dsp.mstf(500))
        out = dsp.randshuffle(out)
        out = ''.join(out)

    return out
Exemplo n.º 19
0
def play(voice_id):
    bpm = config('bpm')
    key = config('key')
    quality = getattr(tune, config('quality'))
    ratios = getattr(tune, config('tune'))

    beat = dsp.bpm2frames(bpm)
    beat = beat / 4

    glitch = False
    alias = False
    nbeats = P(voice_id, 'multiple', dsp.randchoose([8, 16]))

    gs = ['gC1', 'gC2']
    g = dsp.randchoose(gs)
    n = dsp.read('sounds/%s.wav' % g).data

    #    speeds = [1, 1.25, 1.5, 1.666, 2, 4]
    speeds = [1, 1.25, 1.5, 2, 3, 4, 6, 8, 16]

    root = tune.ntf('c')
    target = tune.ntf(key)

    n = dsp.transpose(n, target / root)
    n = dsp.fill(n, dsp.stf(20))
    n = dsp.transpose(n, dsp.randchoose(speeds))
    n = dsp.split(n, beat)
    n = dsp.randshuffle(n)
    n = n[:nbeats + 1]

    if alias:
        n = [dsp.alias(nn) for nn in n]

    n = [dsp.amp(nn, dsp.rand(0.1, 0.75)) for nn in n]
    n = [dsp.pan(nn, dsp.rand()) for nn in n]

    n = ''.join(n)

    out = n

    if glitch:
        out = dsp.vsplit(out, dsp.mstf(dsp.rand(80, 140)), dsp.mstf(500))
        out = dsp.randshuffle(out)
        out = ''.join(out)

    return out
Exemplo n.º 20
0
def play(ctl):
    mpk = ctl.get('midi').get('mpk')
    nk = ctl.get('midi').get('nk')

    amp = mpk.get(4, low=0, high=1, default=0)

    kick = dsp.read('/home/hecanjog/sounds/drums/Junglebd.wav').data
    klength = dsp.mstf(mpk.get(1, low=60, high=1500, default=100))
    k = dsp.fill(kick, klength, silence=True)
    kamp = nk.get(0, low=0, high=1, default=1)
    k = dsp.amp(k, kamp)
    kpitch = nk.get(16, low=0.25, high=1, default=1)
    k = dsp.transpose(k, kpitch)

    snare = dsp.read('/home/hecanjog/sounds/drums/Hipclap1.wav').data
    slength = dsp.mstf(mpk.get(2, low=60, high=500, default=100))
    s = dsp.fill(snare, slength, silence=True)
    soffset = dsp.mstf(mpk.get(6, low=0, high=500, default=0))
    s = dsp.pad(s, soffset, 0)
    samp = nk.get(1, low=0, high=1, default=1)
    s = dsp.amp(s, samp)
    spitch = nk.get(17, low=0.25, high=2, default=1)
    s = dsp.transpose(s, spitch)

    hat = dsp.read('/home/hecanjog/sounds/drums/78ch.wav').data
    hlength = dsp.mstf(mpk.get(3, low=60, high=500, default=100))
    h = dsp.fill(hat, hlength, silence=True)
    hoffset = dsp.mstf(mpk.get(7, low=0, high=500, default=0))
    h = dsp.pad(h, hoffset, 0)
    hamp = nk.get(2, low=0, high=1, default=1)
    h = dsp.amp(h, hamp)
    hpitch = nk.get(18, low=0.25, high=2, default=1)
    h = dsp.transpose(h, hpitch)

    longest = max([dsp.flen(k), dsp.flen(h), dsp.flen(s)])

    k = dsp.fill(k, longest)
    h = dsp.fill(h, longest)
    s = dsp.fill(s, longest)

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

    out = dsp.amp(out, amp)

    return out
Exemplo n.º 21
0
def play(ctl):
    mpk = ctl.get('midi').get('mpk')
    nk = ctl.get('midi').get('nk')

    amp = mpk.get(4, low=0, high=1, default=0)

    kick = dsp.read('/home/hecanjog/sounds/drums/Junglebd.wav').data
    klength = dsp.mstf(mpk.get(1, low=60, high=1500, default=100))
    k = dsp.fill(kick, klength, silence=True)
    kamp = nk.get(0, low=0, high=1, default=1)
    k = dsp.amp(k, kamp)
    kpitch = nk.get(16, low=0.25, high=1, default=1)
    k = dsp.transpose(k, kpitch)

    snare = dsp.read('/home/hecanjog/sounds/drums/Hipclap1.wav').data
    slength = dsp.mstf(mpk.get(2, low=60, high=500, default=100))
    s = dsp.fill(snare, slength, silence=True)
    soffset = dsp.mstf(mpk.get(6, low=0, high=500, default=0))
    s = dsp.pad(s, soffset, 0)
    samp = nk.get(1, low=0, high=1, default=1)
    s = dsp.amp(s, samp)
    spitch = nk.get(17, low=0.25, high=2, default=1)
    s = dsp.transpose(s, spitch)

    hat = dsp.read('/home/hecanjog/sounds/drums/78ch.wav').data
    hlength = dsp.mstf(mpk.get(3, low=60, high=500, default=100))
    h = dsp.fill(hat, hlength, silence=True)
    hoffset = dsp.mstf(mpk.get(7, low=0, high=500, default=0))
    h = dsp.pad(h, hoffset, 0)
    hamp = nk.get(2, low=0, high=1, default=1)
    h = dsp.amp(h, hamp)
    hpitch = nk.get(18, low=0.25, high=2, default=1)
    h = dsp.transpose(h, hpitch)

    longest = max([ dsp.flen(k), dsp.flen(h), dsp.flen(s) ])

    k = dsp.fill(k, longest)
    h = dsp.fill(h, longest)
    s = dsp.fill(s, longest)

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

    out = dsp.amp(out, amp)

    return out
Exemplo n.º 22
0
def play(voice_id):
    bpm = C('bpm')
    beat = dsp.bpm2frames(bpm)
    volume = P(voice_id, 'volume', default=1.0)

    crinkle = dsp.read('sounds/s/crinkle.wav').data
    glass1 = dsp.read('sounds/s/glass1.wav').data
    glass2 = dsp.read('sounds/s/glass2.wav').data
    toys = dsp.read('sounds/s/rolling.wav').data

    c = dsp.vsplit(crinkle, dsp.mstf(10), dsp.stf(3))
    c = dsp.randshuffle(c)
    c = c[:40]
    c = [dsp.pan(cc, dsp.rand()) for cc in c]
    c = [dsp.env(cc, 'sine') for cc in c]
    c = [dsp.transpose(cc, dsp.rand(0.25, 0.5)) for cc in c]

    t = dsp.vsplit(toys, dsp.mstf(10), dsp.stf(1))
    t = dsp.randshuffle(t)
    t = t[:40]
    t = [dsp.amp(tt, dsp.rand(0.1, 0.8)) for tt in t]
    t = [dsp.pan(tt, dsp.rand(0, 1)) for tt in t]
    t = [dsp.env(tt, 'sine') for tt in t]
    t = [dsp.transpose(tt, 0.5) for tt in t]

    g = dsp.vsplit(glass2, dsp.mstf(1), dsp.mstf(100))
    g = dsp.randshuffle(g)
    g = g[:40]
    g = [dsp.amp(gg, dsp.rand(0.35, 0.95)) for gg in g]
    g = [dsp.transpose(gg, dsp.rand(0.5, 1.75)) for gg in g]
    g = [gg * dsp.randint(1, 8) for gg in g]

    things = [c, t, g]

    out = [
        dsp.mix([
            dsp.randchoose(dsp.randchoose(things))
            for l in range(dsp.randint(2, 4))
        ]) for i in range(4)
    ]
    out = ''.join(out)

    dsp.log('voice %s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out))))

    return out
Exemplo n.º 23
0
def play(ctl):
    snd = dsp.read('/home/hecanjog/sounds/guitarpluck.wav').data

    #out = fx.rb(snd, interval=dsp.randint(0, 8) * 2, length=dsp.stf(0.25), formant=False)
    snd = dsp.transpose(snd, 0.968)
    out = dsp.stretch(snd, length=dsp.stf(dsp.rand(12, 15)), grain_size=120)
    out = dsp.env(out, 'hann')

    return out
Exemplo n.º 24
0
    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
Exemplo n.º 25
0
def makePaper(out):
    tail = dsp.cut(paper, dsp.mstf(60), dsp.flen(out) - dsp.mstf(60))

    tail = [ dsp.transpose(tail, dsp.rand(0.95, 1.05)) for _ in range(dsp.randint(3,6)) ]
    tail = [ fx.penv(t) for t in tail ]

    out = dsp.mix(tail + [ out ])
    
    return out
Exemplo n.º 26
0
    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
Exemplo n.º 27
0
def makeSnare(length, i):
    burst = dsp.bln(length, dsp.rand(400, 800), dsp.rand(8000, 10000))
    burst = dsp.env(burst, 'phasor')
    s = dsp.mix([snare, burst])
    s = dsp.transpose(s, dsp.rand(0.9, 1.1))

    s = dsp.fill(s, length, silence=True)

    return dsp.taper(s, 40)
Exemplo n.º 28
0
    def makeNote(length, note, degree=1):
        speed = tune.terry[tune.major[degree - 1]]
        speed = speed[0] / speed[1]

        note = dsp.transpose(note, speed)
        note = dsp.fill(note, length, silence=True)
        note = dsp.taper(note, dsp.mstf(10))

        return note
Exemplo n.º 29
0
def make(length, i):
    #burst = dsp.bln(length, dsp.rand(400, 800), dsp.rand(8000, 10000))
    #burst = dsp.env(burst, 'phasor')
    #s = dsp.mix([snare, burst])
    s = snare
    s = dsp.transpose(s, dsp.rand(0.9, 1.1))

    s = dsp.fill(s, length, silence=True)

    return dsp.taper(s, 40)
Exemplo n.º 30
0
def sing(lyrics, freqs, speed=0, voice='english'):
    """ sing it mad slow in chords """
    out = speak(lyrics, speed, voice)
    layers = []

    for freq in freqs:
        layer = dsp.transpose(out, 0.25)
        layer = dsp.pine(layer, dsp.flen(layer) * 4, freq)

        slop = int(dsp.flen(layer) * 0.12)
        layer = dsp.cut(layer, slop, dsp.flen(layer) - (slop * 2))

        layer = dsp.transpose(layer, 4)
        layer = dsp.pan(layer, dsp.rand())
        layer = dsp.amp(layer, 0.5)
        layers += [ layer ]

    out = dsp.mix(layers)

    return out
Exemplo n.º 31
0
def slurp(snd):
    snd = dsp.split(snd, dsp.flen(snd) / 100)
    numcycles = len(snd)
    curve_a = dsp.breakpoint([1.0] + [dsp.rand(0.1, 1.0) for r in range(dsp.randint(2, 10))] + [0], numcycles)
    curve_b = dsp.wavetable('cos', numcycles)
    wtable = [ curve_a[i] * curve_b[i] for i in range(numcycles) ]
    wtable = [ math.fabs((f * 5) + 0.75) for f in wtable ]

    snd = [ dsp.transpose(snd[i], wtable[i]) for i in range(numcycles) ]

    return ''.join(snd)
Exemplo n.º 32
0
def play(voice_id):
    bpm = C('bpm')
    beat = dsp.bpm2frames(bpm)
    volume = P(voice_id, 'volume', default=1.0)

    crinkle = dsp.read('sounds/s/crinkle.wav').data
    glass1 = dsp.read('sounds/s/glass1.wav').data
    glass2 = dsp.read('sounds/s/glass2.wav').data
    toys = dsp.read('sounds/s/rolling.wav').data

    c = dsp.vsplit(crinkle, dsp.mstf(10), dsp.stf(3))
    c = dsp.randshuffle(c)
    c = c[:40]
    c = [ dsp.pan(cc, dsp.rand()) for cc in c ]
    c = [ dsp.env(cc, 'sine') for cc in c ]
    c = [ dsp.transpose(cc, dsp.rand(0.25, 0.5)) for cc in c ]

    t = dsp.vsplit(toys, dsp.mstf(10), dsp.stf(1))
    t = dsp.randshuffle(t)
    t = t[:40]
    t = [ dsp.amp(tt, dsp.rand(0.1, 0.8)) for tt in t ]
    t = [ dsp.pan(tt, dsp.rand(0, 1)) for tt in t ]
    t = [ dsp.env(tt, 'sine') for tt in t ]
    t = [ dsp.transpose(tt, 0.5) for tt in t ]

    g = dsp.vsplit(glass2, dsp.mstf(1), dsp.mstf(100))
    g = dsp.randshuffle(g)
    g = g[:40]
    g = [ dsp.amp(gg, dsp.rand(0.35, 0.95)) for gg in g ]
    g = [ dsp.transpose(gg, dsp.rand(0.5, 1.75)) for gg in g ]
    g = [ gg * dsp.randint(1, 8) for gg in g ]

    things = [c,t,g]

    out = [ dsp.mix([ dsp.randchoose(dsp.randchoose(things)) for l in range(dsp.randint(2, 4)) ]) for i in range(4) ]
    out = ''.join(out)

    dsp.log('voice %s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out))))

    return out
Exemplo n.º 33
0
def play(voice_id):
    volume = P(voice_id, 'volume', 100.0)
    volume = volume / 100.0 # TODO: move into param filter
    volume = volume * 0.65
    length = P(voice_id, 'length', 40)
    env    = False
    wii    = False
#    wii    = True

    speed  = False
    
    numcycles = dsp.randint(1, 200)

    # Make breakpoint env with 2-10 vals between 0.1 and 1.0
    curve_a = dsp.breakpoint([1.0] + [dsp.rand(0.1, 1.0) for r in range(dsp.randint(2, 10))] + [0], numcycles)

    # Make wavetable with single cycle from given wave types
    curve_types = ['vary', 'phasor', 'sine', 'cos', 'impulse']
    curve_b = dsp.wavetable(dsp.randchoose(curve_types), numcycles)

    # Make pan curve - always cosine
    pan = dsp.breakpoint([ dsp.rand() for i in range(dsp.randint(5, 50)) ], numcycles)
    amps = dsp.breakpoint([ dsp.rand(0.1, 0.75) for i in range(dsp.randint(5, 30)) ], numcycles)

    # Multiply breakpoint curve with simple wavetable
    wtable = [ curve_a[i] * curve_b[i] for i in range(numcycles) ]

    # Scale to max frequency
    wtable = [ (f * 20000) + length for f in wtable ]

    # Possible osc wavetypes
    wtypes = ['sine2pi']
#    wtypes = ['tri', 'sine2pi', 'impulse']
#    wtypes = ['impulse', 'tri', 'cos', 'sine2pi', 'vary']

    if wii is True:
        out = [ dsp.pan(dsp.cycle(wtable[i], dsp.randchoose(wtypes)), pan[i]) for i in range(numcycles) ]
    else:
        wtype = dsp.randchoose(wtypes)
        out = [ dsp.pan(dsp.cycle(wtable[i], wtype), pan[i]) for i in range(numcycles) ]

    out = [ dsp.amp(oo, amps[i]) for i, oo in enumerate(out) ]

    out = dsp.amp(''.join(out), volume)

    if speed != False and speed > 0.0:
        out = dsp.transpose(out, speed)

    if env != False:
        out = dsp.env(out, env)

    return out
Exemplo n.º 34
0
def speak(lyrics, speed=0.5, voice='icelandic', pitch=1):
    speed = int(speed * 370 + 80)

    pitch = math.floor(pitch * 99.0)

    cmd = 'espeak -s %s -a 200 -v %s -p %s --stdout -z "%s"' % (speed, voice, pitch, lyrics)

    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
    out, err = p.communicate()
    out = dsp.transpose(out, 0.5, 1)
    out = dsp.stereo(out)

    return out
Exemplo n.º 35
0
    def makeKicks(length, wobble):
        out = Tracks()
        onsets = makeOnsets(length, wobble, 2, 4, True)
        kick = dsp.taper(k, 20)
        kick = dsp.transpose(kick, dsp.rand(1, 2))

        for onset in onsets:
            out.add(kick, onset)

        out = out.mix()

        out = dsp.fill(out, length, silence=False)
        return dsp.taper(out, 40)
Exemplo n.º 36
0
def bend(snd, freqs=None, amount=0.02):
    out = dsp.split(snd, 441)

    if freqs is None:
        freqs = dsp.wavetable('sine', len(out))
    else:
        freqs = dsp.breakpoint(freqs, len(out))

    freqs = [ freq * amount + (1 - (amount * 0.5)) for freq in freqs ]

    out = [ dsp.transpose(grain, freq) for grain, freq in zip(out, freqs) ]

    return ''.join(out)
Exemplo n.º 37
0
    def makeKicks(length, wobble):
        out = Tracks()
        onsets = makeOnsets(length, wobble, 2, 4, True)
        kick = dsp.taper(k, 20)
        kick = dsp.transpose(kick, dsp.rand(1, 2))

        for onset in onsets:
            out.add(kick, onset)

        out = out.mix()

        out = dsp.fill(out, length, silence=False)
        return dsp.taper(out, 40)
Exemplo n.º 38
0
def slurp(snd):
    snd = dsp.split(snd, dsp.flen(snd) / 100)
    numcycles = len(snd)
    curve_a = dsp.breakpoint(
        [1.0] + [dsp.rand(0.1, 1.0) for r in range(dsp.randint(2, 10))] + [0],
        numcycles)
    curve_b = dsp.wavetable('cos', numcycles)
    wtable = [curve_a[i] * curve_b[i] for i in range(numcycles)]
    wtable = [math.fabs((f * 5) + 0.75) for f in wtable]

    snd = [dsp.transpose(snd[i], wtable[i]) for i in range(numcycles)]

    return ''.join(snd)
Exemplo n.º 39
0
    def clap1(beat):
        c = dsp.read('sounds/mikeclap.wav').data
        c = dsp.transpose(c, dsp.rand(1, 2.5))
        c = dsp.fill(c, dsp.mstf(dsp.rand(10, 100)))
        c = dsp.env(c, 'phasor')
        c = dsp.amp(c, dsp.rand(1, 3))
        c = dsp.pad(c, 0, beat - dsp.flen(c))

        blen = beat / dsp.randchoose([1, 2])
        c = dsp.pad(c, blen, 0)

        c *= 4

        return c
Exemplo n.º 40
0
    def clap1(beat):
        c = dsp.read('sounds/mikeclap.wav').data
        c = dsp.transpose(c, dsp.rand(1, 2.5))
        c = dsp.fill(c, dsp.mstf(dsp.rand(10, 100)))
        c = dsp.env(c, 'phasor')
        c = dsp.amp(c, dsp.rand(1, 3))
        c = dsp.pad(c, 0, beat - dsp.flen(c))

        blen = beat / dsp.randchoose([1,2])
        c = dsp.pad(c, blen, 0)

        c *= 4

        return c
Exemplo n.º 41
0
def play(ctl):
    bell = dsp.read('sounds/bell.wav').data
    bell = dsp.transpose(bell, dsp.randchoose([0.125, 0.25, 0.5, 1, 2]))

    chime = dsp.read('sounds/chime.wav').data
    chime = dsp.transpose(chime, dsp.randchoose([0.125, 0.25, 0.5, 1, 2]))

    note = dsp.mix([ bell, chime ])

    def makeNote(length, note, degree=1):
        speed = tune.terry[tune.major[degree - 1]]
        speed = speed[0] / speed[1]

        note = dsp.transpose(note, speed)
        note = dsp.fill(note, length, silence=True)
        note = dsp.taper(note, dsp.mstf(10))

        return note

    scale = [ dsp.randchoose([1,5,6]) for s in range(4) ] * 3

    out = ''.join([ makeNote(dsp.mstf(dsp.rand(10, 500)), note, d) for d in scale ])

    return out
Exemplo n.º 42
0
def play(ctl):
    pianos = ['sawvib', 'piano', 'pianooct1', 'harp', 'saw']
    pianos = ['sawvib', 'piano']
    piano = snds.load('genie/%s.wav' % dsp.randchoose(pianos))
    notes = [1,3,5]
    chord = tune.fromdegrees([ dsp.randchoose(notes) + (dsp.randchoose([0, 1]) * 8) for _ in range(dsp.randint(1, 3)) ], octave=0)
    length = dsp.stf(dsp.rand(1, 4))

    layers = []

    for freq in chord:
        p = dsp.transpose(piano, freq / 220.0)
        p = dsp.amp(p, 0.35)
        #p = dsp.pan(p, dsp.rand())
        p = dsp.fill(p, length)

        if dsp.rand() > 0.25:
            p = dsp.vsplit(p, dsp.mstf(100), dsp.mstf(500))
            p = [ dsp.pan(pp, dsp.rand()) for pp in p ]
            p = [ dsp.amp(pp, dsp.rand(0,2)) for pp in p ]
            p = [ dsp.transpose(pp, dsp.randchoose([1,2,4,8])) for pp in p ]
            p = [ dsp.taper(pp, 20) for pp in p ]
            p = [ dsp.pad(pp, 0, dsp.mstf(dsp.rand(0, 100))) for pp in p ]
            p = dsp.randshuffle(p)
            p = ''.join(p)

        if dsp.rand() > 0.75:
            p = dsp.alias(p)

        #p = dsp.env(p, 'phasor')

        layers += [ p ]

    out = dsp.mix(layers)

    return out
Exemplo n.º 43
0
    def hat(beat):
        length = beat * 4
        nbeats = 16
        blen = length / nbeats

        out = ''

        for b in range(nbeats):
            h = dsp.transpose(tape1, 9)
            h = dsp.fill(h, dsp.mstf(dsp.rand(1, 20)))
            h = dsp.env(h, 'phasor')
            h = dsp.amp(h, dsp.rand(0, 0.8))
            h = dsp.pad(h, 0, blen - dsp.flen(h))

            out += h

        out *= 8

        return out
Exemplo n.º 44
0
def fracture(snd):
    numpoints = dsp.randint(3, 20)
    poscurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0],
                              numpoints)
    poscurve = [p * (dsp.flen(snd) - dsp.mstf(210)) for p in poscurve]

    lencurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0],
                              numpoints)
    lencurve = [l * dsp.mstf(200) + dsp.mstf(10) for l in lencurve]

    pancurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0],
                              numpoints)

    prepadcurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0],
                                 numpoints)
    prepadcurve = [int(p * dsp.mstf(20)) for p in prepadcurve]

    postpadcurve = dsp.breakpoint([0] + [dsp.rand() for i in range(4)] + [0],
                                  numpoints)
    postpadcurve = [int(p * dsp.mstf(20)) for p in postpadcurve]

    speeds = [1.0, 2.0, 0.5, 0.75]

    grains = [dsp.cut(snd, poscurve[i], lencurve[i]) for i in range(numpoints)]
    grains = [dsp.pan(grains[i], pancurve[i]) for i in range(numpoints)]
    grains = [dsp.env(grain, 'gauss', True) for grain in grains]
    grains = [dsp.transpose(grain, dsp.randchoose(speeds)) for grain in grains]
    grains = [
        dsp.pad(grains[i], prepadcurve[i], postpadcurve[i])
        for i in range(numpoints)
    ]

    for i in range(numpoints):
        if dsp.randint(0, 3) == 0:
            grains[i] = slurp(grains[i])

    etypes = ['line', 'phasor', 'tri', 'sine', 'gauss']

    snd = dsp.env(''.join(grains), dsp.randchoose(etypes))
    snd = dsp.pad(snd, 0, dsp.mstf(dsp.rand(100, 400)))

    return snd
Exemplo n.º 45
0
def make(length, i):
    r = dsp.transpose(guitar, getRatio(scale[i % len(scale)]))
    r = dsp.mix([
        dsp.pan(r, dsp.rand()),
        dsp.drift(dsp.pan(r, dsp.rand()), dsp.rand(0.001, 0.02))
    ])

    if dsp.rand() > 0.5:
        r = dsp.alias(r)

    if dsp.rand() > 0.5:
        r = dsp.split(r, dsp.flen(r) / dsp.randint(2, 5))
        r = dsp.randshuffle(r)
        r = ''.join(r)

    r = dsp.amp(r, dsp.rand(0.1, 0.75))

    g = dsp.fill(r, length, silence=True)

    return g
Exemplo n.º 46
0
def play(voice_id):
    volume = P(voice_id, 'volume', 100.0)
    volume = volume / 100.0  # TODO: move into param filter
    volume = volume * 0.65
    length = P(voice_id, 'length', 40)
    env = False
    wii = False
    #    wii    = True

    speed = False

    numcycles = dsp.randint(1, 200)

    # Make breakpoint env with 2-10 vals between 0.1 and 1.0
    curve_a = dsp.breakpoint(
        [1.0] + [dsp.rand(0.1, 1.0) for r in range(dsp.randint(2, 10))] + [0],
        numcycles)

    # Make wavetable with single cycle from given wave types
    curve_types = ['vary', 'phasor', 'sine', 'cos', 'impulse']
    curve_b = dsp.wavetable(dsp.randchoose(curve_types), numcycles)

    # Make pan curve - always cosine
    pan = dsp.breakpoint([dsp.rand() for i in range(dsp.randint(5, 50))],
                         numcycles)
    amps = dsp.breakpoint(
        [dsp.rand(0.1, 0.75) for i in range(dsp.randint(5, 30))], numcycles)

    # Multiply breakpoint curve with simple wavetable
    wtable = [curve_a[i] * curve_b[i] for i in range(numcycles)]

    # Scale to max frequency
    wtable = [(f * 20000) + length for f in wtable]

    # Possible osc wavetypes
    wtypes = ['sine2pi']
    #    wtypes = ['tri', 'sine2pi', 'impulse']
    #    wtypes = ['impulse', 'tri', 'cos', 'sine2pi', 'vary']

    if wii is True:
        out = [
            dsp.pan(dsp.cycle(wtable[i], dsp.randchoose(wtypes)), pan[i])
            for i in range(numcycles)
        ]
    else:
        wtype = dsp.randchoose(wtypes)
        out = [
            dsp.pan(dsp.cycle(wtable[i], wtype), pan[i])
            for i in range(numcycles)
        ]

    out = [dsp.amp(oo, amps[i]) for i, oo in enumerate(out)]

    out = dsp.amp(''.join(out), volume)

    if speed != False and speed > 0.0:
        out = dsp.transpose(out, speed)

    if env != False:
        out = dsp.env(out, env)

    return out
Exemplo n.º 47
0
##########

layers = []
nlayers = 3
length = dsp.stf(120)

for _ in range(nlayers):
    frags = []
    elapsed = 0

    while elapsed < length:
        # pick a fragment
        g = dsp.randchoose(guitars)

        # transpose to A
        g = dsp.transpose(g, 1.125)

        # rand octave or 5th transpose
        g = dsp.transpose(g, dsp.randchoose([1, 1.5, 2]))

        # slice fragment btwn 60ms and 1/2 frag length
        fraglen = dsp.mstf(dsp.rand(60, dsp.flen(g) / 2))
        pos = dsp.randint(0, dsp.flen(g) - fraglen)
        g = dsp.cut(g, pos, fraglen)

        # attenuate
        g = dsp.amp(g, dsp.rand(0.1, 0.5))

        # randomly pan
        g = dsp.pan(g, dsp.rand())
Exemplo n.º 48
0
from pippi import tune
import glob
import drums
import rhodes

speeds = [1.0, 1.5, 2.0]
scale = tune.fromdegrees([1, 4, 5, 3, 6, 8, 9], octave=2, root='e')
envs = ['line', 'tri', 'hann', 'phasor', 'impulse']
wforms = ['tri', 'saw', 'impulse', 'square']

notes = [rhodes.rhodes(dsp.stf(dsp.rand(4, 7)), freq, 0.3) for freq in scale]

layer = [dsp.randchoose(notes) for i in range(40)]
layer = [dsp.pan(note, dsp.rand()) for note in layer]
layer = [dsp.amp(note, dsp.rand(0.1, 0.7)) for note in layer]
layer = [dsp.transpose(note, dsp.randchoose(speeds)) for note in layer]
layer = [dsp.pad(note, 0, dsp.mstf(dsp.rand(500, 2000))) for note in layer]
layer = ''.join(layer)

out = ''

themes = [[dsp.transpose(note, dsp.randchoose(speeds)) for note in notes * 2]
          for theme in range(8)]

arpsPlay, leadPlay, hatsPlay, blipsPlay, foldsPlay, kicksPlay, clapsPlay, bassPlay, themePlay = 0, 0, 0, 0, 0, 0, 0, 0, 0

intro_drone_pad_length, intro_drone_length, outro_drone_pad_length, outro_drone_length = 0, 0, 0, 0

vary_sections = [dsp.randint(7, 12) for vs in range(2)]

Exemplo n.º 49
0
main = dsp.read('base_loop.wav').data
synth = dsp.read('synthloop.wav').data
beat = dsp.flen(main) / 128

freq = 430
s = dsp.pine(synth, dsp.flen(main) * 8, freq)
s = dsp.split(s, beat)
s = dsp.randshuffle(s)
s = [dsp.alias(ss) for ss in s]
s = [dsp.amp(ss, dsp.rand(0.5, 2)) 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.split(synth, beat)
s2 = dsp.randshuffle(s2)
s2 = [dsp.transpose(ss, dsp.randchoose([1, 2, 4])) for ss in s2]
s2 = [dsp.fill(ss, beat) for ss in s2]
s2 = [dsp.env(ss, 'phasor') for ss in s2]
s2 = ''.join(s2)

synth = dsp.mix([s, s2])
synth = dsp.fill(synth, dsp.flen(main))

#synth = dsp.fill(synth, dsp.flen(main))

out = dsp.mix([main, synth])
#out = synth

dsp.write(out, 'newloop')
Exemplo n.º 50
0
from pippi import dsp, tune
from hcj import snds, keys

key = 'g'

rhodes = snds.load('hcj/rhodes1.wav')
rhodes = dsp.transpose(rhodes, 16.0 / 15.0)


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 makeStab(length, i):
    freqs = tune.fromdegrees([
        dsp.randchoose([1, 2, 3, 4, 5, 6, 8]) for _ in range(dsp.randint(2, 4))
    ],
                             octave=3,
                             root=key)
    stab = chord(length, freqs, dsp.rand(0.25, 0.75))
    stab = dsp.taper(stab, 40)
    stab = dsp.fill(stab, length, silence=True)

    return stab

Exemplo n.º 51
0
def play(voice_id):
    bpm = config('bpm')
    beat = dsp.bpm2frames(bpm)
    dsl = P(voice_id, 'drum', '["c","k","h"]')
    dsp.log(dsl)
    dsl = json.loads(dsl)

    def hat(beat):
        length = beat * 4
        nbeats = 16
        blen = length / nbeats

        out = ''

        for b in range(nbeats):
            h = dsp.transpose(tape1, 9)
            h = dsp.fill(h, dsp.mstf(dsp.rand(1, 20)))
            h = dsp.env(h, 'phasor')
            h = dsp.amp(h, dsp.rand(0, 0.8))
            h = dsp.pad(h, 0, blen - dsp.flen(h))

            out += h

        out *= 8

        return out

    def kick(beat):
        out = drums.sinekick(length=beat, amp=dsp.rand(0.8, 1))
        out = dsp.pad(out, 0, beat * dsp.randint(1, 2))
        out *= 2
        return out

    def clap1(beat):
        c = dsp.read('sounds/mikeclap.wav').data
        c = dsp.transpose(c, dsp.rand(1, 2.5))
        c = dsp.fill(c, dsp.mstf(dsp.rand(10, 100)))
        c = dsp.env(c, 'phasor')
        c = dsp.amp(c, dsp.rand(1, 3))
        c = dsp.pad(c, 0, beat - dsp.flen(c))

        blen = beat / dsp.randchoose([1, 2])
        c = dsp.pad(c, blen, 0)

        c *= 4

        return c

    def clap2(beat):
        nlens = [
            beat * 2,
            beat,
            beat / 2,
        ]

        # length of pattern (in beats)
        nbeats = dsp.randint(10, 15)

        # beat lengths (from a set of bpm-derived note lengths defined in the nlens list)
        blens = [dsp.randchoose(nlens) for b in range(nbeats)]

        out = ''

        # synthesize the tones
        for i in range(nbeats):
            beat = dsp.transpose(dsp.randchoose([c1, c2]),
                                 dsp.rand(0.25, 40.0))
            beat = dsp.pad(beat, 0, blens[i] - dsp.flen(beat))
            beat = dsp.amp(beat, dsp.rand(1, 4))

            # add it to the output
            out += beat

        return out

    all = []

    if 'c' in dsl:
        clapper = dsp.randchoose([clap1, clap2])
        all += [clapper(beat)]

    if 'k' in dsl:
        all += [kick(beat)]

    if 'h' in dsl:
        all += [hat(beat)]

    out = dsp.mix(all)

    #    out = dsp.vsplit(out, dsp.mstf(dsp.rand(8, 140)), dsp.mstf(500))
    #    out = dsp.randshuffle(out)
    #    out = ''.join(out)

    out = dsp.vsplit(out, 10, 1000)
    out = [dsp.amp(o, dsp.rand(0, 4)) for o in out]
    out = [dsp.env(o, 'random') for o in out]
    out = [dsp.transpose(o, dsp.rand(0.25, 1)) for o in out]
    out = dsp.randshuffle(out)
    out = ''.join(out)

    out = dsp.pine(out, int(dsp.flen(out) * dsp.rand(1.5, 4)),
                   dsp.rand(10, 2000), dsp.randint(0, 2), dsp.rand(1, 3),
                   dsp.randint(0, 2), dsp.rand(1, 3))
    out = dsp.amp(out, 0.65)

    glass = dsp.read('sounds/s/glass2.wav').data

    glass = dsp.vsplit(glass, dsp.mstf(1), dsp.mstf(100))
    glass = dsp.randshuffle(glass)
    #    glass = [ dsp.pad(g, 0, dsp.randint(10, 1000)) for g in glass ]
    #    glass = [ dsp.transpose(g, dsp.rand(0.5, 1.5)) * dsp.randint(1, 3) for g in glass ]
    glass = ''.join(glass)

    glass = dsp.fill(glass, dsp.flen(out))

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

    return out
Exemplo n.º 52
0
from pippi import dsp, tune
from hcj import snds

guitar = snds.load('hcj/guitar1.wav')
guitar = dsp.transpose(guitar, 0.711)  # transpose from Db to G


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


def getRatio(degree, ratios=tune.terry, scale=tune.major):
    ratio = ratios[scale[(degree - 1) % len(scale)]]
    return ratio[0] / ratio[1]


def make(length, i):
    r = dsp.transpose(guitar, getRatio(scale[i % len(scale)]))
    r = dsp.mix([
        dsp.pan(r, dsp.rand()),
        dsp.drift(dsp.pan(r, dsp.rand()), dsp.rand(0.001, 0.02))
    ])

    if dsp.rand() > 0.5:
Exemplo n.º 53
0
def play(ctl):
    param = ctl.get('param')
    lpd = ctl.get('midi').get('lpd')

    scale = [ dsp.randchoose([1, 3, 5, 6, 8]) for s in range(dsp.randint(2, 4)) ]
    #scale = [ dsp.randchoose([1, 2, 4, 6, 8]) for s in range(dsp.randint(2, 4)) ]

    freqs = tune.fromdegrees(scale, root='a', octave=dsp.randint(2,3), scale=tune.minor)
    freq = dsp.randchoose(freqs)

    pw = lpd.get(2, low=0.01, high=1, default=1)
    pw = dsp.rand(0.01, 1)
    modr = lpd.get(6, low=0.001, high=0.1)
    modr = dsp.rand(0.001, 0.05)
    #modr = dsp.rand(0.1, 10.5)
    #modr = dsp.rand(0.001, 0.01)
    modr = dsp.rand(0, modr)
    modf = dsp.rand(0.01, 0.05)
    amp = lpd.get(1, low=0, high=2, default=0)
    #amp = dsp.rand(0.1, 0.5)
    #amp = 0

    length = dsp.stf(lpd.get(5, low=0.5, high=14, default=1) * dsp.rand(0.75, 2))
    length = dsp.stf(dsp.rand(5.5, 24) * dsp.rand(0.75, 2))
    #length = dsp.stf(dsp.rand(0.5, 0.75) * dsp.rand(0.75, 2))

    wf = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for w in range(10) ] + [0], 512)
    #wf = dsp.wavetable('sine2pi', 512)
    #wf = dsp.wavetable('sine2pi', 512)
    #win = dsp.wavetable('sine', 512)
    win = dsp.breakpoint([0] + [ dsp.rand(0, 1) for w in range(5) ] + [0], 512)
    mod = dsp.breakpoint([0] + [ dsp.rand(0, 1) for m in range(5) ] + [0], 512)

    layers = []

    harmonics = [1, 2, 3, 4]

    for harmonic in harmonics:
        f = freq * harmonic
        if harmonic > 4:
            a = dsp.rand(0.05, 0.1)
        else:
            a = amp * dsp.rand(0.1, 0.5)

        layer = dsp.pulsar(f, length, pw, wf, win, mod, modr, modf, a * 2)
        layer = dsp.env(layer, dsp.randchoose(['sine', 'tri', 'line', 'phasor']))
        layer = dsp.taper(layer)
        layer = dsp.pan(layer, dsp.rand())
        layer = dsp.mix([ dsp.drift(layer, dsp.rand(0.01, 0.03)), layer ])

        if dsp.rand() > 0.5:
            layer = dsp.vsplit(layer, dsp.mstf(50), dsp.mstf(500))
            bit = dsp.randchoose(layer)
            bit = bit * dsp.randint(1, 3)
            bit = dsp.transpose(bit, dsp.randchoose([1, 2, 4, 8]))
            layer = ''.join(layer)
            layer = dsp.insert_into(layer, bit, dsp.randint(0, dsp.flen(layer) - dsp.flen(bit)))

        layers += [ layer ]

    out = dsp.mix(layers)
    out = dsp.env(out, 'sine')
    out = dsp.env(out, 'hann')
    #out = dsp.env(out, 'phasor')
    out = dsp.taper(out)

    return out