M libpippi/console.py => libpippi/console.py +21 -10
@@ 1,5 1,6 @@
import cmd
import threading
+import traceback
import subprocess
import mido
@@ 43,19 44,20 @@ class AstridConsole(cmd.Cmd):
prompt = '^_- '
intro = 'Astrid Console'
instruments = {}
+ dac = None
+ adc = None
def __init__(self, client=None):
- self.dac = subprocess.Popen('./build/dac')
- self.adc = subprocess.Popen('./build/adc')
cmd.Cmd.__init__(self)
def do_dac(self, cmd):
if cmd == 'on' and self.dac is None:
print('Starting dac...')
self.dac = subprocess.Popen('./build/dac')
- elif cmd == 'off' and self.dec is not None:
+ elif cmd == 'off' and self.dac is not None:
print('Stopping dac...')
- self.dac.kill()
+ #self.dac.kill()
+ self.dac.terminate()
def do_adc(self, cmd):
if cmd == 'on' and self.adc is None:
@@ 63,7 65,8 @@ class AstridConsole(cmd.Cmd):
self.adc = subprocess.Popen('./build/adc')
elif cmd == 'off' and self.adc is not None:
print('Stopping adc...')
- self.adc.kill()
+ #self.adc.kill()
+ self.adc.terminate()
def do_p(self, cmd):
parts = cmd.split(' ')
@@ 74,11 77,19 @@ class AstridConsole(cmd.Cmd):
params = ' ' + ' '.join(parts)
if instrument not in self.instruments:
- rcmd = 'INSTRUMENT_PATH="orc/%s.py" INSTRUMENT_NAME="%s" ./build/renderer' % (instrument, instrument)
- self.instruments[instrument] = subprocess.Popen(rcmd, shell=True)
-
- r.lpush('astrid-play-%s' % instrument, 'p' + params)
- subprocess.run('./build/qmessage', instrument, params)
+ try:
+ rcmd = 'INSTRUMENT_PATH="orc/%s.py" INSTRUMENT_NAME="%s" ./build/renderer' % (instrument, instrument)
+ self.instruments[instrument] = subprocess.Popen(rcmd, shell=True)
+ except Exception as e:
+ print('Could not start renderer: %s' % e)
+ print(traceback.format_exc())
+ return
+
+ try:
+ subprocess.run(['./build/qmessage', instrument, params])
+ except Exception as e:
+ print('Could not invoke qmessage: %s' % e)
+ print(traceback.format_exc())
def do_v(self, cmd):
k, v = tuple(cmd.split('='))
M libpippi/next.txt => libpippi/next.txt +1 -2
@@ 1,6 1,5 @@
Astrid:
- - redis sub for buffers in dac thread
- - redis pub for buffers in renderer processes
+ TODO
Core:
port more wavetables & windows
M libpippi/orc/ding.py => libpippi/orc/ding.py +11 -5
@@ 1,11 1,17 @@
-from pippi import dsp, oscs
+from pippi import dsp, oscs, tune
-#LOOP = True
+LOOP = False
def play(ctx):
+ freqs = tune.degrees([dsp.randint(1,7)], key='c', octave=dsp.randint(3,4))
+ stack = ['sine', 'hann', 'tri', 'cos', 'square']
o = oscs.SineOsc(
- freq=dsp.rand(500, 800),
- amp=dsp.rand(0.15, 0.45),
- ).play(0.04).env('pluckout')
+ #stack,
+ #windows=['sine', 'hann'],
+ freq=dsp.choice(freqs),
+ amp=dsp.rand(0.25, 0.5),
+ pulsewidth=1,
+ ).play(dsp.rand(1, 6)).env('rnd')
+ o = o.pan(dsp.rand())
yield o