Exemple #1
0
def rush(snd):
    out = dsp.buffer()
    length = random.randint(4410, 44100 * 3)
    numbeats = random.randint(16, 64)
    reverse = random.choice([True, False])
    wintype = random.choice(
        ['sine', 'tri', 'kaiser', 'hann', 'blackman', None])
    wavetable = None if wintype is not None else [
        random.random() for _ in range(random.randint(3, 10))
    ]
    pattern = rhythm.curve(numbeats=numbeats,
                           wintype=wintype,
                           length=length,
                           reverse=reverse,
                           wavetable=wavetable)
    minspeed = random.triangular(0.15, 2)

    pan = random.random()

    for onset in pattern:
        hit = snd * random.triangular(0, 0.5)
        hit = hit.speed(random.triangular(minspeed, minspeed + 0.08))
        hit = hit.pan(pan)
        out.dub(hit, onset)

    return out
Exemple #2
0
def arp(i):
    cluster = dsp.buffer()
    length = random.randint(44100, 44100 + 22050)
    numnotes = random.randint(3, 12)
    onsets = rhythm.curve(numnotes, dsp.RND, length)
    chord = chords[i % len(chords)]
    freqs = tune.chord(chord, octave=random.randint(1, 3))
    for i, onset in enumerate(onsets):
        freq = freqs[i % len(freqs)]
        note = samp.play(freq)
        note = note.pan(random.random())
        note *= random.triangular(0, 0.125)
        cluster.dub(note, onset / cluster.samplerate)

    return cluster
Exemple #3
0
def makesnares():
    out = dsp.buffer(length=1)
    beat = length
    numbeats = 16 * 4 * lenmult
    pat = rhythm.topattern('..x...x...x...xx..x...x...x....x')
    onsets = rhythm.onsets(pat, beat, numbeats)

    for i, pos in enumerate(onsets):
        if random.random() > 0.75:
            s = dsp.buffer(length=1)
            p = rhythm.curve(numbeats=random.randint(4, 10), wintype='random', length=beat*random.randint(2,3))
            for o in p:
                s.dub(snare.speed(random.triangular(0.9,1.1)) * random.random(), o)

            out.dub(s, pos)

        out.dub(snare, pos)

    return out
Exemple #4
0
    reverse = random.choice([True, False])

    # Randomly choose a window function for `rhythm.curve`
    wintype = random.choice(
        ['sine', 'tri', 'kaiser', 'hann', 'blackman', None])

    # If wintype is None, generate a random list of values to use as a wavetable
    wavetable = None if wintype is not None else [
        random.random() for _ in range(random.randint(3, 10))
    ]

    # Create a list of onset times for the above params, which we'll use as positions
    # to dub the snare sound into the output buffer.
    pattern = rhythm.curve(numbeats=numbeats,
                           wintype=wintype,
                           length=length,
                           reverse=reverse,
                           wavetable=wavetable)

    # Set the base speed for the sound -- the snare will be pitch shifted by this amount + some jitter
    minspeed = random.triangular(0.15, 2)

    # Pick a random place in the stereo field for this pass of snare hits
    pan = random.random()

    for onset in pattern:
        # Loop through the pattern and make a pass through the output buffer,
        # dubbing snares into it at the given onset positions

        # Copy the snare and scale its amplitude (the * operation will return a copy of the sound)
        hit = snare * random.triangular(0, 0.5)
from pippi import dsp, rhythm
import random

out = dsp.buffer()

snare = dsp.read('sounds/snare.wav')

pattern = rhythm.curve(numbeats=64, wintype=dsp.SINE, length=44100 * 4)

for onset in pattern:
    out.dub(snare * random.random(), onset / out.samplerate)

out.write('simple_snare_bounce.wav')
Exemple #6
0
from pippi import dsp, rhythm
import random

out = dsp.buffer()

snare = dsp.read('sounds/snare.wav')

pattern = rhythm.curve(numbeats=64, wintype='sine', length=44100 * 4)

for onset in pattern:
    out.dub(snare * random.random(), onset)

out.write('beat_example.wav')