コード例 #1
0
ファイル: safari.py プロジェクト: hecanjog/hcj.py
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
コード例 #2
0
ファイル: fx.py プロジェクト: hecanjog/hcj.py
def spider(snd, numlayers=10, numgrains=20, minlen=40, lenranges=(300,500), reverse=False, env='hann'):
    layers = []

    for layer in range(numlayers):
        lenrange = dsp.rand(lenranges[0], lenranges[1])

        if reverse:
            lengths = dsp.wavetable(env, numgrains * 2)[numgrains:]
        else:
            lengths = dsp.wavetable(env, numgrains * 2)[:numgrains]

        lengths = [ dsp.mstf(l * lenrange + minlen) for l in lengths ]
        pans = dsp.breakpoint([ dsp.rand() for p in range(numgrains / 3)], numgrains)

        startpoint = dsp.randint(0, dsp.flen(snd) - max(lengths))
    
        grains = ''

        for l, p in zip(lengths, pans):
            grain = dsp.cut(snd, startpoint, l)
            grain = dsp.env(grain, 'phasor')
            grain = dsp.taper(grain, dsp.mstf(10))
            grain = dsp.pan(grain, p)
            
            grains += grain

        if reverse:
            layers += [ dsp.env(grains, 'line') ]
        else:
            layers += [ dsp.env(grains, 'phasor') ]

    return dsp.mix(layers)
コード例 #3
0
ファイル: drums.py プロジェクト: hecanjog/hcj.py
def roll(snd, length=None, numlayers=2, minlen=10, maxlen=80, env=True, bend=True):
    layers = []

    for _ in range(numlayers):
        if length is None:
            numbeats = dsp.randint(20, 50)
        else:
            numbeats = length / dsp.mstf(minlen)

        lengths = dsp.breakpoint([ dsp.rand(minlen, maxlen) for _ in range(dsp.randint(5, numbeats/2)) ], numbeats)

        layer = ''
        for l in lengths:
            layer += dsp.fill(snd, dsp.mstf(l), silence=True)

        if bend:
            layer = fx.bend(layer, [ dsp.rand(0, 1) for _ in range(dsp.randint(5, 20)) ], dsp.rand(0.02, 1))

        if env:
            layer = fx.penv(layer)

        layers += [ layer ]

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

    return out
コード例 #4
0
ファイル: boone.py プロジェクト: hecanjog/nomadpalace-wmse
def play(voice_id):
    tel = bot.getTel()

    degrees = [ dsp.randchoose([1, 2, 3, 5, 6, 8]) for f in range(dsp.randint(2, 20)) ]
    #degrees = [ dsp.randchoose([1, 5, 6, 7, 8]) for f in range(dsp.randint(2, 10)) ]

    octave = dsp.randint(1, 4)

    freqs = tune.fromdegrees(degrees, root='c', octave=octave, ratios=tune.terry)

    out = ''

    for r in range(dsp.randint(2, 20)):
        freq = dsp.randchoose(freqs)
        waveform = dsp.randchoose(['tri', 'sine2pi'])

        length = dsp.randint(dsp.mstf(1), dsp.mstf(4000))
        #length = dsp.mstf(1500)
        #length = dsp.mstf(2500)

        pulsewidth = dsp.rand(0.01, 1)

        mod = dsp.breakpoint([ dsp.rand() for b in range(int(round(tel['density'])) + 3) ], 512)
        window = dsp.breakpoint([0] + [ dsp.rand() for b in range(int(round(tel['harmonicity'] * 2)) + 3) ] + [0], 512)
        waveform = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for b in range(int(round(tel['roughness'] * dsp.randint(1, 4))) + 3) ] + [0], 512)

        modRange = dsp.rand(0.01, 100.08)

        modFreq = dsp.rand(0.0001, 5)

        volume = dsp.rand(0.2, 0.3) * (tel['density'] / 10.0)
        #volume = dsp.rand(0.2, 0.8)

        t = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, volume)
        #t = dsp.tone(length, freq, waveform)

        t = dsp.pan(t, dsp.rand())

        t = dsp.alias(t)

        t = dsp.amp(t, dsp.rand(0.5, 15.0))

        t = dsp.pad(t, 0, dsp.randint(dsp.mstf(1), dsp.mstf(10)))

        t = dsp.amp(t, dsp.rand(0.5, 0.95))

        t = dsp.env(t, 'sine')
        #t = dsp.env(t, 'phasor')

        #t = dsp.pine(t, dsp.flen(t) * 4, freq)

        out += t


    dsp.log('')
    dsp.log('boone')
    dsp.log('%s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out))))
    bot.show_telemetry(tel)

    return out
コード例 #5
0
ファイル: study.ix.py プロジェクト: hecanjog/pattern.studies
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
コード例 #6
0
ファイル: amber.py プロジェクト: lettersonsounds/amber
        def makeGrains(out, length=None, env=None):
            envs = ['tri', 'line', 'flat', 'sine', 'hann']
            out = dsp.vsplit(out, dsp.mstf(20), dsp.mstf(90))

            out = [dsp.env(grain, 'hann') for grain in out]
            out = [dsp.pan(grain, dsp.rand()) for grain in out]

            out = dsp.randshuffle(out)
            out = ''.join(out)
            out = dsp.env(out, dsp.randchoose(envs))

            return out
コード例 #7
0
ファイル: amber.py プロジェクト: lettersonsounds/amber
        def makeGrains(out, length=None, env=None):
            envs = ['tri', 'line', 'flat', 'sine', 'hann']
            out = dsp.vsplit(out, dsp.mstf(20), dsp.mstf(90))

            out = [ dsp.env(grain, 'hann') for grain in out ]
            out = [ dsp.pan(grain, dsp.rand()) for grain in out ]

            out = dsp.randshuffle(out)
            out = ''.join(out)
            out = dsp.env(out, dsp.randchoose(envs))

            return out
コード例 #8
0
ファイル: boing.py プロジェクト: hecanjog/geodes-minorg
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
コード例 #9
0
def play(voice_id):
    tel = bot.getTel()

    freqs = tune.fromdegrees([ dsp.randchoose([1, 2, 3, 5, 6, 8]) for f in range(dsp.randint(2, 5)) ], root='c', octave=dsp.randint(1, 3), ratios=tune.just)

    out = ''

    for freq in freqs:
        waveform = dsp.randchoose(['tri', 'sine2pi'])
        length = dsp.randint(dsp.mstf(10), dsp.mstf(300))
        #length = dsp.mstf(150)
        pulsewidth = dsp.rand()

        mod = dsp.breakpoint([ dsp.rand() for b in range(int(round(tel['density'])) + 3) ], 512)
        window = dsp.breakpoint([0] + [ dsp.rand() for b in range(int(round(tel['harmonicity'] * 2)) + 3) ] + [0], 512)
        waveform = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for b in range(int(round(tel['roughness'] * 3)) + 3) ] + [0], 512)

        modRange = 0.005
        modFreq = dsp.rand(0.0001, 5)

        volume = dsp.rand(0.2, 0.3)

        if dsp.rand(0, 100) > 50:
            t = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, volume)
        else:
            t = dsp.tone(length, freq, waveform)

        #t = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, volume)
        #t = dsp.tone(length, freq, waveform)

        t = dsp.pan(t, dsp.rand())
        t = dsp.alias(t)

        t = dsp.amp(t, dsp.rand(0.5, 5.0))

        t = dsp.pad(t, 0, dsp.randint(dsp.mstf(1), dsp.mstf(500)))
        #t = dsp.pad(t, 0, dsp.mstf(100))
        t = dsp.amp(t, dsp.rand(0.5, 0.75))

        #out += dsp.env(t, 'sine')
        out += t

    #out = dsp.env(t, 'sine')

    dsp.log('')
    dsp.log('boone')
    dsp.log('%s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out))))
    bot.show_telemetry(tel)

    return out
コード例 #10
0
ファイル: stream.py プロジェクト: hecanjog/hcj.py
def play(ctl):
    param = ctl.get('param')
    lpd = ctl.get('midi').get('lpd')

    idxWf = param.get('idxWf', default=0)
    idxWin = param.get('idxWin', default=0)
    idxMod = param.get('idxMod', default=0)
    
    freq = 220
    length = dsp.mstf(lpd.get(8, low=50, high=1000, default=100))
    pw = lpd.get(5, low=0.001, high=1, default=1)
    wf = dsp.wavetable('sine2pi', 512)
    win = dsp.wavetable('sine', 512)
    mod = dsp.wavetable('sine', 512)
    #mod = dsp.breakpoint([ dsp.rand(0, 1) for m in range(10) ], 512)
    #mod = dsp.wavetable('sine', 512)
    modr = lpd.get(6, low=0, high=1, default=0)
    modf = lpd.get(7, low=0.1, high=3, default=0.1)
    amp = 0.3

    idxWf, idxWin, idxMod, out = dsp.pulsarstream(freq, length, pw, wf, win, mod, modr, modf, amp, idxWf, idxWin, idxMod)

    #out = dsp.taper(out, dsp.mstf(2))

    param.set('idxWf', idxWf)
    param.set('idxWin', idxWin)
    param.set('idxMod', idxMod)

    return out
コード例 #11
0
ファイル: study.ix.py プロジェクト: hecanjog/pattern.studies
def makeBloop(length, i, bfreqs):
    bfreq = dsp.randchoose(bfreqs)

    if dsp.rand() > 0.5:
        blength = length if length <= dsp.mstf(80) else dsp.mstf(dsp.rand(40, 80))
    else:
        blength = length

    wf = dsp.breakpoint([0] + [ dsp.rand(-1,1) for _ in range(dsp.randint(8, 20)) ] + [0], 512)

    bloop = dsp.mix([ keys.pulsar(bf, blength, wf=wf, amp=dsp.rand(0.1, 0.5)) for bf in [ bfreq, bfreq / 2, bfreq * 2 ] ])
    bloop = dsp.env(bloop, 'phasor')

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

    return bloop
コード例 #12
0
ファイル: fx.py プロジェクト: hecanjog/hcj.py
def glitchStutter(snd):
    """ Basically a random gate """
    snd = dsp.vsplit(snd, dsp.mstf(1, 50), dsp.mstf(50, 200))

    for i, s in enumerate(snd):
        if dsp.rand() > dsp.rand(0.5, 0.9):
            s = dsp.amp(s, dsp.rand(0, 0.15))
            s = dsp.taper(s, 20)
            snd[i] = s
        else:
            s = dsp.amp(s, dsp.rand(0.85, 1))
            snd[i] = dsp.taper(s, 20)

    snd = ''.join(snd)

    return snd
コード例 #13
0
ファイル: pat.py プロジェクト: hecanjog/o-ou
def section():
    # Meter (beats per bar)
    meter = 5

    # Subdivision (of master beat)
    subdiv = 2

    # Bars
    bars = 8

    # Master tempo (ms)
    tempo = dsp.bpm2ms(200)

    # Longest beat (ms)
    long = (tempo / subdiv) * 1.2

    # Shortest beat (ms)
    short = tempo / subdiv

    # Beat delta (ms)
    delta = long - short

    num_beats = meter * bars * subdiv

    lengths = [ dsp.rand() for i in range(num_beats / 3) ]
    grid = dsp.breakpoint(lengths, num_beats)
    grid = [ dsp.mstf(beat * delta + short) for beat in grid ]

    # Break grid back up into bars
    grid = [ grid[index:index+(meter*2)] for index, beat in enumerate(grid) if index % (meter * 2) == 0 ]

    return grid
コード例 #14
0
ファイル: keys.py プロジェクト: hecanjog/hcj.py
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
コード例 #15
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)
コード例 #16
0
ファイル: 2015-03-08-scribble.py プロジェクト: hecanjog/haiku
def chirp():
    r = dsp.rand(3.6, 3.99)
    numpoints = dsp.randint(10, 30)

    freq = dsp.rand(200, 1000)
    slength = dsp.rand(0.05, 0.5)
    length = dsp.stf(slength)

    log = data.Logistic(r, size=numpoints)
    mod = dsp.breakpoint([0] + [dsp.rand()
                                for r in range(numpoints / 3)] + [0],
                         numpoints)
    mod = [p * log.get() for p in mod]
    modr = dsp.rand(1, 5)
    modf = 1.0 / slength

    wf = dsp.wavetable('sine2pi', 512)
    win = dsp.wavetable('sine', 512)
    pw = dsp.rand(0.5, 1)
    amp = dsp.rand(0.1, 0.3)

    out = dsp.pulsar(freq, length, pw, wf, win, mod, modr, modf, amp)
    out = dsp.env(out, 'random')
    out = dsp.taper(out, dsp.mstf(10))
    out = dsp.pan(out, dsp.rand())
    out = dsp.pad(out, 0, dsp.stf(dsp.rand(0.1, 0.3)))

    return out
コード例 #17
0
ファイル: jbutler.py プロジェクト: hecanjog/jbutler
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)
コード例 #18
0
ファイル: bells.py プロジェクト: hecanjog/geodes.py
def play(ctl):
    #out = snds.load('genie/piano.wav')

    lenrange = 300
    minlen = 1

    if dsp.rand() > 0.5:
        lengths = dsp.breakpoint([dsp.rand(0, 1) for _ in range(5)], 50)
    else:
        lengths = dsp.wavetable('sine', 50)

    lengths = [dsp.mstf(l * lenrange + minlen) for l in lengths]

    out = ''

    for length in lengths:
        freq = tune.ntf('f', octave=dsp.randint(2, 5))

        if dsp.rand() > 10.85:
            length = dsp.stf(dsp.rand(0.5, 3))
            freq = dsp.randchoose(
                tune.fromdegrees([1, 3, 4, 5, 6], octave=4, root='f'))

        out += keys.pulsar(freq=freq, length=length, env='phasor')

        if dsp.rand() > 10.75:
            freq = dsp.randchoose(
                tune.fromdegrees([1, 3, 4, 5, 6], octave=4, root='f'))

    return out
コード例 #19
0
ファイル: jbutler.py プロジェクト: hecanjog/jbutler
def smear(snd):
    snd = dsp.split(snd, dsp.mstf(dsp.rand(5000, 10000)))
    snd = dsp.randshuffle(snd)
    snd = [ dsp.env(s) for s in snd ]
    snd = [ s * dsp.randint(1, 8) for s in snd ]

    return dsp.drift(''.join(snd), dsp.rand(0.01, 0.1))
