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

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

        arps = []

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

            stack = Waveset(rmx, limit=dsp.randint(5, 20), offset=dsp.randint(0, 100))
            stack.normalize()
            arp_one = oscs.Pulsar2d(stack, windows=['tri'], freq=arp_pair[0]*dsp.choice([1,2]), pulsewidth=dsp.win('rnd', 0.1, 1)).play(arp_length).env('hannout').taper(0.01) * dsp.rand(0.02, 0.2)

            arp_two = oscs.Pulsar2d(stack, windows=['tri'], freq=arp_pair[1]*dsp.choice([1,2]), pulsewidth=dsp.win('rnd', 0.1, 1)).play(arp_length).env('hannout').taper(0.01) * dsp.rand(0.02, 0.2)
            arp_one.dub(arp_two)
            arps += [ arp_one ]
            arp_count += 2

        return dsp.join(arps).env('rnd').pan(dsp.rand())
Esempio n. 2
0
def theme_synth(length, pos, total_length):
    notes = [ rhodes.rhodes(dsp.rand(4, 7), freq, 0.3) for freq in scale ]
    themes = [ [ note.speed(dsp.choice(speeds)) for note in notes * 2 ] for theme in range(8) ]
    theme = dsp.choice(themes)
    theme_note = dsp.choice(theme)

    note = fx.crush(theme_note)

    return fx.lpf(fx.softclip(note), dsp.win('rnd', 1000, 5000))
Esempio n. 3
0
def bass_and_lead(length, pos, total_length):
    numbeats = int(length//BEAT)
    maxbeats = dsp.randint(2, 16)
    layers = []
    def bass(amp, length, oct=2):
        if amp == 0:
            return dsp.buffer(length=length)

        bass_note = dsp.choice(scale) * 0.25

        stack = Waveset(rmx, limit=dsp.randint(5, 20), offset=dsp.randint(0, 100))
        stack.normalize()
        out = oscs.Pulsar2d(stack, windows=['sine'], freq=bass_note).play(length) * dsp.rand(0.02, 0.2)
        out = fx.lpf(out, bass_note*2)

        return out.env('hannout').taper(dsp.MS*10)

    if dsp.rand() > 0.5:
        basses = bass(0.5, length, 1)
    else:

        bpat = drums.eu(numbeats, maxbeats)
        basses = drums.make(bass, bpat, [BEAT]*numbeats)

    layers += [ basses ]

    lead_note = dsp.choice(scale)
    stack = Waveset(rmx, limit=dsp.randint(5, 20), offset=dsp.randint(0, 100))
    stack.normalize()
    lead = oscs.Pulsar2d(stack, windows=['tri'], freq=lead_note*2, pulsewidth=dsp.win('rnd', 0.1, 1)).play(length/dsp.rand(1,5)).env('hannout').taper(0.01) * dsp.rand(0.02, 0.2)

    layers += [ lead ]

    return fx.norm(dsp.mix(layers), 1)
Esempio n. 4
0
    def hat(length):
        lowf = dsp.rand(6000, 11000)
        highf = dsp.rand(11000, 17000)

        if dsp.rand() > 0.5:
            length *= 0.05
        
        out = bln(length, lowf, highf)
        out = out.env(dsp.choice(['rsaw', 'phasor', 'hannout']))

        return out
Esempio n. 5
0
    def bass(amp, length, oct=2):
        if amp == 0:
            return dsp.buffer(length=length)

        bass_note = dsp.choice(scale) * 0.25

        stack = Waveset(rmx, limit=dsp.randint(5, 20), offset=dsp.randint(0, 100))
        stack.normalize()
        out = oscs.Pulsar2d(stack, windows=['sine'], freq=bass_note).play(length) * dsp.rand(0.02, 0.2)
        out = fx.lpf(out, bass_note*2)

        return out.env('hannout').taper(dsp.MS*10)
Esempio n. 6
0
def grain_synth(length, pos, total_length):
    notes = [ rhodes.rhodes(dsp.rand(4, 7), freq, 0.3) for freq in scale ]
    themes = [ [ note.speed(dsp.choice(speeds)) for note in notes * 2 ] for theme in range(8) ]
    theme = dsp.choice(themes)
    theme_note = dsp.choice(theme)

    def makeGrains(snd):
        envs = ['tri', 'phasor', 'rsaw', 'sine', 'hann']
        grains = []
        for g in snd.grains(dsp.MS*20, dsp.MS*90):
            g = g.env('hann').pan(dsp.rand()).taper(dsp.MS*4)
            grains += [ g ]

        rgrains = []
        while len(grains) > 0:
            r = grains.pop(dsp.randint(0, len(grains)-1))
            rgrains += [ r ]

        out = dsp.join(rgrains)
        out = out.env(dsp.choice(envs))

        return out

    if dsp.rand() > 0.5:
        gnote = theme_note.speed(1.5)
    else:
        gnote = theme_note

    grains = [ makeGrains(gnote) for g in range(dsp.randint(4, 10)) ]
    for gi, grain in enumerate(grains):
        if dsp.rand() > 0.5:
            grains[gi] = grain.speed(2).taper(0.01).repeat(2)

    grains = dsp.mix(grains)
    grains = grains * dsp.rand(0.25, 0.55)
    grains = mixdrift(grains)

    return grains
Esempio n. 7
0
    def makeGrains(snd):
        envs = ['tri', 'phasor', 'rsaw', 'sine', 'hann']
        grains = []
        for g in snd.grains(dsp.MS*20, dsp.MS*90):
            g = g.env('hann').pan(dsp.rand()).taper(dsp.MS*4)
            grains += [ g ]

        rgrains = []
        while len(grains) > 0:
            r = grains.pop(dsp.randint(0, len(grains)-1))
            rgrains += [ r ]

        out = dsp.join(rgrains)
        out = out.env(dsp.choice(envs))

        return out
Esempio n. 8
0
    def test_playall(self):
        events = []
        pos = 0
        length = 3
        freqs = tune.degrees(list(range(1, 13)))

        while pos < length:
            events += [
                dsp.event(
                    onset=pos,
                    length=dsp.rand(0.1, 3),
                    freq=dsp.choice(freqs) * 2**dsp.randint(0, 3),
                    amp=dsp.rand(),
                    voice=dsp.randint(0, 127),
                )
            ]

            pos += 0.25

        out = soundfont.playall("tests/sounds/florestan-gm.sf2", events)
        out = fx.norm(out, 0.5)
        out.write('tests/renders/soundfont_playall.wav')
Esempio n. 9
0
def grow(db, length=10):
    return dsp.choice(CROPS)(db, length)
Esempio n. 10
0
def drumset(length, pos, total_length):
    print('DRUMSET', length, pos)

    if length < 10:
        div = dsp.choice([2,3,4])
    else:
        div = dsp.choice([4,6,8,12,16])

    beat = length / div
    seg = [ beat for _ in range(div) ]
    layers = []

    maxbeats = dsp.randint(len(seg) / 2, len(seg))
    hatpat = drums.eu(len(seg), maxbeats)

    hats = drums.make(drums.hihat, hatpat, seg) * 0.3
    hats = mixdrift(hats)

    if dsp.rand() > 0.5:
        hats = hats.cloud(length=length, grainlength=1.0/dsp.choice(scale))

    if dsp.rand() > 0.5:
        hats = mixdrift(hats)

    print('MADE HATS')
    layers += [ hats ]

    kpat = drums.eu(len(seg), maxbeats)
    kicks = drums.make(drums.kick, kpat, seg)

    if dsp.randint(0,1) == 1:
        kicks = kicks.cloud(length=length, grainlength=1.0/dsp.choice(scale))
    else:
        kdivs = dsp.randint(2, 4)
        kicks = kicks.cloud(length=length / kdivs, grainlength=(1.0/dsp.choice(scale)) * kdivs)

    if dsp.rand() > 0.5:
        kicks = mixdrift(kicks)

    layers += [ kicks * 0.4 ]

    maxbeats = dsp.randint(2, len(seg) / 2)
    clappat = drums.eu(len(seg), maxbeats)
    claps = drums.make(drums.clap, rotate(clappat, vary=True), seg)

    if dsp.randint(0,1):
        claps = claps.cloud(length=length, grainlength=1.0/dsp.choice(scale))
    else:
        cdivs = dsp.randint(2, 4)
        claps = claps.cloud(length=length / cdivs, grainlength=(dsp.choice(scale)) * cdivs)

    if dsp.rand() > 0.5:
        claps = mixdrift(claps)

    layers += [ claps * 0.4 ]

    drms = fx.softclip(dsp.mix(layers))
    if dsp.rand() > 0.5:
        return fx.lpf(drms, dsp.rand(500, 1000))
    else:
        return fx.bpf(drms, dsp.rand(500, 5000))
Esempio n. 11
0
def one(db, src):
    return dsp.choice(RECIPES)(db, src)