Skip to content

Instantly share code, notes, and snippets.

@hecanjog

hecanjog/ding.py Secret

Created May 11, 2019 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hecanjog/e5df7913184334d72ac941c0ab9f8aca to your computer and use it in GitHub Desktop.
Save hecanjog/e5df7913184334d72ac941c0ab9f8aca to your computer and use it in GitHub Desktop.
asmallthing
import random
from pippi import dsp, oscs, fx
from pippi.wavesets import Waveset
MIDI = 'nano'
SOUNDS = {'src': 'sounds/doublevoice.wav'}
LOOP = True
def onsets(ctx):
return [ dsp.rand(0.01, 2) for _ in range(6) ]
def play(ctx):
src = ctx.sounds.get('src')
nk = ctx.m(MIDI)
m1 = nk.cc1
length = dsp.rand(4, 8)
amp = dsp.rand(0.1, 0.5)
freq = dsp.choice([
100, 200, 300, 400,
#500, 600, 700, 900,
])
freq *= 2**dsp.randint(-1, 5) * 0.5
chunk = src.rcut(1)
numwavesets = dsp.randint(4, 10)
waveset = Waveset(chunk, limit=numwavesets, offset=0)
waveset.normalize()
osc = oscs.Pulsar2d(waveset,
windows=['sine'],
wt_mod=dsp.win('rnd', 0, 1),
pulsewidth=dsp.win('rnd', dsp.rand(0.5, 0.9), 1),
freq=freq,
amp=amp,
)
tail = dsp.rand(0.01, 0.1)
env = dsp.win('hann', 0, 0.9-tail).skewed(dsp.rand(0.005,0.1)).rightpadded(0, mult=dsp.rand(1, 100))
env = env + dsp.win('hannout', 0, tail, len(env))
out = osc.play(length).env(env).taper(0.03)
out = out.pan(dsp.rand())
if dsp.rand() > 0.5:
env = env.reversed()
if dsp.rand() > 0.75:
out = Waveset(out).stretch(dsp.win('rnd', 1, dsp.rand(2, 4)))
if dsp.rand() > 0.5:
yield fx.bpf(out, dsp.win(env, freq, freq*2))
else:
yield out
import random
from pippi import dsp, oscs, fx
from pippi.wavesets import Waveset
from astrid import player
# Drone end: 1:52.5 - 1:55
# Approaching car: 3:40.5 - 3:55
# Window shut: 3:55 - 4:01.5
MIDI = 'nano'
SOUNDS = {'rain': 'sounds/rain.wav'}
LOOP = True
OVERLAP = 0.5
ROOT = 64.6
def drone_onsets(ctx):
return [ 0 ]
def drone(ctx):
freq = dsp.choice([100, 200, 300, 400, 600])
freq *= 2**dsp.randint(-2, 1) * 0.5
speed = freq / ROOT
rain = ctx.sounds.get('rain')
if dsp.rand() > 0.75:
out = rain.cut(0, 60 + 52) * 0.1
else:
out = rain.cut(60 + 52, 60) * 0.1
out = fx.lpf(out, dsp.rand(100, 300.0))
out = out.rcut(dsp.rand(5, 10)).speed(speed)
out = out.cloud(
length=dsp.rand(10, 20),
grainlength=dsp.win('rnd', 0.2, 0.75),
spread=1,
)
yield out.env('hann')
PLAYERS = set([(drone, drone_onsets)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment