Пример #1
0
	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
Пример #2
0
 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
Пример #3
0
	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
Пример #4
0
def main():
	
	pygame.init()
	pygame.fastevent.init()
	pygame.midi.init()
	
	# initialize supercollider
	sc.start()

	game = Game() 

	while game.running:
		
		game.clock.tick(60)
		game.update()
Пример #5
0
def setup():
    global prevFrame, frame, mCamera
    global mDetector, mCascade
    global POWS, GPIOS, powVals, gpioVals
    global mSynth

    sc.start()
    mSynth = sc.Synth("fmSynth")
    #mSynth = sc.Synth("PMCrotale")

    GPIO.setmode(GPIO.BCM)
    for pin in (POWS+GPIOS):
        GPIO.setup(pin, GPIO.OUT)

    mCamera = Camera(CAM_RES)
    mCamera.update()

    frame = cv2.blur(cv2.cvtColor(mCamera.frame, cv2.COLOR_RGB2GRAY), (4,4))
    prevFrame = frame

    # Setup SimpleBlobDetector parameters.
    mParams = cv2.SimpleBlobDetector_Params()
    mParams.minThreshold = 16;
    mParams.maxThreshold = 32;
    mParams.filterByArea = True
    mParams.minArea = 64
    mParams.maxArea = 10e3
    mParams.filterByConvexity = True
    mParams.minConvexity = 0.001
    mParams.filterByInertia = True
    mParams.minInertiaRatio = 0.001

    mDetector = cv2.SimpleBlobDetector(mParams)
    mCascade = None

    if len(sys.argv) > 1:
        mCascade = cv2.CascadeClassifier(sys.argv[1])
    else:
        print "Please provide a cascade file if you want to do face/body detection."
Пример #6
0
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, os

""" just prints the value sent by scserver, in this case the playhead position in the sound
    being 0 the begining and 1 the end of the sample
    This is only because the StereoPlayer synthdef has coded a trigger object that sends periodically
    the playhead location. 
"""

# 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 )

def dothis(msg) :
    print 'play head at ', msg[3]

sc.register( '/tr', dothis ) # call dothis function when a /tr message arrives

player = sc.Synth( "StereoPlayer" )

player.bufnum = sc.loadSnd( "numeros.wav", wait=True )

print "loading bufnum with ID", player.bufnum

time.sleep(5) # wait while sound plays

sc.unloadSnd( player.bufnum )
player.free()
Пример #8
0
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( "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! ...........'
Пример #9
0
import sc
import time, random

sc.start(verbose=1, spew=1)
s = sc.sc.server

Latch = sc.Synth("Latch")
Latch = rate = 9

timeout = time.time() + 10  # 10 secs

while time.time() < timeout:
    time.sleep(0.5)
    Latch.rate(20)

Latch.free()
sc.quit()

print "cerrando"
Пример #10
0
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()
Пример #11
0
note that we just declare the ones that we need to set or manipulate. the rest will take the default
values listed above.

 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
Пример #12
0
import sc, time, os


sc.start(verbose=1)

time.sleep(3) # wait while sound plays

s = sc.sc.server ###################

s.sendMsg('/d_load', os.path.join(os.getcwd(),'synthdefs','StereoPlayer.scsyndef'));

time.sleep(1)

# no data at buffer index 500 -- silent synth
s.sendMsg("/s_new", "StereoPlayer", 1967)

time.sleep(1)

s.sendMsg('/b_allocRead', 1000, os.path.join(os.getcwd(),'sounds','numeros.wav'), 0, -1);

time.sleep(1) 

# but here, of course
s.sendMsg("/n_set", 1967, "bufnum", 1000);
s.sendMsg("/n_set", 1967, "pos", 0.1);


s.sendMsg('/d_load', os.path.join(os.getcwd(),'synthdefs','sine.scsyndef'));

time.sleep(1)
Пример #13
0
Файл: sine.py Проект: enrike/sc
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! ...........'
Пример #14
0
import sc, time, os

sc.start(verbose=1)

time.sleep(3)  # wait while sound plays

s = sc.sc.server  ###################

s.sendMsg('/d_load',
          os.path.join(os.getcwd(), 'synthdefs', 'StereoPlayer.scsyndef'))

time.sleep(1)

# no data at buffer index 500 -- silent synth
s.sendMsg("/s_new", "StereoPlayer", 1967)

time.sleep(1)

s.sendMsg('/b_allocRead', 1000,
          os.path.join(os.getcwd(), 'sounds', 'numeros.wav'), 0, -1)

time.sleep(1)

# but here, of course
s.sendMsg("/n_set", 1967, "bufnum", 1000)
s.sendMsg("/n_set", 1967, "pos", 0.1)

s.sendMsg('/d_load', os.path.join(os.getcwd(), 'synthdefs', 'sine.scsyndef'))

time.sleep(1)
Пример #15
0
    sh = stuff[2]


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."
Пример #16
0
note that we just declare the ones that we need to set or manipulate. the rest will take the default
values listed above.

 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
Пример #17
0
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! ...........'