コード例 #20
0
ファイル: pat-score.py プロジェクト: hecanjog/buchla-score
def make_pulse(snd):
    snd_len = dsp.flen(snd)
    blip = dsp.cut(snd, 0, dsp.mstf(10))
    blip = dsp.env(blip, 'sine')
    blip = dsp.pad(blip, 0, snd_len - dsp.flen(blip))

    return blip
コード例 #21
0
ファイル: climbing.py プロジェクト: hecanjog/geodes.py
def makeSnare(length, i, amp):
    s = dsp.cut(snare, 0, dsp.randint(dsp.mstf(40), dsp.flen(snare)))
    s = dsp.alias(s, dsp.randint(4, 12))
    s = dsp.taper(s)
    s = dsp.fill(s, length, silence=True)
    s = dsp.amp(s, dsp.rand(2, 4))
    return s
コード例 #22
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)
コード例 #23
0
def smear(snd):
    snd = dsp.split(snd, dsp.mstf(dsp.rand(5000, 10000)))
    snd = dsp.randshuffle(snd)
    snd = [dsp.env(s) for s in snd]
    snd = [s * dsp.randint(1, 8) for s in snd]

    return dsp.drift(''.join(snd), dsp.rand(0.01, 0.1))
コード例 #24
0
ファイル: curvebeats.py プロジェクト: hecanjog/sketches
def makeSnare(length, i, amp):
    s = dsp.cut(snare, 0, dsp.randint(dsp.mstf(40), dsp.flen(snare)))
    s = dsp.alias(s, dsp.randint(4, 12))
    s = dsp.taper(s)
    s = dsp.fill(s, length, silence=True)
    s = dsp.amp(s, dsp.rand(2,4))
    return s
コード例 #25
0
ファイル: vary-score.py プロジェクト: hecanjog/buchla-score
def make_layer(freq):
    out = dsp.tone(length, freq, amp=0.2)

    out = dsp.vsplit(out, dsp.mstf(10), dsp.mstf(2500))

    for i, o in enumerate(out):
        if dsp.randint(0, 100) > 50:
            out[i] = make_pulse(o)
        else:
            out[i] = make_vary(o)

    out = [ dsp.amp(o, dsp.rand(0, 1)) for o in out ]

    out = ''.join(out)

    return out
コード例 #26
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
コード例 #27
0
ファイル: jbutler.py プロジェクト: hecanjog/jbutler
def fade(snd, time=dsp.mstf(1)):
    first = dsp.cut(snd, 0, time)
    middle = dsp.cut(snd, time, dsp.flen(snd) - (time * 2))
    last = dsp.cut(snd, dsp.flen(middle) + time, time)

    snd = dsp.env(first, 'line') + middle + dsp.env(last, 'phasor')
    
    return snd
コード例 #28
0
ファイル: guitar.py プロジェクト: hecanjog/geodes-minorg
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
コード例 #29
0
ファイル: types.py プロジェクト: hecanjog/pippi-console
def convert_beat(value, output_type):
    value = patterns['float'].search(value).group(0)
    if output_type == 'frame':
        bpm = settings.config('bpm')
        value = dsp.bpm2ms(bpm) / float(value)
        value = dsp.mstf(value)

    return value 
コード例 #30
0
def fade(snd, time=dsp.mstf(1)):
    first = dsp.cut(snd, 0, time)
    middle = dsp.cut(snd, time, dsp.flen(snd) - (time * 2))
    last = dsp.cut(snd, dsp.flen(middle) + time, time)

    snd = dsp.env(first, 'line') + middle + dsp.env(last, 'phasor')

    return snd
コード例 #31
0
ファイル: cuts.py プロジェクト: hecanjog/geodes.py
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
コード例 #32
0
ファイル: boing.py プロジェクト: hecanjog/geodes-minorg
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
コード例 #33
0
ファイル: rolls.py プロジェクト: hecanjog/geodes-minorg
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
コード例 #34
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
コード例 #35
0
ファイル: slew.py プロジェクト: hecanjog/hcj.py
def play(ctl):
    beat = dsp.mstf(dsp.rand(100, 300))
    out = dsp.pad('', 0, beat)
    m = pygame.midi.Output(2)

    #m.write([ [[0xFA], time.time()] ])
    m.write([ [[0xF8], time.time()] ])

    return out
