示例#1
0
def make_tracks(numtracks):
    tracks = range(numtracks)

    g.db.execute('delete from `blocks`;')

    # Testing out display of rendered blocks
    for i, track in enumerate(tracks):
        blocks = range(dsp.randint(1, 5))

        # for each sound:
        for j, snd in enumerate(blocks):
            # render it.
            snd = dsp.tone(dsp.stf(dsp.rand(0.5, 5)))

            # filename is track_id-block_id.wav for now
            filename = "%i-%i-%i" % (i, j, 0)

            # write it to disk
            dsp.write(snd, 'static/sounds/%s' % filename)

            # Calc length in pixels from frames
            length = dsp.flen(snd)
            pxlength = "%ipx" % (length / 441,)
            slength = "%02fs" % dsp.fts(length)
            offset = dsp.stf(dsp.rand(0, 60))


            # save in the db
            block = ( 
                        0,
                        0,
                        i,
                        length,
                        length,
                        offset,
                        filename,
                    )
            g.db.execute('insert into `blocks` (version, generator_id, track_id, length, range, offset, filename) values (?, ?, ?, ?, ?, ?, ?)', 
                    block)

            c = g.db.cursor()
            block_id = c.lastrowid()

            # block is a tuple:
            #   (block index, filename, length in pixels, offset in pixels)
            blocks[j] = (block_id, filename, slength, ftpx(length), ftpx(offset))

        tracks[i] = blocks

    g.db.commit()

    return tracks
示例#2
0
def sox(cmd, sound):
    path = os.getcwd()
    filename_in = '/proc-in'
    filename_out = '/proc-out.wav'

    dsp.write(sound, filename_in)

    cmd = cmd % (path + filename_in + '.wav', path + filename_out)
    subprocess.call(cmd, shell=True)

    sound = dsp.read(path + filename_out).data

    return sound
示例#3
0
def sox(cmd, sound):
    path = os.getcwd()
    filename_in = '/proc-in'
    filename_out = '/proc-out.wav'

    dsp.write(sound, filename_in)

    cmd = cmd % (path + filename_in + '.wav', path + filename_out)
    subprocess.call(cmd, shell=True)

    sound = dsp.read(path + filename_out).data

    return sound
示例#4
0
def sox(cmd, sound):
    stamp = str(time.time())
    path = os.getcwd()
    filename_in = "/tmp/proc-in" + stamp
    filename_out = "/tmp/proc-out" + stamp + ".wav"

    dsp.write(sound, filename_in)

    cmd = cmd % (path + filename_in + ".wav", path + filename_out)
    subprocess.call(cmd, shell=True)

    sound = dsp.read(path + filename_out).data

    return sound
示例#5
0
文件: fx.py 项目: hecanjog/hcj.py
def rb(snd, length=None, speed=None, hz=None, interval=None, ratios=None, crisp=0, formant=False):
    pid = os.getpid()
    cmd = ['rubberband']

    # Time stretching
    if length is not None and dsp.flen(snd) != length and length > 0:
        cmd += [ '--duration %s' % dsp.fts(length) ] 

    # crisp setting
    cmd += [ '--crisp %s' % dsp.cap(crisp, 6, 0) ]

    # preserve formants
    if formant:
        cmd += [ '--formant' ]

    # pitch shift by speed
    if speed is not None:
        cmd += [ '--frequency %s' % speed ]

    # pitch shift by semitones
    if interval is not None:
        # TODO use pippi.tune ratios and calc frequency args
        cmd += [ '--pitch %s' % interval ]

    vpid = pid + random.randint(1, 10000)

    cmd = ' '.join(cmd) + ' /tmp/infile%s.wav /tmp/outfile%s.wav' % (vpid, vpid)

    dsp.write(snd, '/tmp/infile%s' % vpid, cwd=False)

    with open(os.devnull, 'w') as devnull:
        p = subprocess.Popen(cmd, stdout=devnull, stderr=devnull, shell=True)
        p.wait()

    out = dsp.read('/tmp/outfile%s.wav' % vpid).data
    os.remove('/tmp/outfile%s.wav' % vpid)
    os.remove('/tmp/infile%s.wav' % vpid)

    return out
示例#6
0
def main():
    #since how this Library works it's a bit uncertain how to change channels in real time, for now just write a cut off, since an intterrupt won't work with the channels
    #out = [dsp.tone(dsp.stf(5),55*i , 'sine2pi',0.2) for i in range(1,5)]
    #dsp.write(out, 'helloagain')
    out=[]
    notes=0
    #start = time.time()
    #while time.time()-start < 100000:
    while notes<25:
    
        serialInput= ser.readline().split()
        #    print serialInput
        #    serialInput = serialInput.split()
        if len(serialInput) == 4:
            instrument=int(float(serialInput[0]))+1 # pin number
            amplitude=(int(float(serialInput[1]))%10)/10.0 #humidity
            freq=float(serialInput[2])*(instrument+1)*10 #temperature
            tempo=float(serialInput[3]) #tempo
        
        else:
            instrument=1 # pin number
            amplitude=0.2 #humidity
            freq=440 #temperature
            tempo=14 #tempo
            #print serialInput

            #print freq
        out.append(dsp.tone(dsp.stf(instrument),freq,'sine2pi', amplitude))
            #    print notes
        notes+=1

            #print out
            #out = [dsp.env(o , sine'])) for o in out]
    out = [dsp.env(o , dsp.randchoose(['hann', 'tri', 'sine'])) for o in out]
    out = dsp.mix(out)
    dsp.write(out, 'sample')    
