Пример #1
0
def rhodes(total_time, freq=220.0, ampscale=0.5):
    freq *= 2**dsp.randint(0, 2)
    partials = [
        # Multiple, amplitude, duration
        [1, 0.6, 1.0],
        [2, 0.25, 0.35],
        [3, 0.08, 0.15],
        [4, 0.005, 0.04],
    ]

    layers = []
    for plist in partials:
        #env_length = (total_time * plist[2] * 2) / 32
        partial = oscs.Osc('sine',
                           freq=plist[0] * freq,
                           amp=plist[1] *
                           ampscale).play(total_time).env('hannout')

        #partial = dsp.split(partial, 32)
        #partial = [ dsp.amp(partial[i], wtable[i]) for i in range(len(partial)) ]
        #layer = ''.join(partial)

        layers += [partial]

    out = dsp.mix(layers)
    n = noise.bln('sine', out.dur, 2000, 20000) * 0.005

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

    return out
Пример #2
0
def makekick(length=0.25):
    out = noise.bln('square', length,
                    [dsp.rand(80, 100), dsp.rand(50, 100)],
                    [dsp.rand(150, 200), dsp.rand(50, 70)])
    out = fx.fold(out, amp=dsp.win('saw', 1, dsp.rand(6, 10)))
    out = fx.lpf(out, 200).vspeed([1, 0.5])
    return out.env('pluckout').taper(0.02) * dsp.rand(0.6, 1)
    def __init__(self, params):
        buff = SoundBuffer(channels=1)
        length = 1
        if params.isNoise == 1:
            buff = noise.bln(params.getOscType(),
                             params.getLength(),
                             30,
                             150000,
                             channels=1)
        else:
            buff = Osc(str(params.getOscType()),
                       freq=list(params.getPitches()),
                       channels=1).play(params.getLength())

        buff = buff.adsr(a=params.A, d=params.D, s=params.S, r=params.R)
        bpfilter = params.getBandPass()
        buff.frames = helpers.butter_bandpass_filter(buff.frames,
                                                     bpfilter[0],
                                                     bpfilter[1],
                                                     sr,
                                                     order=bpfilter[2])
        #a high pass
        buff.frames = helpers.butter_bandpass_filter(buff.frames,
                                                     80,
                                                     15000,
                                                     sr,
                                                     order=8)
        self.buff = buff
Пример #4
0
def makekick(ctx):
    length = kick_lfo.interp(ctx.pos)
    out = noise.bln('square', length,
                    [dsp.rand(80, 100), dsp.rand(50, 100)],
                    [dsp.rand(150, 200), dsp.rand(50, 70)])
    out = fx.crush(out, dsp.rand(6, 10), dsp.rand(11000, 44100))
    out = fx.lpf(out, 200).vspeed([1, 0.5])
    return out.env('pluckout').taper(0.02) * dsp.rand(0.6, 1)
Пример #5
0
def play(ctx):
    length = dsp.rand(6, 12)
    highfreq = dsp.rand(10000, 20000)
    lowfreq = highfreq - dsp.rand(1000, 5000)
    out = noise.bln('sine', length, lowfreq, highfreq)
    out = out.env('hann') * dsp.rand(0.01, 0.04)
    out = out.pan('rnd')

    yield out
    def __init__(self, params):
        buff = SoundBuffer(channels=1)
        length = 1
        if params.isNoise == 1:
            buff = noise.bln(str(params.oscType),
                             params.length,
                             30,
                             150000,
                             channels=1)
        else:
            buff = Osc(str(params.oscType), freq=params.pitches,
                       channels=1).play(params.length)

        buff = buff.adsr(a=params.A, d=params.D, s=params.S, r=params.R)
        buff.frames = butter_bandpass_filter(buff.frames,
                                             params.bpCutLow,
                                             params.bpCutHigh,
                                             sr,
                                             order=params.bpOrder)
        self.buff = buff
Пример #7
0
def makeclap(length=dsp.MS * 80):
    lowhz = dsp.win('rnd', 3000, 6000)
    highhz = dsp.win('rnd', 2000, 8000)
    return noise.bln('tri', length, lowhz, highhz).env(pluckout)
Пример #8
0
def makeclap(ctx):
    length = clap_lfo.interp(ctx.pos)
    lowhz = dsp.win('rnd', 3000, 6000)
    highhz = dsp.win('rnd', 2000, 8000)
    return noise.bln('tri', length, lowhz, highhz).env('pluckout')
Пример #9
0
def makehat(ctx):
    length = hat_lfo.interp(ctx.pos)
    lowhz = dsp.win('rnd', 9000, 11000)
    highhz = dsp.win('rnd', 12000, 14000)
    return noise.bln('sine', length, lowhz, highhz).env('pluckout') * 0.5
Пример #10
0
def makehat(length=dsp.MS * 80):
    lowhz = dsp.win('rnd', 9000, 11000)
    highhz = dsp.win('rnd', 12000, 14000)
    return noise.bln('sine', length, lowhz, highhz).env(pluckout) * 0.5
Пример #11
0
from pippi import dsp

lowhz = dsp.win('hannin', 9000, 11000)
highhz = dsp.win('hannin', 12000, 14000)

# Graph it
lowhz.graph('docs/tutorials/figures/002-hann-curve.png')

pluckout = dsp.win('pluckout')
pluckout.graph('docs/tutorials/figures/002-pluckout.png')

from pippi import noise

hat = noise.bln('sine', dsp.MS * 80, lowhz, highhz)
hat = hat.env(
    pluckout
) * 0.5  # Also multiply by 0.5 to reduce the amplitude of the signal by half
hat.write('docs/tutorials/renders/002-plucked-hat.flac')


def makehat(length=dsp.MS * 80):
    lowhz = dsp.win('rnd', 9000, 11000)
    highhz = dsp.win('rnd', 12000, 14000)
    return noise.bln('sine', length, lowhz, highhz).env(pluckout) * 0.5


lfo = dsp.win('sinc', 0.1,
              1)  # Hat lengths between 100ms and 1s over a sinc window
lfo.graph('docs/tutorials/figures/002-sinc-win.png', label='sinc window')

out = dsp.buffer(length=30)
Пример #12
0
def bln(length, low=3000.0, high=7100.0, wform='sine'):
    return noise.bln(wform, length, low, high)
Пример #13
0
 def test_bln_high(self):
     out = noise.bln('sine', 2, 8000, 15000).env('hann') * 0.1
     out.write('tests/renders/noise_bln_high.wav')
Пример #14
0
 def test_bln_low(self):
     out = noise.bln('sine', 2, 40, 200).env('hann') * 0.1
     out.write('tests/renders/noise_bln_low.wav')
Пример #15
0
 def test_bln_vary(self):
     lowf = dsp.win('rnd', 40, 1000)
     highf = dsp.win('rnd', 1000, 15000)
     out = noise.bln('sine', 2, lowf, highf).env('hann') * 0.1
     out.write('tests/renders/noise_bln_vary.wav')
Пример #16
0
 def test_bln_wide(self):
     out = noise.bln('sine', 2, 40, 15000).env('hann') * 0.1
     out.write('tests/renders/noise_bln_wide.wav')