https://github.com/agehama/minimal_spectrum_analyzer
A tiny, embeddable command-line sound visualizer
https://github.com/agehama/minimal_spectrum_analyzer
command-line linux spectrum-analyzer terminal visualizer windows
Last synced: 8 months ago
JSON representation
A tiny, embeddable command-line sound visualizer
- Host: GitHub
- URL: https://github.com/agehama/minimal_spectrum_analyzer
- Owner: agehama
- License: mit
- Created: 2021-04-30T01:12:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-04-14T11:02:26.000Z (about 4 years ago)
- Last Synced: 2025-02-09T03:07:26.886Z (over 1 year ago)
- Topics: command-line, linux, spectrum-analyzer, terminal, visualizer, windows
- Language: C++
- Homepage:
- Size: 466 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minimal_spectrum_analyzer
A tiny, embeddable command-line sound visualizer.
Supports Linux (PulseAudio) and Windows (WASAPI).

## Building
### Ubuntu
- C++ compiler that supports C++17
- CMake
- PulseAudio development library
Install required packages.
```
$ sudo apt install cmake libpulse-dev
```
Clone and build source code.
```
$ git clone --recursive https://github.com/agehama/minimal_spectrum_analyzer.git
$ mkdir build
$ cd build
$ cmake ../minimal_spectrum_analyzer .
$ make
```
### Windows
Download and install prerequisites.
- Visual Studio 2019 https://visualstudio.microsoft.com/downloads/
- CMake https://cmake.org/download/
- Git for Windows https://gitforwindows.org/
Clone source code with Git.
```
$ git clone --recursive https://github.com/agehama/minimal_spectrum_analyzer.git
```
Configure and Generate Visual Studio project.

Open generated project and build with Visual Studio.
## Embedding
To embed the spectrum display into other software, you can receive the text via standard output.

Here is an example of how to pass it through a temporary file.
First, start a background process that redirects the stdout of `analyzer` to a log file.
Make sure to turn off the axis display and set the delimiter to LF.
```
$ analyzer --axis off --line_feed LF > analyzer_log &
```
Then `analyzer_log` will contain time-series spectral data separated by LF, as shown below.
```
$ tail -n 10 ./analyzer_log
⣀⣠⣶⣾⣿⣷⣦⣤⣀⣠⣄⡀⢀⡀⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⡀⣀⠀⠀⠀
⣠⣤⣶⣾⣿⣷⣦⣤⣀⣀⣀⡀⢀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⣀⠀⠀⠀
⣤⣴⣶⣶⣶⣦⣤⣤⣀⣀⢀⡀⠀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣴⣶⣶⣶⣶⣦⣤⣤⣀⣀⢀⠀⠀⠀⣀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣴⣶⣶⣶⣶⣦⣤⣤⣀⢀⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣴⣶⣶⣶⣶⣤⣤⣄⣀⠀⠀⠀⠀⠀⣀⠀⠀⡀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣴⣶⣶⣶⣶⣤⣤⣄⣀⠀⠀⠀⠀⠀⣀⠀⠀⡀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣴⣶⣶⣶⣶⣦⣤⣤⣀⠀⠀⠀⠀⠀⣀⠀⢀⡀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀
⣤⣴⣶⣶⣶⣦⣤⣤⣀⣀⠀⠀⢀⣀⣤⣀⣀⡀⢀⣀⡀⢀⡀⣀⢀⣀⣀⣀⣄⣀⣀⣀
⣤⣤⣶⣶⣦⣤⣄⣤⣀⣀⡀⠀⣀⣠⣤⣤⣤⣀⣠⣄⣤⣠⣄⣤⣀⣤⣤⣠⣦⣤⣤⣤
```
Then, call `tail -n 1 analyzer_log` from shell, python, or any other environment you like to embed the spectrum display into your program.