示例#7
0
def make_vary(length, freq):

    if dsp.rand(0, 100) > 50:
        return make_pulse(dsp.tone(length, freq, amp=dsp.rand()))

    minlen = dsp.mstf(1)

    pulsewidth = int(dsp.rand(minlen, length / 2))
    
    snd = dsp.tone(pulsewidth, freq, amp=dsp.rand(0, 0.2))
    snd = dsp.env(snd, dsp.randchoose(['sine', 'tri', 'hann']))

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

    return snd


def make_layer(freq):
    out = ''

    for i in range(500):
        out += make_vary(beat * dsp.randint(1, 8), freq)

    return out

out = dsp.mix([ make_layer(freq) for freq in freqs ])

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

示例#8
0
        frags += [g]

    # concat all frags
    layer = ''.join(frags)

    # add frags to layers
    layers += [layer]

# mix down frag layers
out = dsp.mix(layers)

# Add sine buildup

sines = []

lowfreq = tune.ntf('g', octave=2)

sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq, amp=0.4)]
sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.067, amp=0.4)]
sines += [dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.667, amp=0.25)]

sines = [dsp.mix([fx.penv(s), s]) for s in sines]

sines = dsp.mix(sines)
sines = dsp.env(sines, 'line')
sines = dsp.pad(sines, dsp.flen(out) - dsp.flen(sines), 0)

out = dsp.mix([intro, out, sines])

dsp.write(out, '01-friction_i')
示例#9
0
    return snd

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')
示例#10
0
from pippi import dsp

freqs = [55, 220, 440, 770]
length = dsp.stf(90)

layers = []

for freq in freqs:
    amp = dsp.rand(0.05, 0.1)

    wf1 = dsp.breakpoint([ dsp.rand(-1, 1) for p in range(7) ], 512)
    wf2 = dsp.breakpoint([ dsp.rand(-1, 1) for p in range(4) ], 512)

    layer = dsp.subtract(dsp.ctone(freq * 0.999, length, wf1, amp), dsp.ctone(freq, length, wf2, amp))
    layer = dsp.pan(layer, dsp.rand())
    layer = dsp.env(layer, 'random')

    layers += [ layer ]

out = dsp.mix(layers)

dsp.write(out, 'retabler2')
示例#11
0
        modRange = dsp.rand(0, 0.001)

        print '    ', round(freq, 2), round(modRange, 3), round(modFreq, 3)
        layer = dsp.pulsar(freq, length, pulsewidth, waveform, window, mod, modRange, modFreq, 0.1)

        layer = dsp.split(layer, dsp.flen(layer) / numgrains)
        layer = layer[:numgrains]

        layer = [ dsp.pan(dsp.amp(layer[i], e[i]), p[i]) for i in range(numgrains) ]

        layer = ''.join(layer)

        layers += [ layer ]

    out = dsp.mix(layers)

    return out

layers = []

for l in range(3):
    layer = ''.join([ that(w) for w in range(40) ])

    layers += [ layer ]

out = dsp.mix(layers)

dsp.write(out, 'slowly')

dsp.timer('stop')
示例#12
0
        ]
        freqs = [
            f * 90 + 10
            for f in dsp.wavetable('line', numgrains / dsp.randint(50, 100))
        ]

        for freq, length, pan in zip(freqs, lens, pans):
            seed += 0.00001
            log = data.Logistic(seed, 0.5, 555)
            amp = dsp.rand(0.1, 0.75)

            grain = dsp.ctone(freq, length, log.data, amp)
            grain = dsp.env(grain, 'random')
            grain = dsp.taper(grain, dsp.mstf(5))
            grain = dsp.pan(grain, pan)

            layer += grain

        layers += [layer]

    stream = dsp.mix(layers)
    stream = dsp.env(stream, 'random')

    elapsed += dsp.flen(stream)

    out += stream

print seed

dsp.write(out, 'abseed')
示例#13
0
                grains = dsp.mix(grains)
                grains = dsp.amp(grains, dsp.rand(0.25, 0.55))
                grains = mixdrift(grains)

                layers += [ grains ]

        sounds = dsp.fill(dsp.mix(layers), tlen)

        if canPlay('ending', bigoldsection):
            sounds = dsp.vsplit(sounds, dsp.mstf(1), dsp.mstf(200))
            sounds = [ dsp.pad(s, 0, dsp.mstf(dsp.rand(50, 250))) for s in sounds ]
            sounds = ''.join(sounds)

        subsection_length = dsp.flen(sounds)
        print 'subsection length:', dsp.fts(subsection_length), seg_index
         
        section += sounds


    section_length = dsp.flen(section)
    print 'section length:', dsp.fts(section_length)

    sections += [ section ]
    print

print 

out = ''.join(sections)

dsp.write(out, 'amber', timestamp=True)
示例#14
0
from pippi import dsp

snd = dsp.read('sounds/seneca3bars.wav').data
snd = dsp.split(snd, 0, 1)
snd = dsp.packet_shuffle(snd, 3)
snd = [s * dsp.randint(1, 10) for s in snd]

out = ''.join(snd)

dsp.write(out, 'seero')
示例#15
0
from pippi import dsp

snd = dsp.read('sounds/seneca3bars.wav').data

numgrains = 40
lens = [1 for _ in range(numgrains / 2)]
lens = lens + dsp.wavetable('hann', numgrains)[len(lens):]
lens = [dsp.mstf(l * 40 + 30) for l in lens]

out = ''

lpos = 0
rpos = dsp.mstf(100)
for i in range(numgrains):
    l = dsp.cut(snd, lpos, lens[i])
    r = dsp.cut(snd, rpos, lens[i])

    lpos += dsp.mstf(dsp.rand(1, 10))
    rpos += dsp.mstf(dsp.rand(1, 10))

    out += dsp.pan(l, 0)
    out += dsp.pan(r, 1)

dsp.write(out, 'alter')
示例#16
0
from pippi import dsp
from hcj import data

numgrains = 1000
numsines = 100
length = dsp.mstf(100)

dist = data.Logistic(3.99, 0.5, numsines).data
dist = sorted(dist)

lows = dsp.breakpoint([ dsp.rand(10, 100) for _ in range(100) ], numgrains)
highs = dsp.breakpoint([ dsp.rand(100, 1000) for _ in range(100) ], numgrains)

out = ''
for lowfreq, highfreq in zip(lows, highs):
    layers = []

    for freq in dist:
        r = highfreq - lowfreq
        layers += [ dsp.pan(dsp.tone(length, freq * r + lowfreq, amp=0.05), dsp.rand()) ]

    out += dsp.taper(dsp.env(dsp.mix(layers), 'hann'), dsp.mstf(10))

dsp.write(out, 'shifty')
示例#17
0
from pippi import dsp

g = dsp.read('sounds/seneca3bars.wav').data
beat = dsp.bpm2frames(112)

g = dsp.split(g, dsp.flen(g) / 48)

out = ''

osts = [dsp.randchoose(g) for a in range(3)]

for p in range(32):
    alts = [dsp.randchoose(g) for a in range(4)]

    for b in range(dsp.randint(4, 12)):
        out += osts[p % len(osts)]
        out += alts[b % len(alts)]

dsp.write(out, 'pulsechord')
示例#18
0
from pippi import dsp

interval = 1
length = dsp.stf(30)

freq = 100
highfreq = 1000

layers = []
while freq < highfreq:
    layer = dsp.tone(length, freq, amp=0.01)
    layer = dsp.pan(layer, dsp.rand())
    freq += interval

    layers += [ layer ]

out = dsp.mix(layers)

dsp.write(out, 'allfreqs')
示例#19
0
    return blip

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

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

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

    return snd

p = 'XxxXxxxXxXxxXxxxxXx'

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

layers = []

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

out = dsp.mix(layers)

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

示例#20
0
    ohats = drums.parsebeat(ohat, 8, beat, length, makeOHat, 0)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)
    lsnares = drums.parsebeat(lsnare, 8, beat, length, makeLSnare, 0)

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

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

    if count % 4 == 0:
        bar = dsp.mix([bar, dsp.fill(bksnd, dsp.flen(bar), silence=True)])

    progression = "ii6 ii69".split(" ")
    cname = progression[count % len(progression)]
    rfreqs = tune.chord(cname, key, 2)
    rhodes = makeRhodes(dsp.flen(bar), beat / 8, rfreqs)

    out += dsp.mix([bar, dsp.fill(rhodes, dsp.flen(bar))])
    # out += bar

    count += 1
    elapsed += dsp.flen(bar)

dsp.write(out, "05-bumps_ii")
示例#21
0
    ohats = drums.parsebeat(ohat, 8, beat, length, makeOHat, 0)
    kicks = drums.parsebeat(kick, 8, beat, length, makeKick, 0)
    snares = drums.parsebeat(snare, 8, beat, length, makeSnare, 0)
    lsnares = drums.parsebeat(lsnare, 8, beat, length, makeLSnare, 0)

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

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

    if count % 4 == 0:
        bar = dsp.mix([ bar, dsp.fill(bksnd, dsp.flen(bar), silence=True) ])

    progression = 'ii6 ii69'.split(' ')
    cname = progression[ count % len(progression) ]
    rfreqs = tune.chord(cname, key, 2)
    rhodes = makeRhodes(dsp.flen(bar), beat / 8, rfreqs)

    out += dsp.mix([ bar, dsp.fill(rhodes, dsp.flen(bar)) ])
    #out += bar

    count += 1
    elapsed += dsp.flen(bar)

dsp.write(out, '05-bumps_ii')
示例#22
0
from pippi import dsp

length = dsp.stf(30)

freq = 100
highfreq = 200

count = 0
layers = []
while freq < highfreq:
    layer = dsp.tone(length, freq, amp=0.001)
    layer = dsp.pan(layer, dsp.rand())
    freq += dsp.rand(0.05, 0.1)

    layers += [layer]
    count += 1

print count
out = dsp.mix(layers)

dsp.write(out, 'sineclump')
示例#23
0
文件: drums.py 项目: hecanjog/o-ou
from pippi import dsp
import orc, pat, fx

drums = [ orc.clap, orc.hihat, orc.kick ]

out = ''
beat = dsp.bpm2frames(125) / 2

for bar in range(8):
    perc = ''
    for i in range(32):
        if dsp.randint(0, 2) == 0:
            perc += dsp.randchoose(drums)(dsp.rand(), beat)
        else:
            perc += dsp.pad('', beat, 0)

    kick = orc.kick(1, beat * 32)

    out += dsp.mix([ perc, kick ])

dsp.write(out, 'drums')
示例#24
0
                grains = dsp.amp(grains, dsp.rand(0.25, 0.55))
                grains = mixdrift(grains)

                layers += [grains]

        sounds = dsp.fill(dsp.mix(layers), tlen)

        if canPlay('ending', bigoldsection):
            sounds = dsp.vsplit(sounds, dsp.mstf(1), dsp.mstf(200))
            sounds = [
                dsp.pad(s, 0, dsp.mstf(dsp.rand(50, 250))) for s in sounds
            ]
            sounds = ''.join(sounds)

        subsection_length = dsp.flen(sounds)
        print 'subsection length:', dsp.fts(subsection_length), seg_index

        section += sounds

    section_length = dsp.flen(section)
    print 'section length:', dsp.fts(section_length)

    sections += [section]
    print

print

out = ''.join(sections)

dsp.write(out, 'amber', timestamp=True)
示例#25
0
from pippi import dsp

dist = dsp.wavetable('hann', 1200)[:600]

lowfreq = 200
highfreq = 1000
length = dsp.stf(60)

layers = []

for freq in dist:
    r = highfreq - lowfreq
    layers += [dsp.tone(length, freq * r + lowfreq, amp=0.01)]

out = dsp.mix(layers)

dsp.write(out, 'basics')
示例#26
0
def play(params):
    length = params.get("length", dsp.mstf(10000))
    buffer_index = params.get("buffer_index", False)
    sample_index = params.get("sample_index", False)
    buffer_length = params.get("buffer_length", dsp.stf(5))
    volume = params.get("volume", 100.0) / 100.0
    scale = params.get("scale", [25, 50, 100, 200])
    octave = params.get("octave", 0)
    envelope = params.get("envelope", False)
    glitch = params.get("glitch", True)
    overdub = params.get("dub", False)
    pad = params.get("padding", False)
    pan = params.get("pan", False)

    if sample_index != False:
        out = dsp.read("samps/pre/buf-%s.wav" % str(sample_index)).data
    elif buffer_index != False:
        fname = "samps/buf-%s" % str(buffer_index)

        if not os.path.exists(fname + ".wav") or overdub == True:
            out = rt.capture(buffer_length, "T6_pair1", 1)
            out = sox("sox %s %s silence 1 0.1 1%% -1 0.1 1%%", out)
            out = dsp.transpose(out, 0.5)
        else:
            out = dsp.read("samps/buf-%s.wav" % str(buffer_index)).data
    else:
        out = rt.capture(buffer_length, "T6_pair1", 1)
        out = sox("sox %s %s silence 1 0.1 1%% -1 0.1 1%%", out)
        out = dsp.transpose(out, 0.5)

    speeds = [s / 100.0 for s in scale]
    # speeds = [ 0.25, 0.5, 1.0, 2.0 ]

    if glitch == True:
        grain_length = dsp.flen(out) / 4

        out = dsp.vsplit(out, int(grain_length * 0.5), grain_length)
        numgrains = (length / grain_length) * 2

        if len(out) < numgrains:
            for i in range(numgrains - len(out)):
                out += [dsp.randchoose(out)]

        layers = []

        for index in range(1, 20):
            layer = dsp.randshuffle(out)

            if pad is not False:
                layer = [dsp.pad(grain, 0, pad) for grain in layer]

            layer = [dsp.env(grain, "sine") for grain in layer]
            layer = [dsp.transpose(grain, dsp.randchoose(speeds) * 2 ** octave * 0.25) for grain in layer]
            layer = "".join(layer)

            layer = dsp.pad(layer, grain_length / index, 0)
            layers += [layer]

        out = dsp.mix(layers, True, 10)

    if envelope == True:
        out = dsp.env(out, envelope)

    if buffer_index:
        fname = "samps/buf-%s" % str(buffer_index)
        if os.path.exists(fname + ".wav") and overdub == False:
            pass
        else:
            dsp.write(out, fname)

    if pan:
        out = dsp.pan(out, dsp.rand())

    return out
示例#27
0
        layers += [ long_chord ]

    if dsp.rand() < guitarprob[segi]:
        long_guitar = orc.guitar.makeLong(seg)
        layers += [ long_guitar ]

    if dsp.rand() < glitchprob[segi]:
        subseg = ctl.splitSeg(seg, 2)
        orc.rhodes.long_chord = long_chord
        glitches = ctl.makeBeat([1,1], subseg, orc.rhodes.makeGlitch)

        layers += [ glitches ]

    if dsp.rand() < wesprob[segi]:
        voices = orc.wes.make(sum(seg))
        layers += [ voices ]

    if len(layers) > 0:
        section = dsp.mix(layers)


        out += section

out += dsp.env(dsp.mix([ orc.guitar.makeLong([dsp.stf(dsp.rand(4, 8))]) for _ in range(2) ]), 'phasor')
out += dsp.env(dsp.mix([ orc.guitar.makeLong([dsp.stf(dsp.rand(4, 10))]) for _ in range(2) ]), 'phasor')
out += dsp.env(dsp.mix([ orc.guitar.makeLong([dsp.stf(dsp.rand(6, 12))]) for _ in range(3) ]), 'phasor')

