Introduction¶
CircuitPython graphic equalizer
Dependencies¶
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Usage Example¶

Please see the equalizer_simlpetest.py
example for initial reference
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
For information on building library documentation, please check out this guide.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2021 Jose David M.
2#
3# SPDX-License-Identifier: MIT
4#############################
5"""
6This is a basic demonstration of a Equalizer widget.
7"""
8
9import time
10import board
11import displayio
12from equalizer.equalizer import Equalizer
13
14display = board.DISPLAY # create the display on the PyPortal or Clue (for example)
15# otherwise change this to setup the display
16# for display chip driver and pinout you have (e.g. ILI9341)
17
18
19# Create a Equalizer widget
20my_equa = Equalizer(
21 x=100,
22 y=100,
23 width=100,
24 height=100,
25 number_bars=5,
26 bar_width=10,
27 number_segments=6,
28 segments_height=25,
29 bar_best_fit=True,
30 pad_x=2,
31)
32
33my_group = displayio.Group()
34my_group.append(my_equa)
35display.show(my_group) # add high level Group to the display
36
37while True:
38 # We updates the values for 5 bars. We update the values for
39 # each bar
40 my_equa.show_bars((10, 0, 10, 35, 85))
41 time.sleep(0.5)
42
43 my_equa.show_bars((70, 10, 0, 10, 35))
44 time.sleep(0.5)
45
46 my_equa.show_bars((0, 10, 35, 0, 90))
47 time.sleep(0.5)
48
49 my_equa.show_bars((35, 85, 10, 0, 10))
50 time.sleep(0.5)
51
52 my_equa.show_bars((10, 35, 85, 10, 0))
53 time.sleep(0.5)
54
55 my_equa.show_bars((0, 10, 35, 56, 90))
56 time.sleep(0.5)
Equalizer Library¶
equalizer
¶
- equalizer.float_rgb(mag, cmin, cmax)¶
Return a tuple of floats between 0 and 1 for the red, green and blue amplitudes.
- equalizer.rectangle_helper(x0: int, y0: int, height: int, width: int, bitmap, color_index: int, palette, bitmaptool: bool = True) None ¶
rectangle_helper function Draws a rectangle to the bitmap given using
bitmapstools.bitmap
orvectorio.rectangle
functions- Parameters
x0 (int) – rectangle lower corner x position
y0 (int) – rectangle lower corner y position
width (int) – rectangle upper corner x position
height (int) – rectangle upper corner y position
color_index (int) – palette color index to be used
palette – palette object to be used to draw the rectangle
bitmap – bitmap for the rectangle to be drawn
bitmaptool (bool) – uses
draw_line()
to draw the rectangle. whenFalse
usesRectangle()
- Returns
None
- Return type
None
- equalizer.rgb(mag, cmin, cmax)¶
Return a tuple of integers to be used in AWT/Java plots.