catnip

package module
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 9 Imported by: 0

README

catnip

love made-with-go betamax-was-a-thing

terminal audio visualizer for linux/unix/macOS/windows*

^ click for a fun video

A visualization of catnip over time

it supports audio backends

  • ALSA (linux FFmpeg)
  • AVFoundation (macOS FFmpeg)
  • DirectShow (windblows FFmpeg)
  • Pipewire (pw-cat)
  • PortAudio (linux/macOS/windblows (maybe))
  • PulseAudio (parec/FFmpeg)

it depends on

  • go modules

    • github.com/nsf/termbox-go
    • github.com/integrii/flaggy
    • github.com/pkg/errors
    • github.com/noisetorch/pulseaudio
    • gonum.org/v1/gonum
  • binaries

    • ffmpeg (required for FFmpeg backends)
    • parec (required for PulseAudio backend with parec)
    • pw-cat, pw-link (required for Pipewire backend)
  • c libraries (optional, requires CGO - CGO_ENABLED=1)

    • fftw (fftw3) (enable with -tags fftw)
    • portaudio (portaudio-2.0) (enable with -tags portaudio)

get it

# get source
git clone https://github.com/noriah/catnip.git

# cd to dir
cd catnip

# build and install catnip
go install ./cmd/catnip

# with portaudio
go install ./cmd/catnip -tags portaudio

# with fftw3
go install ./cmd/catnip -tags fftw

# with both portaudio and fftw3
go install ./cmd/catnip -tags portaudio,fftw

run it

  • use catnip list-backends to show available backends
  • use catnip -b {backend} list-devices to show available devices
  • use catnip -b {backend} -d {device} to run - use the full device name
  • use catnip -h for information on several more customizations

question it

catnip?

long story, short explanation

update

Documentation

Index

Constants

View Source
const MaxChannelCount = 2
View Source
const MaxSampleSize = 2048

Variables

This section is empty.

Functions

func Run added in v1.7.0

func Run(cfg *Config, ctx context.Context) error

Types

type CleanupFunc added in v1.7.0

type CleanupFunc func() error

type Config

type Config struct {
	// The name of the backend from the input package
	Backend string
	// The name of the device to pull data from
	Device string
	// The rate that samples are read
	SampleRate float64
	// The number of samples per batch
	SampleSize int
	// The number of channels to read data from
	ChannelCount int
	// The number of times per second to process data
	ProcessRate int
	// Merge multiple channels into a single stream
	Combine bool

	// testing. leave false
	// Use threaded processor
	UseThreaded bool

	// Function to call when setting up the pipeline
	SetupFunc SetupFunc
	// Function to call when starting the pipeline
	StartFunc StartFunc
	// Function to call when cleaning up the pipeline
	CleanupFunc CleanupFunc
	// Where to send the data from the audio analysis
	Output processor.Output
	// Method to run on data before running fft
	Windower window.Function
	// Analyzer to run analysis on data
	Analyzer dsp.Analyzer
	// Smoother to run smoothing on output from Analyzer
	Smoother dsp.Smoother
}

func NewZeroConfig

func NewZeroConfig() Config

func (*Config) Validate added in v1.7.0

func (cfg *Config) Validate() error

type SetupFunc added in v1.7.0

type SetupFunc func() error

type StartFunc added in v1.7.0

type StartFunc func(ctx context.Context) (context.Context, error)

Directories

Path Synopsis
cmd
dsp
Package dsp provides audio analysis
Package dsp provides audio analysis
window
Package window provides Window Functions for singnal analysis
Package window provides Window Functions for singnal analysis
Package fft provides generic abstractions around fourier transformers.
Package fft provides generic abstractions around fourier transformers.
all
Package all imports all backends implemented by the input package.
Package all imports all backends implemented by the input package.
common/execread
Package execread provides a shared struct that wraps around cmd.
Package execread provides a shared struct that wraps around cmd.
portaudio/portaudio
Package portaudio contains modifications of CGO bindings for portaudio
Package portaudio contains modifications of CGO bindings for portaudio

Jump to

Keyboard shortcuts

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