def draw(self): ol.loadIdentity3() ol.loadIdentity() # Grab the raw audio buffers mono = audio_engine.left_buffer() # mono = np.zeros(512) # Make sure they aren't empty!! if (mono.shape[0] == 0): return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if mono.shape[0] > 10000: audio_engine.clear_all() return ol.loadIdentity3() ol.color3(*(self.color_cycle())) ol.begin(ol.LINESTRIP) for i in range(0, mono.shape[0]-1, self.subsamp): scale_factor = pow(0.9-abs(self.x_coord),0.5)*2 if (mono[i] <= -1.0): mono[i] = 1.0 ol.vertex3((self.x_coord, tanh(mono[i]*scale_factor), -1)) # ol.vertex3((self.x_coord, log(mono[i]*scale_factor+1.0), -1)) self.x_coord = self.x_coord + self.step if (self.x_coord > 0.9) : self.x_coord = -0.9 ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() # Grab the raw audio buffers newbuffer = audio_engine.mono_buffer() # Make sure they aren't empty!! if (len(newbuffer) == 0): return else: self.mono = newbuffer # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if self.mono.shape[0] > 10000: audio_engine.clear_all() ol.loadIdentity3() ol.color3(*(self.color_cycle())) ol.begin(ol.POINTS) for i in range(0, self.mono.shape[0]-1, self.SUBSAMP): val = tanh(self.mono[i] * self.BOOST) val = val * 0.5 + 0.5 val = val * (self.MAX_SIZE - self.MIN_SIZE) + self.MIN_SIZE ol.vertex3((cos(self.pos) * val, sin(self.pos) * val, -1)) self.pos = self.pos + self.W / 30000.0; while(self.pos >= 2*pi): self.pos = self.pos -2*pi ol.end()
def __init__(self): LuxPlugin.__init__(self) ColorDriftPlugin.__init__(self) # Reset things audio_engine.clear_all() self.x_coord = -1.0 self.step = 1 / 256.0 self.subsamp = 2 self.sample_array = np.zeros(512)
def __init__(self): LuxPlugin.__init__(self) ColorDriftPlugin.__init__(self) # Reset things audio_engine.clear_all() self.x_coord = -0.9 self.step = 1/1024.0 self.subsamp = 1 self.sample_array = np.zeros(512)
def draw(self): ol.loadIdentity() ol.rotate(lux.time / 10) # Grab the raw audio buffer mono = audio_engine.mono_buffer() # Make sure it ain't empty!! if mono.shape[0] == 0: return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if mono.shape[0] > 10000: audio_engine.clear_all() ol.color3(*(self.color_cycle())) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) if (lux.time > self.nextSnapshot): #print "snapshot" self.nextSnapshot = lux.time + self.interval self.currentWave = self.nextWave self.nextWave = zeros(shape=(self.renderPointCount)) # load in new values for i in range(int(self.renderPointCount - 1)): self.nextWave[i] = mono[i * self.skip] * 2 # draw shape fracIntervalComplete = ( lux.time - (self.nextSnapshot - self.interval)) / self.interval # print '%f %f %f' % (lux.time,fracIntervalComplete, self.nextSnapshot) coordsToRender = zeros(shape=(self.renderPointCount, 2)) firstVal = None for i in range(int(self.renderPointCount - 1)): val = ((self.nextWave[i] - self.currentWave[i]) * fracIntervalComplete) + self.currentWave[i] if (firstVal is None): firstVal = val #print "next: %f curr: %f frac: %f" % (self.nextWave[i], self.currentWave[i], fracIntervalComplete) (x, y) = self.doTheTrigStuff( val, (float(i) / float(self.renderPointCount)), firstVal) coordsToRender[i][0] = x coordsToRender[i][1] = y coordsToRender[self.renderPointCount - 1] = coordsToRender[0] # render shape ol.begin(ol.LINESTRIP) for i in range(0, int(self.renderPointCount), 1): # print '%f: %f,%f' % (i,coordsToRender[i][0], coordsToRender[i][1]) ol.vertex((coordsToRender[i][0], coordsToRender[i][1])) ol.end() ol.vertex((coordsToRender[0][0], coordsToRender[0][1]))
def draw(self): ol.loadIdentity() ol.rotate(lux.time / 10) # Grab the raw audio buffer mono = audio_engine.mono_buffer() # Make sure it ain't empty!! if mono.shape[0] == 0: return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if mono.shape[0] > 10000: audio_engine.clear_all() return ol.color3(*(self.color_cycle())) ol.perspective(60, 1, 1, 100) ol.translate3((0, 0, -3)) if lux.time > self.nextSnapshot: # print "snapshot" self.nextSnapshot = lux.time + self.interval self.currentWave = self.nextWave self.nextWave = zeros(shape=(self.renderPointCount)) # load in new values for i in range(self.renderPointCount - 1): self.nextWave[i] = mono[i * self.skip] # draw shape fracIntervalComplete = (lux.time - (self.nextSnapshot - self.interval)) / self.interval # print '%f %f %f' % (lux.time,fracIntervalComplete, self.nextSnapshot) coordsToRender = zeros(shape=(self.renderPointCount, 2)) firstVal = None for i in range(self.renderPointCount - 1): val = ((self.nextWave[i] - self.currentWave[i]) * fracIntervalComplete) + self.currentWave[i] if firstVal is None: firstVal = val # print "next: %f curr: %f frac: %f" % (self.nextWave[i], self.currentWave[i], fracIntervalComplete) (x, y) = self.doTheTrigStuff(val, (float(i) / float(self.renderPointCount)), firstVal) coordsToRender[i][0] = x coordsToRender[i][1] = y coordsToRender[self.renderPointCount - 1] = coordsToRender[0] # render shape ol.begin(ol.LINESTRIP) for i in range(self.renderPointCount): # print '%f: %f,%f' % (i,coordsToRender[i][0], coordsToRender[i][1]) ol.vertex((coordsToRender[i][0], coordsToRender[i][1])) ol.end()
def __init__(self): LuxPlugin.__init__(self) ColorDriftPlugin.__init__(self) # Reset things audio_engine.clear_all() # Constants self.SUBSAMP = 3 self.BOOST = 8 self.MIN_SIZE = 0.2 self.MAX_SIZE = 1.0 self.W = 523.251131 / 4.0 * pi; self.pos = 0.0
def __init__(self): LuxPlugin.__init__(self) ColorDriftPlugin.__init__(self) # Reset things audio_engine.clear_all() # Constants self.SUBSAMP = 20 self.BOOST = 8 self.MIN_SIZE = 0.2 self.MAX_SIZE = 1.0 self.W = 523.251131 / 4.0 * pi; self.pos = 0.0 self.mono = None
def get_audio(self): # Grab the raw audio buffers left = audio_engine.left_buffer() right = audio_engine.right_buffer() mono = audio_engine.mono_buffer() #print mono.shape[0] # Make sure they aren't empty!! if (mono.shape[0] == 0 or left.shape[0] == 0 or right.shape[0] == 0): return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if left.shape[0] > 10000: print "too many audio samples" audio_engine.clear_all() if left.shape[0] != right.shape[0]: print "unequal number of samples left/right" audio_engine.clear_all() return (left, right, mono)
def draw(self): ol.loadIdentity3() ol.loadIdentity() # Grab the raw audio buffers mono = audio_engine.left_buffer() # mono = np.zeros(512) # Make sure they aren't empty!! if (mono.shape[0] == 0): return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if mono.shape[0] > 10000: audio_engine.clear_all() ol.loadIdentity3() ol.color3(*(self.color_cycle())) count = 0 while count < mono.shape[0]: ol.begin(ol.LINESTRIP) while self.x_coord < 1.0 and count < mono.shape[0]: scale_factor = pow(1.0 - abs(self.x_coord), 0.5) * 2 #ol.vertex3((self.x_coord, mono[count]*scale_factor, -1)) # Linear ol.vertex3((self.x_coord, tanh(mono[count] * scale_factor), -1)) # Tanh #ol.vertex3((self.x_coord, log(mono[count]*scale_factor+1.0), -1)) # Sigmoid self.x_coord += self.step count = count + self.subsamp ol.end() if self.x_coord >= 1.0: self.x_coord = -1.0 ol.end()
def draw(self): ol.loadIdentity3() ol.loadIdentity() # Grab the raw audio buffers mono = audio_engine.left_buffer() # mono = np.zeros(512) # Make sure they aren't empty!! if (mono.shape[0] == 0): return # Openlase can only draw 30000 points in one cycle (less that # that, actually!). Clear the audio buffer and try again! if mono.shape[0] > 10000: audio_engine.clear_all() ol.loadIdentity3() ol.color3(*(self.color_cycle())) count = 0 while count < mono.shape[0]: ol.begin(ol.LINESTRIP) while self.x_coord < 1.0 and count < mono.shape[0]: scale_factor = pow(1.0-abs(self.x_coord),0.5)*2 #ol.vertex3((self.x_coord, mono[count]*scale_factor, -1)) # Linear ol.vertex3((self.x_coord, tanh(mono[count]*scale_factor), -1)) # Tanh #ol.vertex3((self.x_coord, log(mono[count]*scale_factor+1.0), -1)) # Sigmoid self.x_coord += self.step count = count + self.subsamp ol.end() if self.x_coord >= 1.0: self.x_coord = -1.0 ol.end()