def cleanUp(): global mCamera, mSynth mSynth.free() sc.quit() mCamera.release() GPIO.cleanup() cv2.destroyAllWindows()
def iterate(self, iters=1): sc.quit() for iter in range(iters): self.age_pop() self.mutate_pop() # self.crossover() if (iter%20)==0: print self.population[0].age self.reproduce(self.depth)
def start_sc(self): try: sc.start(verbose=1, spew=1, startscsynth=1) except OSError: # in case we've already started the synth print 'QUIT!' sc.quit() print 'sfpath: ', self.sfpath self.bnum = sc.loadSnd(self.sfpath, wait=False) print 'bnum: ', self.bnum return 1
def start_sc(self): try: sc.start(verbose=1, spew=1, startscsynth=1) except OSError: # in case we've already started the synth print "QUIT!" sc.quit() print "sfpaths: ", self.sfpaths for i, sfpath in enumerate(self.sfpaths): bnum = sc.loadSnd(os.path.basename(sfpath), wait=False) print "bnum: ", bnum self.sfinfos[i]["bnum"] = bnum return 1
def start_sc(self): try: sc.start(verbose=1, spew=1, startscsynth=1) except OSError: # in case we've already started the synth print 'QUIT!' sc.quit() print 'sfpath: ', self.sfpath for i, sfpath in enumerate(self.sfpaths): bnum = sc.loadSnd(sfpath, wait=False) print 'bnum: ', bnum self.infos[i]['bnum'] = bnum return 1
def iterate(self, iters=1): sc.quit() for iter in range(iters): self.age_pop() self.mutate_pop() # self.crossover() if (iter%self.reporting_interval)==0: print self.population[0].age self.reproduce(self.depth) self.collect_population_data() res = self.check_for_stopping_conditions(5) if (res == 0) and (self.population[0].age > 20): return
octave = sc.Synth( "xiiOctave2x2" ) octave.pitch1 = 0.1 octave.pitch2 = 1 octave.fxlevel = 1 # processed sound octave.level = 0 # clean sound # player > delay > octave > snd card player.outbus = delay.inbus = 4 delay.outbus = octave.inbus = 6 # octave.outbus = 0 # sound card. It is 0 by default so we dont need to do this one. player.rate = 1 # play it now timeout = time.time() + 10 # secs while time.time() < timeout : time.sleep(0.1) # every tenth of sec delay.feedback += 0.01 # more feedback delay.fxlevel += 0.01 # higher delayed sound level octave.pitch1 += 0.01 # increase octave.pitch2 -= 0.01 # decrease print 'fxlevel: %f / feedback: %f / octave pitch1: %f and pitch2: %f : ' % ( delay.fxlevel, delay.feedback, octave.pitch1, octave.pitch2 ) sc.unloadSnd( player.bufnum ) player.free() sc.quit() print 'quiting'
print "Registered Callback-functions are :" for addr in s.getOSCAddressSpace(): print addr # Start OSCServer print "\nStarting OSCServer. Use ctrl-C to quit." st = threading.Thread(target=s.serve_forever) st.start() sc.start(spew=1) # sine = sc.Synth( "sine" ) Latch = sc.Synth("Latch") try: while True: now = time.time() if (now - lastLoop > LOOP_PERIOD): lastLoop = now Latch.rate = xb * 20 + 1 # sine.freq = xb*600+120 #sine.amp = yb*2+1 time.sleep(LOOP_PERIOD / 2) except KeyboardInterrupt: print "\nClosing OSCServer." s.close() Latch.free() sc.quit() print "Waiting for Server-thread to finish" st.join() print "Done"