visualizer

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package visualizer renders audio snapshots into bounded terminal canvases. It knows nothing about processes, sockets, Bubble Tea, or playback commands.

Index

Constants

This section is empty.

Variables

View Source
var Modes = []string{
	"spectrum", "bars", "mirror", "skyline", "dots", "peaks", "ribbon",
	"waterfall", "spectrogram", "scope", "stereo-scope", "wave", "filled-wave",
	"vectorscope", "lissajous", "orbit", "rings", "radar", "spiral",
	"particles", "rain", "matrix", "flame", "embers", "pulse", "diamonds",
	"tunnel", "starburst", "led", "vu", "balance",
}

Modes is the stable order used by the REPL's picker and cycle binding.

Functions

func Index

func Index(name string) int

Index returns a mode's position in Modes, or -1 if the name is unknown.

func Level

func Level(x float64) float64

Level maps a linear amplitude onto a clamped -60 to 0 dB display scale.

Types

type Renderer

type Renderer struct {
	// Frame is the most recently supplied audio snapshot.
	Frame audio.Frame
	// contains filtered or unexported fields
}

Renderer owns only presentation state: attack/release, peak hold, and a fixed-size history. Advance is separate from Render, so resize/redraw cannot advance animation. The subscriber, rather than terminal redraws, drives time.

func (*Renderer) Advance

func (r *Renderer) Advance(f audio.Frame, now time.Time)

Advance updates presentation state using an audio frame and elapsed time.

func (*Renderer) Render

func (r *Renderer) Render(mode string, width, height int) string

Render is deterministic and read-only. Size caps bound CPU and allocation even for unusually large terminal resize events.

func (*Renderer) Reset

func (r *Renderer) Reset()

Reset clears audio, smoothing, peak holds, and animation history.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL