Visualize audio frequency changes

This custom PyQt5/PySide2-compatible widget provides a frequency visualizer output for audio applications. It is completely configurable from the number of bars, the number of segments and colours to the animated decay. It's ready to drop into your Python-Qt5 applications.

The download package includes a demo animation using random data and some custom colour configuration so you can explore how the widget works.

Basic setup

To create an Equalizer object pass in the number of bars and a number of segments per bar.

equalizer = Equalizer(5, 10)

The default appearance of the widget. The default appearance of the widget.

The default range for each of the equalizer bars is 0...100. This can be adjusted using .setRange.

equalizer.setRange(0, 1000)

Decay animation

The equalizer bar includes a decay animation where peaks of values slowly fade over time. This is created by gradually subtracting a set value from the current value of each bar, using a recurring timer.

The frequency of the decay timer (in milliseconds) can be configured using .setDecayFrequencyMs. The default value is 100ms.


Passing 0 will disable the decay mechanism.

On each tick a set value is removed from the current value of each bar. This is configured by using .setDecay. Adjust this based on your equalizer's range of possible values.

equalizer.setDecay(0, 1000)

Create GUI Applications with Python & Qt6
The easy way to create desktop applications

My complete guide, updated for 2021 & PyQt6. Everything you need build real apps.

Downloadable ebook (PDF, ePub) & Complete Source code

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount with the code [[ couponCode ]] — Enjoy!

For [[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount with the code [[ couponCode ]] — Enjoy!

Bar style configuration

The number of bars to display and the number of segments in the bars/the colours of those bars are defined at startup.

equalizer = EqualizerBar(10,  ["#2d004b", "#542788", "#8073ac", "#b2abd2", "#d8daeb", "#f7f7f7", "#fee0b6", "#fdb863", "#e08214", "#b35806", "#7f3b08"])

Purple Orange theme with 10 bars Purple Orange theme with 10 bars

To set the colours after startup, either provide a list of colors (QColor or hex values) at startup, or use the .setColors method. Passing a list of colours to this method will change the number of segments to match the colours provided.

equalizer.setColors(["#810f7c", "#8856a7", "#8c96c6", "#b3cde3", "#edf8fb"])

You can also use .setColor to set a single colour for all segments, without changing the number of bars.


The spacing around the equalizer graphic is configured with .setBarPadding providing an integer value to add in pixels.


The proportion of each segment in the bar which is solid/empty is configured using .setBarSolidPercent with a float value between 0...1.


Finally, the background colour can be configured using .setBackgroundColor


Customising bar padding and sizing. Customising bar padding and sizing.

Continue reading

Introduction to the QGraphics framework  pyqt

The Qt Graphics View Framework allows you to develop fast and efficient 2D vector graphic scenes. Scenes can contain millions of items, each with their own features and behaviors. By using the Graphics View via PyQt you get access to this highly performant graphics layer in Python. Whether you're integrating vector graphics views into an existing PyQt application, or simply want a powerful vector graphics interface for Python, Qt's Graphics View is what you're looking for. More