energy_label.setText('Energy', color=inactive_color) scroll_label.setText('Scroll', color=active_color) spectrum_label.setText('Spectrum', color=inactive_color) def spectrum_click(x): global visualization_effect visualization_effect = visualize_spectrum energy_label.setText('Energy', color=inactive_color) scroll_label.setText('Scroll', color=inactive_color) spectrum_label.setText('Spectrum', color=active_color) # Create effect "buttons" (labels with click event) energy_label = pg.LabelItem('Energy') scroll_label = pg.LabelItem('Scroll') spectrum_label = pg.LabelItem('Spectrum') energy_label.mousePressEvent = energy_click scroll_label.mousePressEvent = scroll_click spectrum_label.mousePressEvent = spectrum_click energy_click(0) # Layout layout.nextRow() layout.addItem(freq_label, colspan=3) layout.nextRow() layout.addItem(freq_slider, colspan=3) layout.nextRow() layout.addItem(energy_label) layout.addItem(scroll_label) layout.addItem(spectrum_label) # Initialize LEDs led.update() # Start listening to live audio stream microphone.start_stream(microphone_update)
def startLed(): # Initialize LEDs led.update() # Start listening to live audio stream microphone.start_stream(microphone_update)
energy_label.setText('Energy', color=inactive_color) scroll_label.setText('Scroll', color=active_color) spectrum_label.setText('Spectrum', color=inactive_color) def spectrum_click(x): global visualization_effect visualization_effect = visualize_spectrum energy_label.setText('Energy', color=inactive_color) scroll_label.setText('Scroll', color=inactive_color) spectrum_label.setText('Spectrum', color=active_color) # Create effect "buttons" (labels with click event) energy_label = pg.LabelItem('Energy') scroll_label = pg.LabelItem('Scroll') spectrum_label = pg.LabelItem('Spectrum') energy_label.mousePressEvent = energy_click scroll_label.mousePressEvent = scroll_click spectrum_label.mousePressEvent = spectrum_click energy_click(0) # Layout layout.nextRow() layout.addItem(freq_label, colspan=3) layout.nextRow() layout.addItem(freq_slider, colspan=3) layout.nextRow() layout.addItem(energy_label) layout.addItem(scroll_label) layout.addItem(spectrum_label) # Initialize LEDs led.update() # Start listening to live audio stream microphone.start_stream(microphone_update)
def start_stream(): microphone.start_stream(microphone_update)