toot

package module
v0.0.0-...-eb2f953 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 12 Imported by: 2

README

Some audio processing things. Built to be compatable with faiface's beep library.

Has the following:

  • microphone support using portaudio
  • analyzer for doing (very basic) frequency analysis
  • visualizer for making pretty things out of the analyzer

toot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer(stream beep.Streamer, sampleRate int, bufferSize int) *analyzer

Types

type InputDevice

type InputDevice struct {
	Name   string
	Stereo bool
}

func GetInputDevices

func GetInputDevices() ([]InputDevice, error)

type Microphone

type Microphone interface {
	beep.Streamer
	Start(ctx context.Context) error
	Close() error
	Format() beep.Format
	DeviceInfo() portaudio.DeviceInfo
	SetSampleRate(rate beep.SampleRate)
}

func NewDefaultMicrophone

func NewDefaultMicrophone() (Microphone, error)

func NewMicrophone

func NewMicrophone(name string) (Microphone, error)

type Spectra

type Spectra []SpectrumSample

func (Spectra) Frequencies

func (s Spectra) Frequencies() []float64

func (Spectra) Values

func (s Spectra) Values() []float64

type SpectrumSample

type SpectrumSample struct {
	Frequency float64
	Value     float64
}

type Visualizer

type Visualizer interface {
	Bin(s Spectra) []float64
}

Allows us to visualize audio power specra in bins.

func NewVisualizer

func NewVisualizer(lowerBound, upperBound float64, bins int) Visualizer

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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