本文整理汇总了Python中emulator.Emulator.amplitudes方法的典型用法代码示例。如果您正苦于以下问题:Python Emulator.amplitudes方法的具体用法?Python Emulator.amplitudes怎么用?Python Emulator.amplitudes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emulator.Emulator
的用法示例。
在下文中一共展示了Emulator.amplitudes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from emulator import Emulator [as 别名]
# 或者: from emulator.Emulator import amplitudes [as 别名]
def main():
if DEMO_OUTPUT:
#from emulator import CombinedOutput # importing this without X fails
#output = CombinedOutput(SERIAL_DEVICE, BAUD, width=EMULATOR_WIDTH, height=EMULATOR_HEIGHT)
from emulator import Emulator # importing this without X fails
output = Emulator(width=EMULATOR_WIDTH, height=EMULATOR_HEIGHT)
else:
output = Serial(SERIAL_DEVICE, BAUD, timeout=1.5)
analyzer_read, analyzer_write = multiprocessing.Pipe(False)
analyzer = audio.Analyzer(analyzer_write, '/mnt/a/mpd.fifo', window_size=4096, squelch=False, std=False)
analyzer.start()
print "Analyzer started."
#layer_1 = Layer([util.Color(), util.Color(), util.Color(), util.Color()])
#layer_2 = Layer([util.Color(), util.Color(), util.Color(), util.Color()])
#layer_3 = Layer([util.Color(), util.Color(), util.Color(), util.Color()])
#layer_4 = Layer([util.Color(), util.Color(), util.Color(), util.Color()])
#pattern = HSVRotate(layer_1)
# WHOOP WHOOP ITS DA LIGHT OF DA POLICE
#pattern_1 = Irrlicht(layer_1, util.Color(hue=340, saturation=1, value=1), step=8, spot_width=140)
#pattern_1.deg = 180
#pattern_2 = Irrlicht(layer_2, util.Color(hue=200, saturation=1, value=1), step=8, spot_width=140)
#pattern_1 = Irrlicht(layer_1, util.Color(hue=250, saturation=1, value=0.5), step=0.36, spot_width=270)
#pattern_2 = Irrlicht(layer_2, util.Color(hue=30, saturation=1, value=0.8), step=0.36, spot_width=90)
#pattern_2.deg = 180
#pattern_3 = Irrlicht(layer_3, util.Color(hue=90, saturation=1, value=1.0), step=-0.2, spot_width=270)
# water-ish
#pattern_1 = Irrlicht(layer_1, util.Color(hue=200, saturation=1, value=0.2), step=2.17, spot_width=120)
#pattern_2 = Irrlicht(layer_2, util.Color(hue=190, saturation=1, value=0.2), step=-4.23, spot_width=200)
#pattern_3 = Irrlicht(layer_3, util.Color(hue=240, saturation=1, value=0.05), step=-16.1)
#pattern_4 = Irrlicht(layer_4, util.Color(hue=170, saturation=1, value=0.05), step=18.3)
# fire-ish
#pattern_1 = Irrlicht(layer_1, util.Color(hue=20, saturation=1, value=0.2), step=2, spot_width=200)
#pattern_1.deg = 180
#pattern_2 = Irrlicht(layer_2, util.Color(hue=40, saturation=1, value=1), step=-4, spot_width=200)
#pattern_3 = Irrlicht(layer_3, util.Color(hue=320, saturation=1, value=0.217), step=-16)
#pattern_4 = Irrlicht(layer_4, util.Color(hue=40, saturation=1, value=0.264317), step=12)
#pattern_1 = Ravelicht(4, util.Color(hue=40, saturation=1, value=1), spot_width=120)
#pattern_2 = Irrlicht(layer_2, util.Color(hue=180, saturation=1, value=1), step=-14, spot_width=140)
#pattern_2 = Visualizer(layer_2)
pattern_1 = Ravelichter(size=4)
display = Display(output, size=4, layers=[pattern_1])
time.sleep(2)
while True:
if analyzer_read.poll():
amplitudes = analyzer_read.recv()
if DEMO_OUTPUT:
#output.emulator.amplitudes = amplitudes
output.amplitudes = amplitudes
pattern_1.update(amplitudes)
#pattern_2.update(amplitudes)
#pattern_3.update()
#pattern_4.update()
display.update()
display.render()