dsp.write(out, '02-friction_ii')

print dsp.timer('stop')
示例#28
0
from pippi import dsp
from hcj import data

layers = []

numgrains = 5555

for _ in range(2):
    layer = ''
    pans = dsp.breakpoint([dsp.rand() for _ in range(55)], numgrains)

    for i in range(numgrains):
        freq = dsp.rand(10, 100)
        log = data.Logistic(dsp.rand(3.78, 3.99), 0.5, 555)
        amp = dsp.rand(0.1, 0.5)

        grain = dsp.ctone(freq, dsp.mstf(dsp.rand(5, 150)), log.data, amp)
        grain = dsp.env(grain, 'random')
        grain = dsp.taper(grain, dsp.mstf(5))
        grain = dsp.pan(grain, pans[i])

        layer += grain

    layers += [layer]

out = dsp.mix(layers)

dsp.write(out, 'cludes')
示例#29
0
        frags += [ g ]

    # concat all frags
    layer = ''.join(frags)

    # add frags to layers
    layers += [ layer ]

# mix down frag layers
out = dsp.mix(layers)

# Add sine buildup

sines = []

lowfreq = tune.ntf('g', octave=2)

sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq, amp=0.4) ]
sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.067, amp=0.4) ]
sines += [ dsp.tone((dsp.flen(out) / 4) * 3, lowfreq * 1.667, amp=0.25) ]

sines = [ dsp.mix([ fx.penv(s), s ]) for s in sines ]

sines = dsp.mix(sines)
sines = dsp.env(sines, 'line')
sines = dsp.pad(sines, dsp.flen(out) - dsp.flen(sines), 0)

out = dsp.mix([ intro, out, sines ])

dsp.write(out, '01-friction_i')
示例#30
0
                dsp.pan(dsp.amp(bit, dsp.rand(0.1, 10)), dsp.rand())
                for _ in range(dsp.randint(2, 10))
            ])

        bits += [bit]

    layer = ''.join(bits)

    layers += [layer]

out = dsp.mix(layers)

now = datetime.now()
filename = 'fart-%s-%s-%s-%s' % (now.year, now.month, now.day, now.hour)

dsp.write(out, filename)
print 'rendered'

print subprocess.call('sox %s.wav -C 320 %s.mp3 norm' % (filename, filename),
                      shell=True)
print subprocess.call('scp %s.mp3 hecanjog.com:hecanjog.com/farts/' % filename,
                      shell=True)

# Authenticate w/ twitter as @fartsynthesis
consumer_key = os.environ['FART_CONSUMER_KEY']
consumer_secret = os.environ['FART_CONSUMER_SECRET']
access_token = os.environ['FART_ACCESS_KEY']
access_token_secret = os.environ['FART_ACCESS_SECRET']
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
示例#31
0
from pippi import dsp
from pippi import tune

length = dsp.stf(45)

freqs = [ dsp.rand(20, 200) for f in range(10) ]

def makeLayer(freq):
    pw = dsp.rand()
    wf = dsp.wavetable('tri', 512)
    win = dsp.wavetable('hann', 512)
    mod = dsp.breakpoint([ dsp.rand() for m in range(dsp.randint(4,8)) ], 512)
    modf = dsp.rand(0.1, 2)
    modr = dsp.rand(0, 0.01)
    amp = dsp.rand(0.1, 0.5)

    layer = dsp.pulsar(freq, length, pw, wf, win, mod, modf, modr, amp)

    return layer

layers = [ makeLayer(freq) for freq in freqs ]

out = dsp.mix(layers)

dsp.write(out, 'fuzzlo')
示例#32
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')
示例#33
0
from pippi import dsp
from pippi import tune
from hcj import keys

chords = tune.chords(['i', 'vi9', 'iii7', 'v'],
                     'a',
                     octave=3,
                     ratios=tune.terry)

out = ''

for chord in chords * 4:
    layers = []
    length = dsp.stf(dsp.rand(3, 4))
    for freq in chord:
        layer = keys.rhodes(length, freq, dsp.rand(0.1, 0.2))
        layer = dsp.pan(layer, dsp.rand())
        layer = dsp.drift(layer, dsp.rand(0, 0.01))

        layers += [layer]

    chord = dsp.mix(layers)
    chord = dsp.drift(chord, dsp.rand(0, 0.01))

    out += chord

dsp.write(out, 'chordsweep')
示例#34
0
from pippi import dsp

g = dsp.read('sounds/seneca3bars.wav').data
beat = dsp.flen(g) / (12 * 13)
g = dsp.split(g, beat)

modulos = [3, 5, 7, 11]
numgrains = dsp.stf(20) / beat

streams = []
for mod in modulos:
    stream = []

    for i, s in enumerate(g):
        if i % mod == 0:
            stream += [s]

    stream = [stream[i % len(stream)] for i in range(numgrains)]

    streams += [stream]

out = []

for grain in range(numgrains):
    for stream in streams:
        out += stream[grain]

out = ''.join(out)

dsp.write(out, 'stringquilt')
示例#35
0

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]

out = ''.join(out)

dsp.write(out, 'shapetones')
示例#36
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')
示例#37
0
    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


out = ''.join([
    dsp.mix([chirp() for c in range(dsp.randint(2, 10))]) for o in range(100)
])