コード例 #36
0
ファイル: dream.py プロジェクト: hecanjog/hcj.py
    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
コード例 #37
0
ファイル: click.py プロジェクト: hecanjog/hcj.py
def play(ctl):
    param = ctl.get('param')
    lpd = ctl.get('midi').get('lpd')

    freqs = [
        (10000, 15000),
        (5000, 15000),
        (5000, 10000),
    ]

    low = dsp.rand(50, 100) 
    high = dsp.rand(80, 120)

    low = 80
    high = 120

    wform = 'sine2pi'

    amp = lpd.get(5, low=0, high=1, default=0)

    low = dsp.rand(low * 0.9, low)
    high = dsp.rand(high, high * 1.1)

    length = dsp.mstf(lpd.get(1, low=10, high=900)) 

    if dsp.rand() > 10.5:
        length = length / 2

    pulselength = lpd.geti(2, low=dsp.mstf(10), high=length, default=length)

    out = dsp.bln(pulselength, low, high, wform)
    out = dsp.env(out, 'phasor')

    if dsp.rand() > 10.1:
        beep = dsp.tone(dsp.flen(out), dsp.rand(12000, 12000), amp=dsp.rand(0.5, 1))
        out = dsp.mix([out, beep])

    out = dsp.drift(out, dsp.rand(0, 1))
    out = dsp.pad(out, 0, length - dsp.flen(out))

    out = dsp.pan(out, dsp.rand())
    out = dsp.amp(out, amp)

    return out
コード例 #38
0
ファイル: shimmer.py プロジェクト: hecanjog/nomadpalace-wmse
def play(voice_id):
    tel = bot.getTel()

    degrees = [ dsp.randchoose([1, 2, 3, 4, 5, 6, 7, 8]) for f in range(dsp.randint(2, 6)) ]

    octave = dsp.randint(1, 4)

    freqs = tune.fromdegrees(degrees, root='c', octave=octave, ratios=tune.just)

    out = ''

    freq = dsp.randchoose(freqs)
    volume = dsp.rand(0.5, 0.8)
    length = dsp.randint(dsp.mstf(20), dsp.mstf(30))

    for p in range(dsp.randint(20, 100)):

        pulsewidth = dsp.rand(0.5, 1)

        mod = dsp.breakpoint([ dsp.rand(0, 1) for b in range(4) ], 512)
        window = dsp.breakpoint([0] + [ dsp.rand(0, 1) for b in range(10) ] + [0], 512)
        waveform = dsp.breakpoint([0] + [ dsp.rand(-1, 1) for b in range(20) ] + [0], 512)

        modRange = 0.01
        modFreq = dsp.rand(0.0001, 5)

        t = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, volume)

        t = dsp.pad(t, 0, length * 3)

        t = dsp.env(t, 'sine')

        out += t

    out = dsp.env(out, 'sine')
    out = dsp.pan(out, dsp.rand(0, 1))

    dsp.log('')
    dsp.log('drone')
    dsp.log('%s length: %.2f' % (voice_id, dsp.fts(dsp.flen(out))))
    bot.show_telemetry(tel)

    return out
コード例 #39
0
ファイル: rt.py プロジェクト: hecanjog/pippi-console
def grid(tick, bpm):
    os.nice(0)

    bpm = dsp.mstf(dsp.bpm2ms(bpm))

    count = 0
    while True:
        tick.set()
        tick.clear()
        dsp.delay(bpm)
        count += 1
コード例 #40
0
def automate(ctl):
    sh = ctl.get('midi').get('sh')
    i = ctl.get('iterations')
    
    sh.noteon(64)

    dsp.delay(dsp.mstf(dsp.rand(200, 500)))

    sh.noteoff(64)

    dsp.log(i)
コード例 #41
0
ファイル: jbutler.py プロジェクト: hecanjog/jbutler
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
コード例 #42
0
ファイル: rolls.py プロジェクト: hecanjog/geodes-minorg
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
コード例 #43
0
def play(voice_id):
    bpm = config('bpm')

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

    beat = dsp.bpm2frames(bpm)

    length = dsp.randint(dsp.stf(1), dsp.stf(3))

    wav = dsp.breakpoint([0] + [dsp.rand(-1, 1) for w in range(10)] + [0], 512)
    win = dsp.wavetable('sine', 512)
    mod = dsp.wavetable('vary', 512)

    root = dsp.randchoose(tune.fromdegrees([1, 3, 5, 8], octave=0, root='a'))

    pw = dsp.rand(0.1, 1)

    amp = dsp.rand(0.5, 1.2)

    mFreq = 0.01 / dsp.fts(length)

    out = dsp.pulsar(root, length, pw, wav, win, mod, 0.05, mFreq, amp)

    #    out = dsp.env(out, 'vary')

    out = dsp.vsplit(out, dsp.mstf(1), dsp.mstf(500))
    out = dsp.randshuffle(out)
    out = [dsp.pad(o, 0, dsp.randint(0, 4410)) for o in out]
    out = [dsp.pan(o, dsp.rand()) for o in out]
    out = [dsp.alias(o) for o in out]
    out = [o * dsp.randint(1, 30) for o in out]
    out = [dsp.env(o, 'random') for o in out]
    out = [dsp.amp(o, dsp.rand(0.9, 1.5)) for o in out]

    out = ''.join(out)

    return out
コード例 #44
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
コード例 #45
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
コード例 #46
0
def tempoPath(nsegs):
    #maxms = dsp.rand(300, 500)
    #minms = dsp.rand(1, 100)
    minms = 1
    maxms = 500
    wavetypes = ['hann', 'sine', 'vary']

    out = []

    for _ in range(nsegs):
        seglen = dsp.randint(20, 100)
        seg = dsp.wavetable(dsp.randchoose(wavetypes), seglen)

        # pull out a randomly selected subsegment of the curve
        sublen = seglen / dsp.randint(2, 5)
        segstart = dsp.randint(0, seglen - sublen)
        segend = segstart + sublen
        seg = seg[segstart:segend]

        out += [[dsp.mstf(abs(s) * (maxms - minms) + minms) for s in seg]]

    return out
コード例 #47
0
ファイル: listen.py プロジェクト: hecanjog/geodes.py
def play(ctl):
    lpd = ctl.get('midi').get('lpd')
    param = ctl.get('param')
    #pc.setOffset(111)

    chord_index = param.get('chord_index', default=0)

    if lpd.get(36, default=1) < 1:
        dsp.log(lpd.get(36)) 
        param.set('chord_index', chord_index + 1)

    areas = ['high', 'pitch', 'mid', 'low']
    area = lpd.geti(23, low=0, high=len(areas), default=len(areas))
    if area == len(areas):
        area = dsp.randchoose(areas)
    else:
        area = areas[area]

    param.set('wash-area', area, throttle=1)
    param.set('wash-area', 'high', throttle=1)

    return dsp.pad('', 0, dsp.mstf(100))
コード例 #48
0
ファイル: basic.py プロジェクト: hecanjog/algotalk
    def makeOnsets(length, wobble, div, num_beats, offset=False):
        if offset:
            offset = dsp.randint(0, 3)
        else:
            offset = 0

        pattern = dsp.eu(num_beats, dsp.randint(1, num_beats / div), offset)
        dsp.log(pattern)

        if wobble:
            points = [dsp.mstf(100, 500) for _ in range(dsp.randint(2, 8))]
            plength = sum(points)
            mult = length / float(plength)
            onsets = curves.bezier(points, num_beats)
            onsets = [int(o * mult) for o in onsets]

        else:
            beat = float(length) / num_beats
            num_beats = length / beat
            beat = int(round(beat))
            onsets = [beat * i for i in range(int(round(num_beats)))]

        return onsets
コード例 #49
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
コード例 #50
0
g = dsp.read('sounds/seneca3bars.wav').data

numsections = 12
numlayers = 30
numgrains = 22

sections = []
for s in range(numsections):
    layers = []

    for layer in range(numlayers):
        minlen = 40
        lenrange = dsp.rand(300, 500)
        lengths = dsp.wavetable('hann', numgrains * 2)[:numgrains]
        lengths = [ dsp.mstf(l * lenrange + minlen) for l in lengths ]
        pans = dsp.breakpoint([ dsp.rand() for p in range(numgrains / 3)], numgrains)

        layers += [ (lengths, pans) ]

    sections += [ layers ]

out = ''
for section in sections:
    layers = []
    for layer in section:
        startpoint = dsp.randint(0, dsp.flen(g) - max(layer[0]))
        
        grains = ''
        for l, p in zip(layer[0], layer[1]):
            grain = dsp.cut(g, startpoint, l)
コード例 #51
0
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())

        # add frag length to elapsed time
        elapsed += dsp.flen(g)

        # add fragment to frag list
        frags += [g]
コード例 #52
0
sectionlength = dsp.stf(dsp.rand(10, 12))

