def init_ounk(): global tt1, proc, pit1 ounk.setGlobalDuration(-1) env = ounk.genAdsr(release=0.8) tt1 = ounk.genDataTable([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]) pit1 = ounk.genDataTable( [1, 1, 1, 1, .5, 1, 1, 1, .25, 1, 1, 1, .125, 1, 1, 1]) ounk.oscReceive(bus='tempo', address='/tempo', port=9005, portamento=0.05) ounk.metro(bus='metro', tempo=200, tempoVar='tempo') # solo sequence ounk.beginSequencer(input='metro', table=tt1) ounk.sequencerPitchTable(pit1) notes = 10 pitchs = [random.randint(180, 190) * 2 for x in range(notes)] durs = [random.randint(1, 15) * .05 for x in range(notes)] ounk.readTable(bus='index2', table=env, duration=durs[0]) ounk.freqMod(pitch=pitchs, modulator=0.502, amplitude=.07, starttime=0, duration=durs, envelope=env, pan=[0, .25, .5, .75, 1], index=10, indexVar='index2') ounk.endSequencer() proc = ounk.startCsound() time.sleep(1) ounk.sendOscControl(0.8, address='/tempo', port=9005)
def init_ounk(): global tt1, proc, pit1 ounk.setGlobalDuration(-1) env = ounk.genAdsr(release=0.8) tt1 = ounk.genDataTable([1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0]) pit1 = ounk.genDataTable([1,1,1,1,.5,1,1,1,.25,1,1,1,.125,1,1,1]) ounk.oscReceive(bus='tempo', address='/tempo', port = 9005, portamento = 0.05) ounk.metro(bus='metro', tempo=200, tempoVar = 'tempo') # solo sequence ounk.beginSequencer(input='metro', table=tt1) ounk.sequencerPitchTable(pit1) notes = 10 pitchs = [random.randint(180,190)*2 for x in range(notes)] durs = [random.randint(1,15)*.05 for x in range(notes)] ounk.readTable(bus='index2', table=env, duration=durs[0]) ounk.freqMod(pitch=pitchs, modulator=0.502, amplitude=.07, starttime=0, duration=durs, envelope=env, pan=[0,.25,.5,.75,1], index=10,indexVar='index2') ounk.endSequencer() proc = ounk.startCsound() time.sleep(1) ounk.sendOscControl(0.8, address='/tempo', port=9005)
def on_release_callback(btn, *largs): ounk.sendOscControl(0, address='/amp%d' % btn, port=9005)
def on_press_callback(btn, *largs): ounk.sendOscControl(0.5, address='/amp%d' % btn, port=9005)
def on_value_change_callback(slider, value): ounk.sendOscControl(value, address='/pitch%d' % slider, port=9005)
def on_value_change(value): ounk.sendOscControl(value, address='/tempo', port=9005)