Exemplo n.º 1
0
 def generate(self):
     self.graphics.fill(BLACK)
     for i in range(0, self.wave_range, self.wave_step):
         for self.y in range(0, matrix_height):
             self.x = math.sin(self.y*self.freq+self.phase)*self.amplitude+self.offset + i
             b = translate(i, 0, matrix_width, 0, 50)
             g = translate(self.y, 0, matrix_height, 0, 80)
             r = translate(self.x, 0, 12, 0, 24)
             self.color = (int(r), int(g), int(b))
             self.graphics.drawPixel(self.x, self.y, self.color)
     return self.graphics.getSurface()
Exemplo n.º 2
0
 def generate(self):
     data = getaverageof(10, self.controller)
     if data:
         data = int(translate(data, 0, 700, 0, 8))
         self.graphics.fill(BLACK)
         self.graphics.drawLine(0, 0, data - 10, 0, BLUE)
     return self.graphics.getSurface()
Exemplo n.º 3
0
 def generate(self):
     self.graphics.fill(BLACK)
     data = getaverageof(10, self.controller)
     data = int(translate(data, 0, 700, 0, 8))
     for i in range(0, 17):
         self.graphics.drawLine(0, i, data - 10, 0, BLUE)
     return self.graphics.getSurface()
Exemplo n.º 4
0
 def generate(self):
     audio = self.getaudio()
     rmsed = translate(rms(audio), 0, 0xffff/5, 0, matrix_height)
     self.color = interp_color(rms(audio/10000))
     self.color = color_convert(self.color)
     self.graphics.fill(self.color)
     return self.graphics.getSurface()
Exemplo n.º 5
0
 def generate(self):
     self.graphics.fill(BLACK)
     if self.timer.valid():
         self.phase+=1
     for i in range(0, self.wave_range, self.wave_step):
         for self.y in range(0, matrix_height):
             if self.controlled:
                 self.freq = self.mc.getButton(0, 0)/126.
                 self.amplitude = self.mc.getButton(0, 1)
                 self.timer.set_interval(self.mc.getButton(0, 2)/126.)
             self.x = math.sin(self.y*self.freq+self.phase)*self.amplitude+self.offset + i
             b = translate(i, 0, matrix_width, 0, 50)
             g = translate(self.y, 0, matrix_height, 0, 80)
             r = translate(self.x, 0, 12, 0, 24)
             self.color = (255, 0, 0)
             self.graphics.drawPixel(self.x, self.y, self.color)
     return self.graphics.getSurface()
Exemplo n.º 6
0
 def generate(self):
     self.graphics.fill(BLACK)
     audio = self.getaudio()
     rmsed = translate(rms(audio), 0, ((2**16)/2)/2, 0, matrix_height*2)
     self.color = interp_color(rms(audio/10000))
     self.color = color_convert(self.color)
     for i in range(0, matrix_width):
         self.graphics.drawLine(i, 0, i, rmsed, self.color)
     return self.graphics.getSurface()
Exemplo n.º 7
0
 def generate(self):
     average = self.getinputs()
     self.graphics.fill(BLACK)
     for i, line in enumerate(self.inputs):
         if line > self.max:
             self.max = line
         else:
             if self.max <= self.lim:
                 self.max = self.lim
             else:
                 self.max -= int((self.max - self.lim) / self.rate)
         length = int(translate(average, 0, self.max, 0, matrix_height))
         data = int(translate(line, 0, average, 0, length))
         if data > 0xff:
             self.data = 0xff
         if data > self.max:
             self.max = data
         self.graphics.drawLine(0, i, data - self.offset, i, self.color)
     return self.graphics.getSurface()