[See it in action here](https://cdn.alemi.dev/scope-tui-oscilloscope-music.webm) with [Planets](https://youtu.be/XziuEdpVUe0) (oscilloscope music by Jerobeam Fenderson)
I really love [cava](https://github.com/karlstav/cava). It provides a crude but pleasant frequency plot for your music: just the bare minimum to see leads solos and basslines.
I wanted to also be able to see waveforms, but to my knowledge nothing is available. There is some soundcard oscilloscope software available, but the graphical GUI is usually dated and breaks the magic.
I thus decided to solve this very critical issue with my own hands! And over a night of tinkering with pulseaudio (via [libpulse-simple-binding](https://crates.io/crates/libpulse-simple-binding)) and some TUI graphics (via [tui-rs](https://github.com/fdehau/tui-rs)),
the first version of `scope-tui` was developed, with very minimal settings given from command line, but a bonus vectorscope mode baked in.
Currently no binaries or packages are available and you must compile this yourself.
If you don't have the rust toolchain already installed, get it with [rustup](https://rustup.rs/)
Once you have `rustc` and `cargo` installed, clone this repository and compile with cargo:
```bash
$ git clone https://github.com/alemidev/scope-tui
$ cd scope-tui
$ cargo build --release --all-features
```
The resulting binary will be under `./target/release/scope-tui`. Copy it in your PATH or use it from there.
## Sources
A very crude file source is available, which can be a named pipe. While this allows connecting `scope-tui` to a lot of things, it's not super convenient, and more specialized sources should be used when available.
Currently only the PulseAudio source on Linux has been implemented, but more are planned for the future thanks to the modular sources structure.
By default only the file source will be built into `scope-tui`. Enable all sources by passing the `--all-features` flag when compiling, or enable specific features:
*`pulseaudio` : pulseaudio implementation with LibPulse Simple bindings
The audio buffer size directly impacts resource usage, latency and refresh rate and its limits are given by the audio refresh rate. Larger buffers are slower but less resource intensive. A good starting value might be `8192` or tuning to the 0th octave.
While "scatter" plot mode is as precise as the samples are and the terminal lets us be, "line" plot mode simply draws a straight line across points, meaning high frequencies don't get properly represented.