dsp.write(out, 'scribble')
示例#38
0
    freqs = tune.fromdegrees([dsp.randint(1, 9) for _ in range(nlayers)],
                             octave=1,
                             root='a')

    for i, freq in enumerate(freqs):
        layers[i] = dsp.pine(layer, dsp.flen(layer) * 10, freq)

    section = dsp.fill(dsp.mix(layers), sectionlength)

    plen = dsp.randint(16, 32)
    pattern = dsp.eu(plen, dsp.randint(4, plen))
    pattern = ['x' if h == 1 else '.' for h in pattern]
    beat = dsp.flen(section) / plen
    kicks = ctl.makeBeat(pattern, [beat for _ in range(plen)], makeKick)

    pattern = 'x..'
    rimshots = ctl.makeBeat(pattern,
                            [dsp.flen(section) / 16 for _ in range(16)],
                            makeRimshot)

    pattern = ctl.parseBeat('xxxx')
    pdiv = dsp.randint(32, 64)
    hats = ctl.makeBeat(pattern,
                        [dsp.flen(section) / pdiv for _ in range(pdiv)],
                        orc.hat.make)

    out += dsp.mix([hats, rimshots, kicks, section])

dsp.write(out, '04-bumps_i')
示例#39
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')
示例#40
0
    stabs = makeBeat(pattern, subseg, makeStab)
    
    # pulses
    pattern = parseBeat(pulsep)
    pulses = makeBeat(pattern, seg, makePulse)

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

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

    def makeGlitch(length, i):
        g = dsp.cut(long_chord, dsp.randint(0, dsp.flen(long_chord) - length), length)
        g = dsp.alias(g)
        g = dsp.fill(g, length)

        return g

    subseg = splitSeg(seg, 2)
    glitches = makeBeat([1,1], subseg, makeGlitch)

    changeindex = changeindex + 1

    section = dsp.mix([ section, long_chord, glitches ])

    out += section


dsp.write(out, 'rollyagain')
示例#41
0
    
    snd = dsp.split(snd, 40)

    snd = [ dsp.amp(snd[i], curve[i]) for i in range(numpoints) ]

    snd = ''.join(snd)

    return snd


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

out = dsp.mix([ make_layer(freq) for freq in freqs ])

dsp.write(out, 'buchla-vary')
示例#42
0
def makeTone(numSec, freq, name):
  tone = dsp.tone(dsp.stf(numSec), freq=freq, amp=1) 
  dsp.write(tone, name)
示例#43
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')
示例#44
0
        cycle_length = dsp.randint(min_length, max_length)

        harmonics = [ 
                dsp.tone(
                length=cycle_length, 
                freq=root * dsp.randchoose(val_harmonics), 
                amp=dsp.rand(0.1, 0.4),
                wavetype='impulse'
                ) 
            for h in range(num_harmonics) ]

        harmonics = [ dsp.pan(harmonic, dsp.rand()) for harmonic in harmonics ]
        harmonics = [ dsp.env(harmonic, 'gauss') for harmonic in harmonics ]

        cycles += [ dsp.mix(harmonics) ]
        elapsed += cycle_length

    return ''.join(cycles)

cycles = [ make_cycles(dsp.stf(60 * 2)) for i in range(4) ]

out = dsp.mix(cycles)
out = dsp.pine(out, dsp.stf(60 * 8), 80.0 * 2)

cycles = [ make_cycles(dsp.stf(60 * 8)) for i in range(4) ]
cycles = dsp.mix(cycles)

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

dsp.write(out, 'newly')
示例#45
0
        pattern = ctl.parseBeat(bloopp)
        bloops = ctl.makeBeat(pattern, [ beat / 2 for _ in range(16) ], makeBloop, bfreqs)

        layers += [ bloops ]

    if canPlay('arps', section):
        arpses = dsp.mix([ makeArps(dsp.flen(bar), beat, cname) for _ in range(dsp.randint(2,4)) ])
        layers += [ arpses ]

    if section not in ('intro', 'ending'):
        rfreqs = tune.chord(cname, key, 2)
        maxbend = 0.005 if dsp.rand() > 0.3 else 0.05
        rhodeses = makeRhodes(dsp.flen(bar), beat, rfreqs, maxbend)
        layers += [ rhodeses ]

    papers = dsp.fill(dsp.amp(makePaper(paper), dsp.rand(2, 4)), dsp.flen(bar), silence=True)
    if section == 'intro' and dsp.rand() > 0.5:
        papers = fx.bend(papers, [ dsp.rand() for _ in range(dsp.randint(5, 10)) ], dsp.rand(0, 0.5))

    layers += [ papers ]

    bar = dsp.mix(layers)

    out += bar

    elapsed += dsp.flen(bar)
    count += 1
    section = nextSection(section, count, numsections, ending_length)

dsp.write(out, '03-the_green_green_horse')
示例#46
0
    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

#freqs = tune.fromdegrees([1,3,5,6,9], 6, 'a')
freqs = None
out = ''.join([ ping(dsp.mstf(200), freqs) for i in range(100)])

dsp.write(out, 'twenty')
示例#47
0
#!/usr/bin/env python
"""
pip install pippi
"""
import sys
from pippi import dsp
out = dsp.tone(dsp.stf(5), freq=220, amp=0.2)
out = dsp.env(out, 'hann')
#dsp.write(out, 'hello')
#'hello.wav'
dsp.write(sys.stdout)
示例#48
0
    #kicks = dsp.fill(kick, dsp.flen(layers), silence=True)

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

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

    d = dsp.amp(d, 3)

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

    ost = keys.rhodes(beat, tune.ntf('c', octave=4), 0.6)
    ost = dsp.env(ost, 'phasor')
    numosts = dsp.flen(layers) / dsp.flen(ost)
    ost = ''.join([ dsp.alias(ost) for _ in range(numosts) ]) 
    layers = dsp.mix([ layers, ost ])

    out += layers

dsp.write(out, 'out')
示例#49
0
        tones = []
        freq = tune.ntf(note, octave, ratios) 

        for i in range(30):
            angles = dsp.breakpoint([freq * dsp.randchoose(harm) for f in range(dsp.randint(3, 50))], dsp.randint(350, 500))
            alen = int(length / len(angles)) * 2

            angles = [ dsp.env(dsp.tone(alen, a, 'random'), 'sine') for a in angles ]

            # Each overtone blip should overlap by about 50% with its neighbor...
            lowangles = ''.join([ angle for i, angle in enumerate(angles) if i % 2 == 0 ])

            highangles = [ angle for i, angle in enumerate(angles) if i % 2 != 0 ]
            highangles[0] = dsp.cut(highangles[0], dsp.flen(highangles[0]) / 2, dsp.flen(highangles[0]) / 2)
            highangles = ''.join(highangles)

            tones += [ dsp.benv(dsp.amp(dsp.mix([lowangles, highangles]), 0.9), [dsp.rand(0.1, 0.9) for i in range(dsp.randint(5, 30))]) ]

        tones = dsp.mix(tones)
        #tonic = dsp.env(dsp.amp(dsp.tone(int(length * 0.6), freq, 'sine2pi'), 0.1), 'flat')

        #layers += [ dsp.mix([tones, tonic], False) ]
        layers += [ tones ]

    out = dsp.mix(layers)

    return dsp.amp(out, volume)

if __name__ == '__main__':
    print dsp.write(play([]), 'weeooo')
示例#50
0
        serialInput= ser.readline().split()
        #    print serialInput
        #    serialInput = serialInput.split()
        if len(serialInput) == 4:
            instrument=int(float(serialInput[0]))+1 # pin number
            amplitude=(int(float(serialInput[1]))%10)/10.0 #humidity
            freq=float(serialInput[2])*(instrument+1)*10 #temperature
            tempo=float(serialInput[3]) #tempo
        
        else:
            instrument=1 # pin number
            amplitude=0.2 #humidity
            freq=440 #temperature
            tempo=14 #tempo
            #print serialInput

            #print freq
        out.append(dsp.tone(dsp.stf(instrument),freq,'sine2pi', amplitude))
            #    print notes
        notes+=1

            #print out
            #out = [dsp.env(o , sine'])) for o in out]
    out = [dsp.env(o , dsp.randchoose(['hann', 'tri', 'sine'])) for o in out]
    out = dsp.mix(out)
    dsp.write(out, 'sample')    

#main()
out=dsp.mix(arpeggiate(440))
dsp.write(out, 'arp')
示例#51
0
boids = [[dsp.rand(0, 1) for _ in range(numpoints + 1)]
         for b in range(numboids)]

for p in range(numpoints - 1):
    center = 0
    for b in boids:
        center += b[p]

    center = center / float(numboids)

    for i, b in enumerate(boids):
        boids[i][p + 1] = boids[i][p] - ((center - boids[i][p]) / 1000.0)

out = []

freq = 300
wf = dsp.wavetable('sine2pi', 512)
win = dsp.wavetable('hann', 512)
length = dsp.stf(60)
pw = 1
modrange = 300
modfreq = 1.0 / 60

for b in boids:
    out += [dsp.pulsar(freq, length, pw, wf, win, b, modrange, modfreq, 0.1)]

out = dsp.mix(out)

dsp.write(out, 'boids')
示例#52
0
        'ping a ding a ding a', 
        'sling ding a bing ling ding a', 

        'ee oh ee oh see low', 
        'me low see low tree low',

        'sing a ling a ling a', 
        'ding ling a sing ling ding a', 

        'ee oh ee oh see low', 
        'me low see low tree low',


        ]

layers = []

# v1: 1 layers, 50 - 1000 mult
# v2: 3 layers, 50 - 1000 mult
# v3: 2 layers, 50 - 100 mult

for l in range(2):
    out = ''.join([ singit(lyric, dsp.randint(50, 100)) for lyric in verses ])

    layers += [ out ]

out = dsp.mix(layers)

dsp.write(out, 'sing')
示例#53
0
        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)
            grain = dsp.env(grain, 'phasor')
            grain = dsp.taper(grain, dsp.mstf(10))
            grain = dsp.pan(grain, p)
            
            grains += grain

        layers += [ dsp.env(grains, 'phasor') ]

    out += dsp.mix(layers)

dsp.write(out, 'spiderfall')
示例#54
0
    for bit in layer:
        if dsp.rand() > 0.75:
            bit = ''.join([ dsp.pan(dsp.amp(bit, dsp.rand(0.1, 10)), dsp.rand()) for _ in range(dsp.randint(2, 10)) ])

        bits += [ bit ]

    layer = ''.join(bits)

    layers += [ layer ]

out = dsp.mix(layers)

now = datetime.now()
filename = 'fart-%s-%s-%s-%s' % (now.year, now.month, now.day, now.hour)

dsp.write(out, filename)
print 'rendered'

print subprocess.call('sox %s.wav -C 320 %s.mp3 norm' % (filename, filename), shell=True)
print subprocess.call('scp %s.mp3 hecanjog.com:hecanjog.com/farts/' % filename, shell=True)

# Authenticate w/ twitter as @fartsynthesis
consumer_key = os.environ['FART_CONSUMER_KEY']
consumer_secret = os.environ['FART_CONSUMER_SECRET']
access_token = os.environ['FART_ACCESS_KEY']
access_token_secret = os.environ['FART_ACCESS_SECRET']
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

# Make the fart hashtag
示例#55
0
from matplotlib import pyplot as pp
from pippi import dsp
from hcj import data

length = dsp.stf(3)

curves = tuple(
    [data.Logistic(dsp.rand(3.8, 4), 0.1, length).data for _ in range(3)])
y = [(a * b * c) / 3.0 for a, b, c in zip(*curves)]

freq = (1.0 / 3) / 200.0
amp = 0.5

out = dsp.ctone(freq, length, y, amp)
dsp.write(out, 'plot')

#x = range(len(y))
#pp.plot(x, y)
#pp.grid(True)
#pp.show()
示例#56
0
    pans = dsp.breakpoint([dsp.rand() for _ in range(55)], numgrains)
    lens = [
        dsp.mstf(l * 80 + 20)
        for l in dsp.wavetable('line', numgrains / dsp.randint(50, 100))
    ]
    seeds = [
        s * 0.3 + 3.69
        for s in dsp.wavetable('line', numgrains / dsp.randint(50, 100))
    ]
    freqs = [
        f * 90 + 10
        for f in dsp.wavetable('line', numgrains / dsp.randint(50, 100))
    ]

    for freq, seed, length, pan in zip(freqs, seeds, lens, pans):
        log = data.Logistic(seed, 0.5, 555)
        amp = dsp.rand(0.1, 0.75)

        grain = dsp.ctone(freq, length, log.data, amp)
        grain = dsp.env(grain, 'random')
        grain = dsp.taper(grain, dsp.mstf(5))
        grain = dsp.pan(grain, pan)

        layer += grain

    layers += [layer]

out = dsp.mix(layers)

dsp.write(out, 'cdelsu')
示例#57
0
def play(voice_id):
    out = rt.capture(dsp.mstf(2000))
    dsp.write(out, 'sounds/input')

    return ''
示例#58
0
layers = []

for layer in range(10):
    beats_steady = [beat for b in range(numbeats / 10)]
    beats_div = dsp.breakpoint([dsp.rand(1, 200) for b in range(10)],
                               numbeats - len(beats_steady))
    ramp = dsp.wavetable('line', len(beats_div))

    beats_div = [beat + dsp.mstf(d * r) for d, r in zip(beats_div, ramp)]

    beats = beats_steady + beats_div
    freqs = dsp.wavetable(dsp.randchoose(['line', 'phasor', 'tri', 'hann']),
                          len(beats))
    freqs = [freq + (100 * f) for f in freqs]

    layer = ''

    for b, f in zip(beats, freqs):
        blip = dsp.tone(length=b, freq=f, amp=dsp.rand(0.01, 0.2))
        blip = dsp.env(blip, 'phasor')
        blip = dsp.taper(blip, dsp.mstf(5))
        blip = dsp.pan(blip, dsp.rand())

        layer += blip

    layers += [layer]

out = dsp.mix(layers)

dsp.write(out, 'blipspray')
示例#59
0
文件: thirty.py 项目: hecanjog/w30
import audioop

thirty = dsp.read('thirty.wav').data
wesley = dsp.read('wesley.wav').data
snds = [thirty, wesley]

## 01
out = ''
t = thirty * 30
t = dsp.pan(t, 0)

tt = dsp.cut(thirty, 0, dsp.flen(thirty) - dsp.mstf(30)) * 30
tt = dsp.pan(tt, 1)

out = dsp.mix([ t, tt ])
dsp.write(out, 'wesley_thirty_01')

## 02
out = ''
t = dsp.split(thirty, dsp.mstf(40))
t = [ dsp.env(tt, 'sine') for tt in t ]
t = [ tt * 4 for tt in t ]

out = ''.join(t)

dsp.write(out, 'wesley_thirty_02')

## 03
out = ''

freqs = tune.fromdegrees([1, 3, 5, 9], 3, 'c')
示例#60
0
    freqs = [ tune.fromdegrees([ cr - 1 for cr in chords[root]], 3, 'c', scale=range(12)) for root in roots ]

    return freqs

out = ''

for times in range(1):
    freqs = make_chords()

    for r in range(6):
        layers = []

        for i in range(3):
            f = freqs[r % len(freqs)]

            notes = []
            for n in range(dsp.randint(70, 100)):
                note_len = dsp.mstf(dsp.rand(30, 40))
                note_freq = f[n % len(f)]
                note = rhodes.rhodes(note_len, note_freq)
                note = dsp.pine(note, note_len * 4, note_freq)

                notes += [ note ]

            layers += [ ''.join(notes) ]

        out += dsp.mix(layers)

dsp.write(out, 'riley')