Skip to content

Instantly share code, notes, and snippets.

@yarogniew
Created June 7, 2018 16:33
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 yarogniew/ece187ed08b56605691c321443ed9304 to your computer and use it in GitHub Desktop.
Save yarogniew/ece187ed08b56605691c321443ed9304 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf-8
from pyo import *
import random
import math
s = Server().boot()
s.start()
# s.amp = 0.1
# ChebyTable
t = ChebyTable([1,0,.33,0,.2,0,.143,0,.111])
lfo = Sine(freq=.25, mul=0.45, add=0.5)
a = Sine(freq=[200,201], mul=lfo)
b = Lookup(table=t, index=a, mul=1-lfo).out()
# CosLogTable
# t = CosLogTable([(0,0), (4095,1), (8192,0)])
# a = Osc(table=t, freq=2, mul=.25)
# b = SineLoop(freq=[599,600], feedback=0.05, mul=a).out()
# CosTable
# # Sharp attack envelope
# t = CosTable([(0,0), (100,1), (1000,.25), (8191,0)])
# a = Osc(table=t, freq=2, mul=.25)
# b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
# CurveTable
# t = CurveTable([(0,0),(2048,.5),(4096,.2),(6144,.5),(8192,0)], 0, 20)
# t.normalize()
# a = Osc(table=t, freq=2, mul=.25)
# b = SineLoop(freq=[299,300], feedback=0.05, mul=a).out()
# DataTable
# notes = [midiToHz(random.randint(48,72)) for i in range(10)]
# tab = DataTable(size=10, init=notes)
# ind = RandInt(10, 8)
# pit = TableIndex(tab, ind)
# a = SineLoop(freq=[pit,pit*0.99], feedback = 0.07, mul=.2).out()
# Exp Table
# t = ExpTable([(0,0),(4096,1),(8192,0)], exp=5, inverse=True)
# a = Osc(table=t, freq=2, mul=.3)
# b = Sine(freq=[299,300], mul=a).out()
# Hann Table
# # Hanning envelope
# t = HannTable()
# a = Osc(table=t, freq=2, mul=.2)
# b = Sine(freq=[299, 300], mul=a).out(0)
#
# HarmTable
# Square wave up to 9th harmonic
# t = HarmTable([1,0,.33,0,.2,0,.143,0,.111])
# c = Osc(table=t, freq=[299, 300], mul=.2).out(1)
#
# LinTable
# # Sharp attack envelope
# t = LinTable([(0,0), (100,1), (1000,.25), (8191,0)])
# a = Osc(table=t, freq=2, mul=.25)
# b = SineLoop(freq=[299, 300], feedback=0.05, mul=a).out()
# LogTable
# t = LogTable([(0, 0), (4095, 1), (8192, 0)])
# a = Osc(table=t, freq=2, mul=.25)
# b = SineLoop(freq=[599, 600], feedback=0.05, mul=a).out()
# NewTable
# t = NewTable(length=2, chnls=1)
# a = Input(0)
# b = TableRec(a, t, .01)
# amp = Iter(b["trig"], [.5])
# freq = t.getRate()
# c = Osc(table=t, freq=[freq, freq*.99], mul=amp).out()
# # to record in the empty table, call:
# # b.play()
# ParaTable
# # Parabola envelope
# t = ParaTable()
# a = Osc(table=t, freq=2, mul=.2)
# b = SineLoop(freq=[599,600], feedback=0.05, mul=a).out()
# PartialTable
# t = PartialTable([(1,1), (2.37, 0.5), (4.55, 0.3)]).normalize()
# # Play with fundamentals 199 and 200 Hz
# a = Osc(table=t, freq=[1.99,2], mul=.2).out()
# SawTable
# t = SawTable(order=12).normalize()
# a = Osc(table=t, freq=[199,200], mul=.2).out()
# SincTable
# t = SincTable(freq=math.pi*6, windowed=True)
# a = Osc(t, freq=[199,200], mul=.2).out()
# SndTable
# snd_path = SNDS_PATH + '/transparent.aif'
# t = SndTable(snd_path)
# freq = t.getRate()
# a = Osc(table=t, freq=[freq, freq*.995], mul=.3).out()
# SquareTable
# t = SquareTable(order=15).normalize()
# a = Osc(table=t, freq=[199,200], mul=.2).out()
# # WinTable
# # Triangular envelope
# t = WinTable(type=3)
# a = Osc(table=t, freq=2, mul=.2)
# b = SineLoop(freq=[199,200], feedback=0.05, mul=a).out()
# # AtanTable
# t = AtanTable(slope=0.8)
# a = Sine(freq=[149,150])
# l = Lookup(table=t, index=a, mul=0.3).out()
# # PadSynthTable
# f = s.getSamplingRate() / 262144
# t = PadSynthTable(basefreq=midiToHz(32), spread=1.205, bw=10, bwscl=1.5)
# a = Osc(table=t, freq=f, phase=[0, 0.5], mul=0.5).out()
# # SharedTable
# # Creating parent table.
# table = SharedTable(["/sharedl", "/sharedr"], True, s.getBufferSize())
# # Creating child table.
# shared = SharedTable(["/sharedl", "/sharedr"], False, s.getBufferSize())
# # Read and output the content of the parent table.
# tabread = TableRead(table, table.getRate(), True).out()
# # Record some signal signal in the child table.
# lfo = Sine(freq=[0.2, 0.25]).range(98, 102)
# wave = LFO(freq=lfo, type=4, sharp=0.7, mul=0.3)
# pos = Phasor(shared.getRate())
# record = TableWrite(wave, pos, shared)
s.gui(locals())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment