A simple, janky, yet charming terminal-based audio visualizer written in Python. It can visualize audio data from a microphone or any other audio input device.
See /image_gallery
to see the program in action.
sudo apt-get install -y portaudio19-dev
Setup a loopback device.
brew install blackhole-2ch
On Windows, audio routing can be tricky. If you want to visualize audio from your speakers or headphones instead of just the microphone, you will need to use a virtual audio cable. Follow these steps:
This will allow for the program to render the audio that is being outputted on the device as well as continue to have the user be able to hear the same audio.
brew install audio_visualizer
Will add to other package managers (like winget, AUR, etc) if asked.
Clone the repository:
git clone https://github.com/gituser12981u2/audio_visualizer
Set up a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
# On Windows, use '.venv\Scripts\activate'
Install the package:
pip install .
If your system has a compatible Nvidia or AMD GPU, you can enable GPU acceleration by installing an additional dependency:
pip install .[gpu]
<package manager install> audio_visualizer --with-gpu
Note: GPU acceleration is not recommended if your system supports AMX, as native operations are more efficient for this program.
Then follow these instructions to install the CUDA––for Nvidia––or ROCm––for AMD––toolkit.
To Start the visualizer, use the following command:
audio-visualizer
Or run this command for the same outcome:
audio-visualizer --mode vertical
Or to run in horizontal mode:
audio-visualizer --mode horizontal-ltr
Note: there are two horizontal modes. One that draws bars from left to right (ltr) and one that draws bars from right to left (rtl)
Modify config.lua
to change default settings and key bindings. This file controls various aspects of the Audio Visualizer's behavior, including the visual mode, hotkeys, and audio processing parameters.
config.lua
in ~/.config/audio_visualizer/
. This is the recommended location as it follows the standard configuration directory structure on Unix-like systems.config.lua
in %APPDATA%\audio-visualizer\
. This location is recommended for Windows users as it aligns with the typical application data storage.If a config.lua
file is not found in these locations, the program will attempt to load it from the directory where the audio-visualizer
command is executed.
Switch visualization modes dynamically with configured hotkeys. For example, the default keybindings are:
Themes allow you to customize the visual appearance of the audio visualizer:
--mode
: Visualization mode('vertical or horizontal). Default is vertical
. That is if you put no --mode
option.--alpha
: Smoothing factor for FFT. Default is 0.4
.--chunk
: Number of frames per buffer. Default is 2048
.--rate
: Sampling rate Default is 44100
.Example:
audio-visualizer --mode horizontal-rtl --alpha 0.3 --chunk 1024 --rate 48000
This project is licensed under the MIT License. See the LICENSE file for details.
This project is inspired by cava.
Thank you to the follow people for their contributions to this project:
-@ohksith - Provided fix for the terminal to clean it self after visualization stopped