Upload a heap of files

they were on the pi so here you go lol
This commit is contained in:
2018-07-19 15:37:45 +01:00
committed by GitHub
parent 5655563603
commit e448539c60
19 changed files with 1275 additions and 0 deletions
BIN
View File
Binary file not shown.
+146
View File
@@ -0,0 +1,146 @@
#!/usr/bin/env python
from pyo import *
import math, time
pa_list_devices()
pm_list_devices()
#print pm_get_default_input()
#--Server setup
s = Server()
s.setMidiInputDevice(1)
#print pm_get_default_input()
#print s.getMidiActive()
s.setBufferSize(1024)
s.setDuplex(0)
s.setOutputDevice(0)
s.setNchnls(1)
s.setSamplingRate(32000)
s.boot()
#print s.getMidiActive()
print 'Server booted!'
#s.amp = 0.5
#--TriTable import from examples (Not in normal libs?)
class TriTable(PyoTableObject):
def __init__(self, order=10, size=8192):
PyoTableObject.__init__(self, size)
self._order = order
self._tri_table = HarmTable(self._create_list(order), size)
self._base_objs = self._tri_table.getBaseObjects()
self.normalize()
def _create_list(self, order):
l = []
ph = 1.0
for i in range(1,order*2):
if i % 2 == 0:
l.append(0)
else:
l.append(ph / (i*i))
ph *= -1
return l
def setOrder(self, x):
self._order = x
self._tri_table.replace(self._create_list(x))
self.normalize()
self.refreshView()
@property
def order(self):
return self._order
@order.setter
def order(self, x): self.setOrder(x)
#--Startup noise
sn = Sine(440).out()
def call():
sn.stop()
cafter = CallAfter(call, 1)
#--Entire synth
note = Notein(scale=1,poly=10)
#note = Choice([440,220,880],4)
#dis=note
dis=note['pitch']
mod = Sig(0.5)
mod.ctrl(title='Modulation')
#mod.setValue(0.5)
prt = Sig(0.5)
prt.ctrl(title="Portamento")
porta = SigTo(value=dis,time=prt/5)
mod5 = mod-0.5
trmod = mod5*100
pitch = porta - trmod
#out = Sine(freq=pitch)
vibin = Sig(0.0)
vibin.ctrl(title='Vibrato')
#vibin.setValue(0.5)
volin = Sig(0.5)
volin.ctrl(title='Volume')
trvib = vibin*Sine(5)*5
wave = pitch + trvib
#out = Sine(wave).out()
tri = TriTable()
saw = SawTable()
squ = SquareTable()
wavetypenum = Sig(1)
wtslmap = SLMap(1,4,'lin','value',1,'int')
wavetypenum.ctrl([wtslmap],"Wave Type")
type1 = Sine(wave)
type2 = Osc(saw,wave)
type3 = Osc(squ,wave)
type4 = Osc(tri,wave)
audio1 = type1 + type2 + type3 + type4
def wavetype():
if wavetypenum.value.value == 1:
type1.mul = 1.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 0.0
elif wavetypenum.value.value == 2:
type1.mul = 0.0
type2.mul = 1.0
type3.mul = 0.0
type4.mul = 0.0
elif wavetypenum.value.value == 3:
type1.mul = 0.0
type2.mul = 0.0
type3.mul = 1.0
type4.mul = 0.0
elif wavetypenum.value.value == 4:
type1.mul = 0.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 1.0
else:
type1.mul = 1.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 0.0
p = Pattern(wavetype, 0.4).play()
def pstart():
p.play()
#CallAfter(pstart,1)
#audio1.out()
sabs = Abs(vibin)
fv = sabs + volin
cutoff = Sig(1.0)
cutoff.ctrl(title='LPF Cutoff')
fv5 = fv*cutoff*1000
LPF = Tone(audio1,fv5)
#LPF.ctrl()
src = LPF
#env = MidiAdsr(note['velocity'],attack=0.01,decay=0.5,sustain=0.7,release=0.25)
#env.ctrl()
#env.play()
src.mul = volin*2
src.out()
#-- End of synth
print 'Devices loaded'
print 'Starting server...'
#scope = Scope(src)
s.start()
s.gui(locals())
+370
View File
@@ -0,0 +1,370 @@
#!/usr/bin/env python
import multiprocessing
from pyo import *
import math
import Adafruit_ADS1x15
adc = Adafruit_ADS1x15.ADS1115()
import Adafruit_MCP3008
import RPi.GPIO as GPIO
CLK = 27
MISO = 22
MOSI = 17
CS1 = 8
CS2 = 9
mcp1 = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS1, miso=MISO, mosi=MOSI)
mcp2 = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS2, miso=MISO, mosi=MOSI)
MAXADC = 26300.0
GPIO.setup(CS1,GPIO.OUT)
GPIO.setup(CS2,GPIO.OUT)
pa_list_devices()
#print pm_get_default_input()
# --TriTable import from examples-- (Not in normal libs?)
class TriTable(PyoTableObject):
def __init__(self, order=10, size=8192):
PyoTableObject.__init__(self, size)
self._order = order
self._tri_table = HarmTable(self._create_list(order), size)
self._base_objs = self._tri_table.getBaseObjects()
self.normalize()
def _create_list(self, order):
l = []
ph = 1.0
for i in range(1, order*2):
if i % 2 == 0:
l.append(0)
else:
l.append(ph / (i*i))
ph *= -1
return l
def set_order(self, x):
self._order = x
self._tri_table.replace(self._create_list(x))
self.normalize()
self.refreshView()
@property
def order(self):
return self._order
@order.setter
def order(self, x): self.set_order(x)
# --Notes--
notes = [65.41,
73.42,
82.41,
87.31,
98,
110,
123.47,
130.81,
146.83,
164.81,
174.61,
196,
220,
246.94,
261.63,
293.66,
329.63,
349.23,
392,
440,
493.88,
523.25,
587.33,
659.25,
698.46,
783.99,
880,
987.77,
1046.5]
notesFM = [87.31,
98,
103.83,
116.54,
130.81,
138.59,
155.56,
174.61,
196,
207.65,
233.08,
261.63,
277.18,
311.13,
349.23,
392,
415.3,
466.16,
523.25,
554.37,
622.25,
698.46]
inputs = [
'/m_prt',
'/m_vibIn2',
'/m_vibSep',
'/m_pcSep',
'/m_cutoff',
'/m_res',
'/m_distortion',
'/m_volAffect',
'/m_chanPan',
'/m_dValue',
'/m_dFeedB',
'/m_attack',
'/m_decay',
'/m_sustain',
'/m_release',
'/m_wavetypenum',
'/m_note',
'/m_mod',
'/m_vibIn',
'/m_volIn',
'/m_adsr',
]
class Proc(multiprocessing.Process):
def __init__(self, create):
super(Proc, self).__init__()
self.daemon = True
self.create = create
def ribbon_sense(self):
self.ribbon = adc.read_adc(0, gain=1)
self.dis.value = notesFM[int((self.ribbon/MAXADC)*len(notesFM))] # 25200
self.vibratoribbon = adc.read_adc(1, gain=1)
if self.vibratoribbon < 20000.0:
self.vibIn.value = 0.0
else:
self.vibIn.value = (self.vibratoribbon - 20000.0) / 1000.0
if self.vibratoribbon > 18000:
self.adsr.value = 1.0
else:
self.adsr.value = 0.0
self.wheel1 = adc.read_adc(2, gain=1)
self.volIn.value = self.wheel1/MAXADC * 2.0 - 0.5
self.wheel2 = adc.read_adc(3, gain=1)
if self.wheel2 < 13380.0:
self.mod.value = 1.0
else:
self.mod.value = 1.0 - ((self.wheel2-13380.0)/8720.0)
#GPIO.output(CS2,1)
#GPIO.output(CS1,0)
#self.prt.value = mcp1.read_adc(4)/1024.0
self.vibIn2.value = mcp1.read_adc(1)/1024.0
self.vibSep.value = mcp1.read_adc(2)/1024.0
self.ptSep.value = mcp1.read_adc(3)/1024.0
self.dFeedB.value = mcp1.read_adc(0)/102.4
self.dValue.value = mcp1.read_adc(4)/102.4
self.chanPan.value = mcp1.read_adc(6)/1024.0
self.distortion.value = mcp1.read_adc(7)/1024.0
#GPIO.output(CS1,1)
#GPIO.output(CS2,0)
self.cutoff.value = mcp2.read_adc(0)/1024.0
self.res.value = mcp2.read_adc(1)/1024.0
self.volAffect.value = mcp2.read_adc(2)/1024.0
self.attack.value = mcp2.read_adc(3)/1024.0
self.decay.value = mcp2.read_adc(4)/1024.0
self.sustain.value = mcp2.read_adc(5)/1024.0
self.release.value = mcp2.read_adc(6)/1024.0
self.prt.value = mcp2.read_adc(7)/1024.0
def multifunctions(self):
self.type2L.mul = self.waveTypeNum
self.type1L.mul = 0.0
self.type3L.mul = 0.0
self.type4L.mul = 0.0
self.type2R.mul = self.waveTypeNum
self.type1R.mul = 0.0
self.type3R.mul = 0.0
self.type4R.mul = 0.0
def run(self):
# --Server setup--
self.server = Server(audio='jack')
self.server.deactivateMidi()
#self.server.setMidiInputDevice(3)
#print pm_get_default_input()
#print s.getMidiActive()
self.server.setBufferSize(32)
self.server.setDuplex(0)
self.server.setOutputDevice(0)
self.server.setNchnls(2)
if self.create:
self.server.setSamplingRate(16000)
else:
self.server.setSamplingRate(32000)
self.server.boot()
#print s.getMidiActive()
print('Server booted!')
self.server.amp = 0.25
bufsize = self.server.getBufferSize()
if self.create: # input handling
self.dis = SigTo(440.0, time=0.1)
self.mod = SigTo(0.5)
self.prt = SigTo(0.5)
self.vibIn = SigTo(0.0)
self.vibIn2 = SigTo(0.2)
self.vibSep = SigTo(0.5)
self.ptSep = SigTo(0.0)
self.volIn = SigTo(0.8)
self.cutoff = SigTo(1.0)
self.res = SigTo(0.0)
self.distortion = SigTo(0.0)
self.volAffect = SigTo(0.0)
self.chanPan = SigTo(0.5)
self.dValue = SigTo(0.0)
self.dFeedB = SigTo(2.0)
self.attack = SigTo(0.01)
self.decay = SigTo(0.5)
self.sustain = SigTo(0.7)
self.release = SigTo(0.25)
self.waveTypeNum = SigTo(1)
self.adsr = Sig(0.0)
#wtSlMap = SLMap(1, 4, 'lin', 'value', 1, 'int')
#waveTypeNum.ctrl([wtSlMap], "Wave Type")
self.inputlist = [
self.dis,
self.mod,
self.prt,
self.vibIn,
self.vibIn2,
self.vibSep,
self.ptSep,
self.volIn,
self.cutoff,
self.res,
self.distortion,
self.volAffect,
self.chanPan,
self.dValue,
self.dFeedB,
self.attack,
self.decay,
self.sustain,
self.release,
self.waveTypeNum,
self.adsr,
]
self.table = SharedTable(inputs, create=True, size=bufsize)
self.recrd = TableFill(self.inputlist, self.table)
ribP = Pattern(self.ribbon_sense, 0.1).play()
else: # synth
self.dis = TableScan(SharedTable(inputs[0], create=False, size=bufsize))
self.mod = TableScan(SharedTable(inputs[1], create=False, size=bufsize))
prt = TableScan(SharedTable(inputs[2], create=False, size=bufsize))
self.vibIn = TableScan(SharedTable(inputs[3], create=False, size=bufsize))
vibIn2 = TableScan(SharedTable(inputs[4], create=False, size=bufsize))
vibSep = TableScan(SharedTable(inputs[5], create=False, size=bufsize))
ptSep = TableScan(SharedTable(inputs[6], create=False, size=bufsize))
self.volIn = TableScan(SharedTable(inputs[7], create=False, size=bufsize))
cutoff = TableScan(SharedTable(inputs[8], create=False, size=bufsize))
res = TableScan(SharedTable(inputs[9], create=False, size=bufsize))
distortion = TableScan(SharedTable(inputs[10], create=False, size=bufsize))
volAffect = TableScan(SharedTable(inputs[11], create=False, size=bufsize))
chanPan = TableScan(SharedTable(inputs[12], create=False, size=bufsize))
dValue = TableScan(SharedTable(inputs[13], create=False, size=bufsize))
dFeedB = TableScan(SharedTable(inputs[14], create=False, size=bufsize))
attack = TableScan(SharedTable(inputs[15], create=False, size=bufsize))
decay = TableScan(SharedTable(inputs[16], create=False, size=bufsize))
sustain = TableScan(SharedTable(inputs[17], create=False, size=bufsize))
release = TableScan(SharedTable(inputs[18], create=False, size=bufsize))
self.waveTypeNum = TableScan(SharedTable(inputs[19], create=False, size=bufsize))
self.adsr = TableScan(SharedTable(inputs[20], create=False, size=bufsize))
# --Startup noise--
sn = Pan(Sine(440)).out()
Clean_objects(1, sn).start()
functions = Pattern(self.multifunctions, 0.1).play()
# --Entire synth--
porta = SigTo(value=self.dis, time=prt/5)
pitch = porta - (self.mod-0.5)*100
trVibL = self.vibIn*Sine((5-vibSep)*(vibIn2*5))*5
trVibR = self.vibIn*Sine((5+vibSep)*(vibIn2*5))*5
waveL = pitch + trVibL + (ptSep*5)
waveR = pitch + trVibR - (ptSep*5)
tri = TriTable()
saw = SawTable()
squ = SquareTable()
self.type1L = Sine(waveL)
self.type2L = Osc(saw, waveL)
self.type3L = Osc(squ, waveL)
self.type4L = Osc(tri, waveL)
self.type1R = Sine(waveR)
self.type2R = Osc(saw, waveR)
self.type3R = Osc(squ, waveR)
self.type4R = Osc(tri, waveR)
audio1L = self.type1L + self.type2L + self.type3L + self.type4L
audio1R = self.type1R + self.type2R + self.type3R + self.type4R
#waveP = Pattern(self.wave_type, 0.5).play()
self.type1L.mul = 0.0
self.type2L.mul = 1.0
self.type3L.mul = 0.0
self.type4L.mul = 0.0
self.type1R.mul = 0.0
self.type2R.mul = 1.0
self.type3R.mul = 0.0
self.type4R.mul = 0.0
fv = (Abs(self.vibIn) + self.volIn)*cutoff*1000
LPF_L = MoogLP(audio1L, fv, res*2.0)
LPF_R = MoogLP(audio1R, fv, res*2.0)
srcL = Disto(LPF_L, distortion)
srcR = Disto(LPF_R, distortion)
self.env = MidiAdsr(self.adsr)#, attack=1.0)
#env.ctrl()
srcL.mul = (self.volIn+(trVibL*volAffect))
srcR.mul = (self.volIn+(trVibR*volAffect))
#mm = Mixer()
#mm.addInput(0, srcL)
#mm.addInput(1, srcR)
#mm.setAmp(0, 0, 0.5)
#mm.setAmp(1, 1, 0.5)
LP = Pan(srcL, pan=chanPan).out()
RP = Pan(srcR, pan=(1.0-chanPan)).out()
LP.mul *= self.env
RP.mul *= self.env
srcDL = Delay(LP, dValue, dFeedB).out()
srcDR = Delay(RP, dValue, dFeedB).out()
#scope = Scope(LP+RP)
# --End of synth--
self.server.start()
self.server.gui(locals())
if __name__ == '__main__':
analysis = Proc(create=True)
synthesis = Proc(create=False)
print('Devices loaded')
print('Starting servers...')
analysis.start()
synthesis.start()
+214
View File
@@ -0,0 +1,214 @@
#!/usr/bin/env python
from pyo import *
import math, time
import Adafruit_ADS1x15
adc = Adafruit_ADS1x15.ADS1115()
#pa_list_devices()
#pm_list_devices()
#print pm_get_default_input()
#--Server setup
s = Server()
s.setMidiInputDevice(3)
#print pm_get_default_input()
#print s.getMidiActive()
s.setBufferSize(1024)
s.setDuplex(0)
s.setOutputDevice(3)
s.setNchnls(2)
s.setSamplingRate(32000)
s.boot()
#print s.getMidiActive()
print 'Server booted!'
s.amp = 0.25
#--TriTable import from examples (Not in normal libs?)
class TriTable(PyoTableObject):
def __init__(self, order=10, size=8192):
PyoTableObject.__init__(self, size)
self._order = order
self._tri_table = HarmTable(self._create_list(order), size)
self._base_objs = self._tri_table.getBaseObjects()
self.normalize()
def _create_list(self, order):
l = []
ph = 1.0
for i in range(1,order*2):
if i % 2 == 0:
l.append(0)
else:
l.append(ph / (i*i))
ph *= -1
return l
def setOrder(self, x):
self._order = x
self._tri_table.replace(self._create_list(x))
self.normalize()
self.refreshView()
@property
def order(self):
return self._order
@order.setter
def order(self, x): self.setOrder(x)
#--Startup noise
sn = Pan(Sine(440)).out()
def call1():
sn.stop()
def call2():
LP.out()
RP.out()
cafter1 = CallAfter(call1, 1)
cafter2 = CallAfter(call2, 1.5)
#--Notes
notes = [65.41,73.42,82.41,87.31,98,110,123.47,130.81,146.83,164.81,174.61,196,220,246.94,261.63,293.66,329.63,349.23,392,440,493.88,523.25,587.33,659.25,698.46,783.99,880,987.77,1046.5]
#--Ribbon handling
ribbon = 0
smooth = 0.3
note = SigTo(ribbon, time=0.1)
def ribbonsense():
global ribbon
ribbon = adc.read_adc(1,gain=2/3)
#print ribbon
#print (ribbon/25250.0)
note.value = notes[int((ribbon/25250.0)*len(notes))] #25200
ribp = Pattern(ribbonsense, 0.1).play()
#--Entire synth
#note = Choice([440,220,880],4)
#dis=note
dis=note
mod = Sig(0.5)
mod.ctrl(title='Modulation')
#mod.setValue(0.5)
prt = Sig(0.5)
prt.ctrl(title="Portamento")
porta = SigTo(value=dis,time=prt/5)
mod5 = mod-0.5
trmod = mod5*100
pitch = porta - trmod
#out = Sine(freq=pitch)
vibin = Sig(0.0)
vibin.ctrl(title='Vibrato')
vibsep = Sig(0.5)
vibsep.ctrl(title='Vibrato Channel Seperation')
ptsep = Sig(0.0)
ptsep.ctrl(title='Vitch Channel Seperation')
#vibin.setValue(0.5)
volin = Sig(0.5)
volin.ctrl(title='Volume')
trvibL = vibin*Sine(5-vibsep)*5
trvibR = vibin*Sine(5+vibsep)*5
waveL = pitch + trvibL + (ptsep*5)
waveR = pitch + trvibR - (ptsep*5)
#out = Sine(wave).out()
tri = TriTable()
saw = SawTable()
squ = SquareTable()
wavetypenum = Sig(1)
wtslmap = SLMap(1,4,'lin','value',1,'int')
wavetypenum.ctrl([wtslmap],"Wave Type")
type1L = Sine(waveL)
type2L = Osc(saw,waveL)
type3L = Osc(squ,waveL)
type4L = Osc(tri,waveL)
type1R = Sine(waveR)
type2R = Osc(saw,waveR)
type3R = Osc(squ,waveR)
type4R = Osc(tri,waveR)
audio1L = type1L + type2L + type3L + type4L
audio1R = type1R + type2R + type3R + type4R
def wavetype():
if wavetypenum.value.value == 1:
type1L.mul = 1.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 1.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 0.0
elif wavetypenum.value.value == 2:
type1L.mul = 0.0
type2L.mul = 1.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 0.0
type2R.mul = 1.0
type3R.mul = 0.0
type4R.mul = 0.0
elif wavetypenum.value.value == 3:
type1L.mul = 0.0
type2L.mul = 0.0
type3L.mul = 1.0
type4L.mul = 0.0
type1R.mul = 0.0
type2R.mul = 0.0
type3R.mul = 1.0
type4R.mul = 0.0
elif wavetypenum.value.value == 4:
type1L.mul = 0.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 1.0
type1R.mul = 0.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 1.0
else:
type1L.mul = 1.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 1.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 0.0
wavep = Pattern(wavetype, 1).play()
def pstart():
p.play()
#CallAfter(pstart,1)
#audio1.out()
sabs = Abs(vibin)
fv = sabs + volin
cutoff = Sig(1.0)
cutoff.ctrl(title='LPF Cutoff')
fv5 = fv*cutoff*1000
LPF_L = Tone(audio1L,fv5)
LPF_R = Tone(audio1R,fv5)
#LPF.ctrl()
srcL = LPF_L
srcR = LPF_R
#env = MidiAdsr(note['velocity'],attack=0.01,decay=0.5,sustain=0.7,release=0.25)
#env.ctrl()
#env.play()
volaffect = Sig(0.0)
volaffect.ctrl(title='Affect Of Vibrato On Volume')
srcL.mul = volin+(trvibL*volaffect)
srcR.mul = volin+(trvibR*volaffect)
mm = Mixer()
mm.addInput(0,srcL)
mm.addInput(1,srcR)
mm.setAmp(0,0,0.5)
mm.setAmp(1,1,0.5)
chanpan = Sig(0.5)
chanpan.ctrl(title='Channel Panning')
glopan = Sig(0.5)
glopan.ctrl(title='Global Panning')
LP = Pan(mm[0],pan=(chanpan)*(1.0-glopan))
RP = Pan(mm[1],pan=(1.0-chanpan)*(1.0-glopan))
#-- End of synth
print 'Devices loaded'
print 'Starting server...'
#scope = Scope(src)
s.start()
s.gui(locals())
+258
View File
@@ -0,0 +1,258 @@
#!/usr/bin/env python
from pyo import *
RIBBON_MODE = 1
if RIBBON_MODE == 1:
import Adafruit_ADS1x15
adc = Adafruit_ADS1x15.ADS1115()
pa_list_devices()
pm_list_devices()
#print pm_get_default_input()
# --Server setup--
s = Server()
s.setMidiInputDevice(3)
#print pm_get_default_input()
#print s.getMidiActive()
s.setBufferSize(512)
s.setDuplex(0)
s.setOutputDevice(1)
s.setNchnls(2)
s.setSamplingRate(16000)
s.boot()
#print s.getMidiActive()
print('Server booted!')
s.amp = 0.25
# --TriTable import from examples-- (Not in normal libs?)
class TriTable(PyoTableObject):
def __init__(self, order=10, size=8192):
PyoTableObject.__init__(self, size)
self._order = order
self._tri_table = HarmTable(self._create_list(order), size)
self._base_objs = self._tri_table.getBaseObjects()
self.normalize()
def _create_list(self, order):
l = []
ph = 1.0
for i in range(1, order*2):
if i % 2 == 0:
l.append(0)
else:
l.append(ph / (i*i))
ph *= -1
return l
def set_order(self, x):
self._order = x
self._tri_table.replace(self._create_list(x))
self.normalize()
self.refreshView()
@property
def order(self):
return self._order
@order.setter
def order(self, x): self.set_order(x)
def call2():
LP.out()
RP.out()
def ribbon_sense():
ribbon = adc.read_adc(0, gain=2/3)
note.value = notes[int((ribbon/25250.0)*len(notes))] # 25200
#vibratoribbon = adc.read_adc(1, gain=2/3)
#vibIn.value = vibratoribbon / 1000.0
wheel1 = adc.read_adc(2, gain=2/3)
volIn.value = wheel1 / 25250.0 * 1.5
#wheel2 = adc.read_adc(3, gain=2/3)
#mod.value = (wheel2 - 18000) / 1000.0
# --Startup noise--
sn = Pan(Sine(440)).out()
Clean_objects(1, sn).start()
cAfter2 = CallAfter(call2, 1.5)
# --Notes--
notes = [65.41,
73.42,
82.41,
87.31,
98,
110,
123.47,
130.81,
146.83,
164.81,
174.61,
196,
220,
246.94,
261.63,
293.66,
329.63,
349.23,
392,
440,
493.88,
523.25,
587.33,
659.25,
698.46,
783.99,
880,
987.77,
1046.5]
# --Ribbon handling--
if RIBBON_MODE == 1:
note = SigTo(0.0, time=0.1)
ribP = Pattern(ribbon_sense, 0.2).play()
dis = note
else:
note = Notein(scale=1, poly=1)
dis = note["pitch"]
# --Entire synth--
mod = Sig(0.5)
#mod.ctrl(title='Modulation')
prt = Sig(0.5)
prt.ctrl(title="Portamento")
porta = SigTo(value=dis, time=prt/5)
pitch = porta - (mod-0.5)*100
vibIn = Sig(0.0)
#vibIn.ctrl(title='Vibrato Depth')
vibIn2 = Sig(0.2)
vibIn2.ctrl(title='Vibrato Frequency')
vibSep = Sig(0.5)
vibSep.ctrl(title='Vibrato Channel Separation')
ptSep = Sig(0.0)
ptSep.ctrl(title='Pitch Channel Separation')
volIn = Sig(0.5)
#volIn.ctrl(title='Volume')
trVibL = vibIn*Sine((5-vibSep)*(vibIn2*5))*5
trVibR = vibIn*Sine((5+vibSep)*(vibIn2*5))*5
waveL = pitch + trVibL + (ptSep*5)
waveR = pitch + trVibR - (ptSep*5)
tri = TriTable()
saw = SawTable()
squ = SquareTable()
waveTypeNum = Sig(1)
wtSlMap = SLMap(1, 4, 'lin', 'value', 1, 'int')
waveTypeNum.ctrl([wtSlMap], "Wave Type")
type1L = Sine(waveL)
type2L = Osc(saw, waveL)
type3L = Osc(squ, waveL)
type4L = Osc(tri, waveL)
type1R = Sine(waveR)
type2R = Osc(saw, waveR)
type3R = Osc(squ, waveR)
type4R = Osc(tri, waveR)
audio1L = type1L + type2L + type3L + type4L
audio1R = type1R + type2R + type3R + type4R
def wave_type():
if waveTypeNum.value.value == 1:
type1L.mul = 1.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 1.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 0.0
elif waveTypeNum.value.value == 2:
type1L.mul = 0.0
type2L.mul = 1.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 0.0
type2R.mul = 1.0
type3R.mul = 0.0
type4R.mul = 0.0
elif waveTypeNum.value.value == 3:
type1L.mul = 0.0
type2L.mul = 0.0
type3L.mul = 1.0
type4L.mul = 0.0
type1R.mul = 0.0
type2R.mul = 0.0
type3R.mul = 1.0
type4R.mul = 0.0
elif waveTypeNum.value.value == 4:
type1L.mul = 0.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 1.0
type1R.mul = 0.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 1.0
else:
type1L.mul = 1.0
type2L.mul = 0.0
type3L.mul = 0.0
type4L.mul = 0.0
type1R.mul = 1.0
type2R.mul = 0.0
type3R.mul = 0.0
type4R.mul = 0.0
waveP = Pattern(wave_type, 1).play()
sAbs = Abs(vibIn)
fv = sAbs + volIn
cutoff = Sig(1.0)
cutoff.ctrl(title='LPF Cutoff')
res = Sig(0.0)
res.ctrl(title='LPF Resonance')
distortion = Sig(0.0)
distortion.ctrl(title='Distortion')
fv5 = fv*cutoff*1000
LPF_L = MoogLP(audio1L, fv5, res*2.0)
LPF_R = MoogLP(audio1R, fv5, res*2.0)
srcL = Disto(LPF_L, distortion)
srcR = Disto(LPF_R, distortion)
#env = MidiAdsr(note['velocity'], attack=0.01, decay=0.5, sustain=0.7, release=0.25)
#env.ctrl()
volAffect = Sig(0.0)
volAffect.ctrl(title='Affect Of Vibrato On Volume')
srcL.mul = (volIn+(trVibL*volAffect))
srcR.mul = (volIn+(trVibR*volAffect))
mm = Mixer()
mm.addInput(0, srcL)
mm.addInput(1, srcR)
mm.setAmp(0, 0, 0.5)
mm.setAmp(1, 1, 0.5)
chanPan = Sig(0.5)
chanPan.ctrl(title='Channel Panning')
LP = Pan(mm[0], pan=chanPan)
RP = Pan(mm[1], pan=(1.0-chanPan))
#LP.mul *= env
#RP.mul *= env
dValue = Sig(0.0)
dValue.ctrl(title='Delay Offset')
dFeedB = Sig(0.0)
dFeedB.ctrl(title='Delay Feedback')
srcDL = Delay(LP, dValue, dFeedB).out()
srcDR = Delay(RP, dValue, dFeedB).out()
# --End of synth--
print('Devices loaded')
print('Starting server...')
#scope = Scope(LP+RP)
s.start()
s.gui(locals())
BIN
View File
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
import RPi.GPIO as GPIO
import time
from math import sin
GPIO.setmode(GPIO.BCM)
GPIO.setup(9, GPIO.OUT)
i = 0
while True:
GPIO.output(9,1)
time.sleep((sin(i)+1)/4.0)
GPIO.output(9,0)
time.sleep((sin(i)+1)/4.0)
i+=1
Binary file not shown.
+46
View File
@@ -0,0 +1,46 @@
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
GPIO.setup(20, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(1, GPIO.OUT)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
GPIO.setup(21, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(10, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(14, GPIO.OUT)
while True:
GPIO.output(21,1)
GPIO.output(20, 1)
GPIO.output(16, 1)
GPIO.output(12, 1)
GPIO.output(1, 1)
GPIO.output(7, 1)
GPIO.output(8, 1)
GPIO.output(25, 1)
GPIO.output(21, 1)
GPIO.output(23, 1)
GPIO.output(10, 1)
GPIO.output(15, 1)
GPIO.output(14, 1)
time.sleep(1)
GPIO.output(21,0)
GPIO.output(20, 0)
GPIO.output(16, 0)
GPIO.output(12, 0)
GPIO.output(1, 0)
GPIO.output(7, 0)
GPIO.output(8, 0)
GPIO.output(25, 0)
GPIO.output(21, 0)
GPIO.output(23, 0)
GPIO.output(10, 0)
GPIO.output(15, 0)
GPIO.output(14, 0)
time.sleep(1)
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+147
View File
@@ -0,0 +1,147 @@
#!/usr/bin/env python
from pyo import *
import math, time
#pa_list_devices()
#pm_list_devices()
print pm_get_default_input()
#Server setup
s = Server()
s.setMidiInputDevice(3)
#print pm_get_default_input()
#print s.getMidiActive()
s.setBufferSize(256)
s.setDuplex(0)
s.setOutputDevice(0)
s.setNchnls(1)
#s.setSamplingRate()
s.boot()
#print s.getMidiActive()
print 'Server booted!'
s.amp = 0.5
#TriTable import from examples (Not in normal libs?)
class TriTable(PyoTableObject):
def __init__(self, order=10, size=8192):
PyoTableObject.__init__(self, size)
self._order = order
self._tri_table = HarmTable(self._create_list(order), size)
self._base_objs = self._tri_table.getBaseObjects()
self.normalize()
def _create_list(self, order):
l = []
ph = 1.0
for i in range(1,order*2):
if i % 2 == 0:
l.append(0)
else:
l.append(ph / (i*i))
ph *= -1
return l
def setOrder(self, x):
self._order = x
self._tri_table.replace(self._create_list(x))
self.normalize()
self.refreshView()
@property
def order(self):
return self._order
@order.setter
def order(self, x): self.setOrder(x)
#--Startup noise
sn = Sine(440).out()
def call():
sn.stop()
cafter = CallAfter(call, 1)
#--Entire synth
note = Notein(scale=1,poly=1)
#note = Choice([440,220,880],4)
#dis=note
dis=note['pitch']
mod = Sig(0.5)
mod.ctrl(title='Modulation')
#mod.setValue(0.5)
prt = Sig(0.5)
prt.ctrl(title="Portamento")
porta = SigTo(value=dis,time=prt/5)
mod5 = mod-0.5
trmod = mod5*100
pitch = porta - trmod
#out = Sine(freq=pitch)
vibin = Sig(0.0)
vibin.ctrl(title='Vibrato')
#vibin.setValue(0.5)
volin = Sig(1.0)
volin.ctrl(title='Volume')
trvib = vibin*Sine(5)*5
wave = pitch + trvib
#out = Sine(wave).out()
tri = TriTable()
saw = SawTable()
squ = SquareTable()
wavetypenum = Sig(1)
wtslmap = SLMap(1,4,'lin','value',1,'int')
wavetypenum.ctrl([wtslmap],"Wave Type")
type1 = Sine(wave)
type2 = Osc(saw,wave)
type3 = Osc(squ,wave)
type4 = Osc(tri,wave)
audio1 = type1 + type2 + type3 + type4
def wavetype():
if wavetypenum.value.value == 1:
type1.mul = 1.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 0.0
elif wavetypenum.value.value == 2:
type1.mul = 0.0
type2.mul = 1.0
type3.mul = 0.0
type4.mul = 0.0
elif wavetypenum.value.value == 3:
type1.mul = 0.0
type2.mul = 0.0
type3.mul = 1.0
type4.mul = 0.0
elif wavetypenum.value.value == 4:
type1.mul = 0.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 1.0
else:
type1.mul = 1.0
type2.mul = 0.0
type3.mul = 0.0
type4.mul = 0.0
p = Pattern(wavetype, 0.4).play()
def pstart():
p.play()
#CallAfter(pstart,1)
#audio1.out()
sabs = Abs(vibin)
fv = sabs + volin
cutoff = Sig(1.0)
cutoff.ctrl(title='LPF Cutoff')
fv5 = fv*cutoff*1000
LPF = Tone(audio1,fv5)
#LPF.ctrl()
src = LPF
env = MidiAdsr(note['velocity'],attack=0.01,decay=0.5,sustain=0.7,release=0.5)
env.ctrl()
#env.play()
src.mul = env*volin
src.out()
#-- End of synth
print 'Devices loaded'
print 'Starting server...'
#scope = Scope(out)
s.start()
s.gui(locals())
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env python
from pyo import *
import math, time
import Adafruit_ADS1x15
RESIST = 1000000
adc = Adafruit_ADS1x15.ADS1115()
#--Server setup
#pa_list_devices()
s = Server()
s.setBufferSize(1024)
s.setDuplex(0)
s.setOutputDevice(3)
s.setNchnls(1)
s.setSamplingRate(32000)
s.boot()
print 'Server booted!'
s.amp = 0.5
notes = [65.41,
73.42,
82.41,
87.31,
98,
110,
123.47,
130.81,
146.83,
164.81,
174.61,
196,
220,
246.94,
261.63,
293.66,
329.63,
349.23,
392,
440,
493.88,
523.25,
587.33,
659.25,
698.46,
783.99,
880,
987.77,
1046.5]
ribbon = 0
smooth = 0.3
ribbon_s = SigTo(ribbon, time=0.25)
saw = SawTable()
se = Osc(saw,ribbon_s)
#se2 = Osc(saw,ribbon_s+5)
def ribbonsense():
global ribbon
ribbon = adc.read_adc(1)#(smooth*ribbon)+((1-smooth)*adc.read_adc(1))
#if (ribbon < 4000) and se.mul == 0.0:
# ribbon = adc.read_adc(1)
#print ribbon
#ribbon = (ribbon*RESIST)/(65535.01-ribbon)
#ribbon = round(ribbon/10000)*100
ribbon_s.value = notes[int(ribbon/1000)]
#ribbon_s.mul = 0.01
if ribbon > 4000:
#se.mul = 0.0
pass
else:
se.mul = 1.0
#print ribbon
#print se.mul
#print ribbon/100
p = Pattern(ribbonsense, 0.1).play()
se.out()
#se2.out()
s.start()
s.gui(locals())
Binary file not shown.