visualizers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MusicNoteFallback

func MusicNoteFallback() image.Image

Types

type AlbumArt

type AlbumArt struct {
	// contains filtered or unexported fields
}

func NewAlbumArt

func NewAlbumArt() *AlbumArt

func (*AlbumArt) Advance

func (a *AlbumArt) Advance()

func (*AlbumArt) Init

func (a *AlbumArt) Init(seed string, durationMs int)

func (*AlbumArt) SetImage

func (a *AlbumArt) SetImage(img image.Image)

func (*AlbumArt) View

func (a *AlbumArt) View(width, height int) string

type AudioAware

type AudioAware interface {
	SetAudioData(data *audio.FrequencyData)
}

AudioAware is implemented by visualizers that consume real-time frequency data.

type BeatDetector added in v0.1.1

type BeatDetector struct {
	TempoMul float64 // 0.4–1.6, maps BPM to speed multiplier
	Pulse    float64 // 1.0 on beat, decays toward 0
	// contains filtered or unexported fields
}

BeatDetector uses spectral flux with an adaptive threshold to detect beats and estimate tempo. Embed in any visualizer that needs tempo-aware behavior.

func (*BeatDetector) Reset added in v0.1.1

func (bd *BeatDetector) Reset()

Reset clears all beat state. Call on track change or Init.

func (*BeatDetector) Tick added in v0.1.1

func (bd *BeatDetector) Tick(bands *[audio.NumBands]float32, progressMs int32)

Tick decays the pulse and processes a new frame of frequency bands. Call once per frame with the full band data and playback progress.

type ImageAware

type ImageAware interface {
	SetImage(img image.Image)
}

type Lyrics

type Lyrics struct {
	// contains filtered or unexported fields
}

func NewLyrics

func NewLyrics() *Lyrics

func (*Lyrics) Advance

func (l *Lyrics) Advance()

func (*Lyrics) Init

func (l *Lyrics) Init(seed string, durationMs int)

func (*Lyrics) SetInstrumental

func (l *Lyrics) SetInstrumental()

func (*Lyrics) SetLyrics

func (l *Lyrics) SetLyrics(lines []string)

func (*Lyrics) SetProgress

func (l *Lyrics) SetProgress(progressMs int)

func (*Lyrics) View

func (l *Lyrics) View(width, height int) string

type LyricsAware

type LyricsAware interface {
	SetLyrics(lines []string)
	SetInstrumental()
}

LyricsAware is implemented by visualizers that display lyrics.

type MilkdropPreset

type MilkdropPreset struct {
	// contains filtered or unexported fields
}

MilkdropPreset is a Milkdrop-style visualizer driven by a pluggable warp function. Use the NewMilkdrop* constructors to create specific presets.

func NewMilkdropKaleidoscope

func NewMilkdropKaleidoscope() *MilkdropPreset

NewMilkdropKaleidoscope creates a Milkdrop preset that folds the framebuffer into mirror-symmetric sectors. Bass shifts the number of segments.

func NewMilkdropRipple

func NewMilkdropRipple() *MilkdropPreset

NewMilkdropRipple creates a Milkdrop preset that displaces pixels along radial sine waves, creating expanding concentric ripples.

func NewMilkdropSpiral

func NewMilkdropSpiral() *MilkdropPreset

NewMilkdropSpiral creates a Milkdrop preset that warps the framebuffer in a rotating spiral. Bass tightens the spiral; time adds a slow drift.

func NewMilkdropTunnel

func NewMilkdropTunnel() *MilkdropPreset

NewMilkdropTunnel creates a Milkdrop preset using inverse-radius mapping to produce an infinite tunnel rushing toward the viewer.

func (*MilkdropPreset) Advance

func (m *MilkdropPreset) Advance()

func (*MilkdropPreset) Init

func (m *MilkdropPreset) Init(seed string, durationMs int)

func (*MilkdropPreset) SetAudioData

func (m *MilkdropPreset) SetAudioData(data *audio.FrequencyData)

func (*MilkdropPreset) View

func (m *MilkdropPreset) View(w, h int) string

type Oscillogram

type Oscillogram struct {
	// contains filtered or unexported fields
}

func NewOscillogram

func NewOscillogram() *Oscillogram

func (*Oscillogram) Advance

func (o *Oscillogram) Advance()

func (*Oscillogram) Init

func (o *Oscillogram) Init(seed string, durationMs int)

func (*Oscillogram) SetAudioData

func (o *Oscillogram) SetAudioData(data *audio.FrequencyData)

func (*Oscillogram) View

func (o *Oscillogram) View(width, height int) string

type ProgressAware

type ProgressAware interface {
	SetProgress(progressMs int)
}

ProgressAware is implemented by visualizers that need real-time playback progress.

type Spectrum

type Spectrum struct {
	// contains filtered or unexported fields
}

Spectrum renders a classic spectrum analyzer with vertical bars and peak hold indicators.

func NewSpectrum

func NewSpectrum() *Spectrum

func (*Spectrum) Advance

func (s *Spectrum) Advance()

func (*Spectrum) Init

func (s *Spectrum) Init(seed string, durationMs int)

func (*Spectrum) SetAudioData

func (s *Spectrum) SetAudioData(data *audio.FrequencyData)

func (*Spectrum) View

func (s *Spectrum) View(width, height int) string

type Starfield

type Starfield struct {
	// contains filtered or unexported fields
}

func NewStarfield

func NewStarfield() *Starfield

func (*Starfield) Advance

func (sf *Starfield) Advance()

func (*Starfield) Init

func (sf *Starfield) Init(seed string, durationMs int)

func (*Starfield) SetAudioData

func (sf *Starfield) SetAudioData(data *audio.FrequencyData)

func (*Starfield) View

func (sf *Starfield) View(width, height int) string

type Visualizer

type Visualizer interface {
	Init(seed string, durationMs int)
	Advance()
	View(width, height int) string
}

Jump to

Keyboard shortcuts

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