Esempio n. 1
0
def setup():
    size(512, 200, P2D)
    # always start Minim before you do anything with it
    global minim
    minim = Minim(this)
    global kick
    # load BD.mp3 from the data folder with a 1024 sample buffer
    kick = minim.loadSample("BD.mp3")
def setup():
    size(512, 200)
    # always start Minim before you do anything with it
    global minim
    minim = Minim(this)
    global kick
    # load BD.mp3 from the data folder with a 1024 sample buffer
    kick = minim.loadSample("BD.mp3")
Esempio n. 3
0
def setup():
    global fft_lin
    global song
    global mshader
    global pg
    size(W, H, P2D)
    frameRate(FPS)

    pg = createGraphics(W, H)
    pg.noStroke()
    pg.fill(255)

    mshader = loadShader('sound.glsl')
    mshader.set('resolution', float(W), float(H))

    minim = Minim(this)
    song = minim.loadFile('trentemoller.mp3', 1024)

    fft_lin = FFT(song.bufferSize(), song.sampleRate())
    fft_lin.linAverages(120)
Esempio n. 4
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. 5
0
def setup():
	global minim
	sketch.setup()
	minim = Minim(this)
	sounds['shoot'] = minim.loadSnippet("shoot.wav")
	sounds['discard'] = minim.loadSnippet("discard.wav")
	sounds['failure'] = minim.loadSnippet("failure.wav")
	sounds['success'] = minim.loadSnippet("success.wav")
	sounds['etude1'] = minim.loadSnippet("etude1.wav")
	sounds['etude2'] = minim.loadSnippet("etude2.wav")
	sounds['tick'] = minim.loadSnippet("tick.wav")
Esempio n. 6
0
class AudioManager:

    def __init__(self):
        self.minim = Minim(this)
        self.audioFiles = {}

    def loadAudio(self, path):
        soundFile = self.minim.loadFile(path)
        self.audioFiles[path] = soundFile

    def isAudio(self, path):
        return path in self.audioFiles
    
    def getAudio(self, path):
        if path in self.audioFiles:
            return self.audioFiles[path]
        return False

    def getAudioCount(self):
        return size(self.audioFiles)
Esempio n. 7
0
 def __init__(self):
     self.minim = Minim(this)
     self.audioFiles = {}
Esempio n. 8
0
ball_drop_rate = 3300
oldMillis = 0
clickCount = 0
mousestate_draggingvert = 0
oldMouseX = -1
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