for _ in range(nchords):
    layers = []

    for _ in range(nlayers):
        layer = ''
        highs = dsp.breakpoint(
            [dsp.rand(60, 15000) for _ in range(npulses / 50)], npulses)
        lows = [dsp.rand(20, freq) for freq in highs]
        amps = dsp.breakpoint(
            [dsp.rand(0.1, 0.3) for _ in range(npulses / 50)], npulses)
        pans = dsp.breakpoint([dsp.rand(0, 1) for _ in range(npulses / 10)],
                              npulses)
        lengths = [
            dsp.mstf(l) for l in dsp.breakpoint(
                [dsp.rand(1, 30) for _ in range(npulses / 10)], npulses)
        ]

        for high, low, amp, pan, length in zip(highs, lows, amps, pans,
                                               lengths):
            p = dsp.bln(length,
                        low,
                        high,
                        wform=dsp.randchoose(['hann', 'sine2pi', 'tri']))
            p = dsp.env(p, 'hann')
            p = dsp.taper(p, 20)
            p = dsp.amp(p, amp)
            p = dsp.pan(p, pan)

            layer += p
コード例 #53
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
コード例 #54
0
numpoints = 7

wfs = [
    dsp.breakpoint([dsp.rand(-1, 1) for p in range(numpoints)], 512)
    for _ in range(numsegs)
]
win = dsp.wavetable('tri', 512)

mods = [
    dsp.breakpoint([dsp.rand(0, 1) for p in range(numpoints)], 512)
    for _ in range(numsegs)
]
modfs = [dsp.rand(0.01, 0.1) for _ in range(numsegs)]
modrs = [dsp.rand(0, 0.1) for _ in range(numsegs)]
pws = [dsp.rand(0.01, 1) for _ in range(numsegs)]

out = []

for wf, mod, modf, modr, pw in zip(wfs, mods, modfs, modrs, pws):
    layers = []
    for freq in chord:
        layer = dsp.pulsar(freq, length, pw, wf, win, mod, modr, modf, 0.1)
        layers += [layer]

    out += [dsp.mix(layers)]

out = [dsp.taper(o, dsp.mstf(10)) for o in out]
out = ''.join(out)

dsp.write(out, 'truckidle')
コード例 #55
0
for _ in range(numlayers):
    layer = ''

    for _ in range(numevents):
        slength = dsp.rand(0.1, 4)
        length = dsp.stf(slength)
        freq = (1.0 / slength) * dsp.rand(0.5, 10)
        amp = dsp.rand(0.1, 0.5)

        log = dsp.breakpoint(
            data.Logistic(dsp.rand(3.88, 3.99), 0.5, length / 10).data, length)
        mult = dsp.breakpoint(
            [0] + [dsp.rand(-1, 1) for _ in range(dsp.randint(50, 100))] + [0],
            length)

        wf = [m * l for m, l in zip(mult, log)]

        o = dsp.ctone(freq, length, wf, amp)
        o = dsp.env(o, 'random')
        o = dsp.pan(o, dsp.rand())
        o = dsp.taper(o, dsp.mstf(20))

        layer += o

    layers += [layer]

out = dsp.mix(layers)

dsp.write(out, 'lipsys')
コード例 #56
0
ファイル: wash.py プロジェクト: hecanjog/geodes.py
def play(ctl):
    param = ctl.get('param')
    lpd = ctl.get('midi').get('lpd')

    pc = ctl.get('midi').get('pc')
    #pc.setOffset(111)

    gamut = {
        'high': [
            (10000, 15000),
            (5000, 15000),
            (5000, 10000),
        ],

        'mid': [
            (1000, 5000),
            (1000, 2000),
        ],

        'pitch': [
            tuple([ dsp.rand(500, 2000) for p in range(2) ]),
            tuple([ dsp.rand(100, 1000) for p in range(2) ]),
            tuple([ dsp.rand(1000, 5000) for p in range(2) ]),
        ],

        'low': [
            (20, 5000),
            (30, 10000),
            (40, 10000),
        ]
    }

    area = param.get('wash-area', default='high')
    area = dsp.randchoose(['high', 'mid', 'pitch', 'low'])
    area = 'pitch'

    dsp.log(area)

    freqs = dsp.randchoose(gamut[area])

    freqscale = pc.get(16, low=0.125, high=2, default=1)
    #freqscale = dsp.rand(0.125, 2)

    low = freqs[0] * freqscale
    high = freqs[1] * freqscale

    wform = dsp.randchoose(['sine2pi', 'tri', 'vary', 'square'])

    timescale = pc.get(17, low=1, high=4, default=1)
    #timescale = dsp.rand(1, 4)
    lengthscale = pc.get(18, low=0.125, high=2.5)
    #lengthscale = dsp.rand(0.125, 2.5)

    amp = pc.get(0, low=0, high=0.5, default=0.5)
    #amp = dsp.rand(0, 0.5)

    if area == 'high':
        low = dsp.rand(low * 0.9, low)
        high = dsp.rand(high, high * 1.1)

        length = dsp.stf(dsp.rand(0.01, 0.3) * lengthscale)
        out = dsp.bln(length, low, high, wform)
        out = dsp.env(out, 'phasor')

        if dsp.rand() > 10.5:
            beep = dsp.tone(dsp.flen(out), high * 2, amp=dsp.rand(0.5, 1))
            out = dsp.mix([out, beep])

        out = dsp.pad(out, 0, dsp.mstf(dsp.rand(1, 400) * timescale))
        out = out * dsp.randint(1, 3)
        out = dsp.drift(out, dsp.rand(0, 1))

    elif area == 'mid':
        low = dsp.rand(low * 0.9, low)
        high = dsp.rand(high, high * 1.1)

        length = dsp.stf(dsp.rand(0.01, 0.5) * lengthscale)
        out = dsp.bln(length, low, high, wform)
        out = dsp.env(out, 'random')

        if timescale > 1:
            out = dsp.pad(out, 0, dsp.mstf(500 * timescale * dsp.rand(0.5, 1.5)))


    elif area == 'pitch':
        low = dsp.rand(low * 0.9, low)
        high = dsp.rand(high, high * 1.1)

        length = dsp.stf(dsp.rand(0.01, 0.5) * lengthscale)
        out = dsp.bln(length, low, high, wform)
        out = dsp.env(out, 'random')

        if timescale > 1:
            out = dsp.pad(out, 0, dsp.mstf(500 * timescale * dsp.rand(0.5, 1.5)))


    elif area == 'low':
        low = dsp.rand(low * 0.9, low)
        high = dsp.rand(high, high * 1.1)

        length = dsp.stf(dsp.rand(0.2, 2) * lengthscale)
        out = dsp.bln(length, low, high, wform)
        out = dsp.env(out, 'random')
        out = dsp.mix([out, dsp.tone(length, low)])

        if dsp.rand() > 0.5:
            beep = dsp.tone(dsp.flen(out), high, amp=dsp.rand(0.015, 0.1), wavetype=dsp.randchoose(['hann', 'impulse', 'square', 'vary', 'sine']))
            out = dsp.mix([out, beep])


        if timescale > 1:
            out = dsp.pad(out, 0, dsp.mstf(500 * timescale * dsp.rand(0.5, 1.5)))


    if dsp.rand() > pc.get(19, low=0, high=1, default=0.75):
        plength = length * dsp.randint(2, 6)
        freq = tune.ntf(param.get('key', default='c'), octave=dsp.randint(0, 4))
        out = dsp.mix([ dsp.pine(out, plength, freq), dsp.pine(out, plength, freq * 1.25) ])
        out = dsp.fill(out, length)

    out = dsp.pan(out, dsp.rand())
    out = dsp.amp(out, amp)

    return out
コード例 #57
0
def smear(snd):
    snd = dsp.split(snd, dsp.mstf(dsp.rand(5000, 10000)))
    snd = dsp.randshuffle(snd)
    snd = [dsp.env(s) for s in snd]
    snd = [s * dsp.randint(1, 8) for s in snd]

    return dsp.drift(''.join(snd), dsp.rand(0.01, 0.1))


out = ''

sparks = dsp.mix(
    [''.join([fracture(cathedral.data) for i in range(20)]) for i in range(3)])

smears = dsp.mix([smear(cathedral.data) for i in range(10)])

tlen = dsp.stf(20)

dings = ''
for seg in range(20):
    nlen = dsp.mstf(dsp.randint(4130, 6300))
    dings += dsp.mix([ding(tone, tlen, nlen) for i in range(2)])

#out = dsp.mix([dsp.amp(dings, 0.8), smears, sparks])
out = sparks

dsp.write(out, 'sparks', False)

dsp.timer('stop')
コード例 #58
0
ファイル: tam.py プロジェクト: hecanjog/geodes.py
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
コード例 #59
0
b1 = dsp.breakpoint([dsp.rand(minpartial, maxpartial) for r in range(10)],
                    numgrains)
b2 = dsp.breakpoint([dsp.rand(minpartial, maxpartial) for r in range(10)],
                    numgrains)


def makeGrain(freq, length):
    grain = dsp.tone(length, freq, amp=dsp.rand(0.05, 0.1))
    grain = dsp.pan(grain, dsp.rand())
    return grain


out = []

for i in range(numgrains):
    grainlen = dsp.mstf(dsp.rand(30, 100))

    lowf = min(b1[i], b2[i])
    highf = max(b1[i], b2[i])

    stack = [makeGrain(root, grainlen) for root in roots]

    for partial in partials:
        if partial >= lowf and partial <= highf:
            stack += [makeGrain(partial, grainlen)]

    stack = dsp.mix(stack)
    stack = dsp.env(stack, 'hann')

    out += [stack]