Skip to content

agehama/minimal_spectrum_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimal_spectrum_analyzer

A tiny, embeddable command-line sound visualizer.

Supports Linux (PulseAudio) and Windows (WASAPI).

analyzer_image

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.

Clone source code with Git.

$ git clone --recursive https://github.com/agehama/minimal_spectrum_analyzer.git

Configure and Generate Visual Studio project. image

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.

embedding_image

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.

Releases

No releases published

Packages

No packages published