Esempio n. 1
0
def setup():
	global minim, out, fm
	# initialize the drawing window
	size( 512, 200 )
	
	# initialize the minim and out objects
	minim = Minim(this)
	out   = minim.getLineOut()
	
	# make the Oscil we will hear.
	# arguments are frequency, amplitude, and waveform
	wave = Oscil( 200, 0.8, Waves.TRIANGLE )
	# make the Oscil we will use to modulate the frequency of wave.
	# the frequency of this Oscil will determine how quickly the
	# frequency of wave changes and the amplitude determines how much.
	# since we are using the output of fm directly to set the frequency
	# of wave, you can think of the amplitude as being expressed in Hz.
	fm = Oscil( 10, 2, Waves.SINE )
	# set the offset of fm so that it generates values centered around 200 Hz
	fm.offset.setLastValue( 200 )
	# patch it to the frequency of wave so it controls it
	fm.patch( wave.frequency )
	# and patch wave to the output
	wave.patch( out )
Esempio n. 2
0
oldMouseY = -1
lastMouseDownX = 0
lastMouseDownY = 0
closestBounceLineVertex = 0
closestBounceLine_maxPickingDistance = 20
closestBounceLine_beginMoveX = 0
closestBounceLine_beginMoveY = 0
closestBounceLineDistance = 0
undo_busy = 0
paused = 0
minim = Minim(this)
# bufferSize is the audio buffer length, which directly translates to
# latency (interactivity, really). Less-powerful machines will need a
# larger buffer at the expense of a decrease in responsiveness.
bufferSize = 256
out = minim.getLineOut(Minim.STEREO, bufferSize)
_MIDIRange = 12
_friction = 0.99997


def getMIDIRange():
    return _MIDIRange


def setMIDIRange(MIDIRange):
    global _MIDIRange
    _MIDIRange = MIDIRange


def getFriction():
    return _friction