s.addMsgHandler("/b10s/blob", blob_handler) s.addMsgHandler("/b10s/haar", haar_handler) # just checking which handlers we have added 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()
import sc import time print 'hello world........' # we need to tell python where the scserver application lives, this # changes between platforms and systems. You might need to edit it. # exedir = 'usr/local' # where does scsynth live? # sc.start(exedir, verbose=1, spew=1 ) sc.start(verbose=1, spew=1, startscsynth=1) sine = sc.Synth("sine") sine.freq = 444 ##sc.Synth( "sine" ).freq = 444 # <<<< in fact you could do this in this case time.sleep(5) # stay here for 5 secs while sine plays sine.free() sc.quit() print 'seeya world! ...........'
import sc import time, os # we need to tell python where the scserver application lives, this # changes between platforms and systems. You might need to edit it. # exedir = 'usr/local' # where does scsynth live? # sc.start(exedir, verbose=1, spew=1 ) sc.start(spew=1, verbose=1, startscsynth=0) player2 = sc.Synth("StereoPlayer") player2.bufnum = sc.loadSnd("aaa.wav", wait=True) print "loading bufnum with ID", player2.bufnum time.sleep(8) player = sc.Synth("StereoPlayer") player.bufnum = sc.loadSnd("numeros.wav", wait=True) print "loading bufnum with ID", player.bufnum time.sleep(8) # wait while both sounds play sc.unloadSnd(player.bufnum) sc.unloadSnd(player2.bufnum) player.free() player2.free() sc.quit() print 'quiting'
import sc import time, random seed = random.Random() sc.start(verbose=1, spew=1) s = sc.sc.server ################### PMCrotale = sc.Synth("PMCrotale") PMCrotale.freq = 400 timeout = time.time() + 10 # 10 secs while time.time() < timeout: time.sleep(0.5) # loop every half sec PMCrotale.midi = seed.randint(40, 90) PMCrotale.tono = 10 PMCrotale.free() sc.quit() print 'seeya world! ...........'
NOTE that stereo synthdefs take TWO chanels, so if you set out to 2. it will take 2 and 3 to play the stereo. Be careful not to use chanels that are already taken by some other synthdef 0 and 1 are the default sound out chanels, setting a synthdef out to 0 means directing its sound output to the sound card . Sound in from sounds card should be 5 and 6 """ # we need to tell python where the scserver application lives, this # changes between platforms and systems. You might need to edit it. # exedir = '/usr/bin' # where does scsynth live? # sc.start( exedir, verbose=1, spew=0 ) sc.start() # sampler player player = sc.Synth("StereoPlayer") player.bufnum = sc.loadSnd("numeros.wav", wait=True) player.rate = 0 # stopped now print "loading bufnum with ID", player.bufnum # delay delay = sc.Synth("xiiDelay2x2") delay.feedback = 0 # init paramenters that we will manipulate in this script delay.fxlevel = 0 # octave octave = sc.Synth("xiiOctave2x2") octave.pitch1 = 0.1 octave.pitch2 = 1 octave.fxlevel = 1 # processed sound octave.level = 0 # clean sound
import sc import time, random seed = random.Random() sc.start(verbose=1, spew=1) s = sc.sc.server pulse = sc.Synth("pulseTest") pulse = ampHz = 0.4 timeout = time.time() + 10 # 10 secs while time.time() < timeout: time.sleep(0.5) pulse.fund(20) pulse.maxPartial(9) pulse.width(0.8) pulse.free() sc.quit() print "cerrando"
import sc import time print 'hello world........' # we need to tell python where the scserver application lives, this # changes between platforms and systems. You might need to edit it. # exedir = 'usr/local' # where does scsynth live? # sc.start(exedir, verbose=1, spew=1 ) sc.start(verbose=1, spew=1) sine = sc.Synth("sineSynth") sine.freq = 444 ##sc.Synth( "sine" ).freq = 444 # <<<< in fact you could do this in this case time.sleep(5) # stay here for 5 secs while sine plays sine.free() sc.quit() print 'seeya world! ...........'
seed = random.Random() # we need to tell python where the scserver application lives, this # changes between platforms and systems. You might need to edit it. # exedir = 'usr/local' # where does scsynth live? # sc.start( exedir, verbose=0, spew=0 ) sc.start() mygroup = sc.Group() print 'created new group with ID ', mygroup.groupID playerlist = [] for s in xrange(3): player = sc.Synth("StereoPlayer", addTargetID=mygroup.groupID) ## outbus=0, bufnum=0, amp=1, pan=0, mute=1, start=0, end=1, rate=1, fps=12, index=0; player.bufnum = 0 # need to declare here the vars we will be manipulating later player.amp = 1 player.pan = 0 player.rate = 1 playerlist.append(player) ## mygroup.bufnum = sc.loadSnd("numeros.wav") ## all share same sound bufnum mygroup.outbus = 0 # all use same bus print "loading bufnum with ID", player.bufnum timeout = time.time() + 10 # secs while time.time() < timeout: