eq

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 20 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eq holds the graphic equalizer's curves and settings, its presets, and the AutoEQ headphone profiles.

Index

Constants

View Source
const (
	TypeISO10 = "ISO10Band"
	TypeISO15 = "ISO15Band"
)

The equalizer's two curves: 10 bands an octave apart, and 15 bands two thirds of an octave apart, as Supersonic's ISO10Band and ISO15Band.

Variables

This section is empty.

Functions

func BandCount

func BandCount(typ string) int

BandCount returns how many bands typ has.

func BuildEqualizerFilter

func BuildEqualizerFilter(preamp float64, gains []float64, typ string) string

BuildEqualizerFilter returns the MPV audio filter for the curve: the preamp and the bands whose gain is not zero, as Supersonic builds it.

func Frequencies

func Frequencies(typ string) []float64

Frequencies returns the center frequencies of typ, in Hz.

func Interpolate

func Interpolate(gains []float64, from, to string) []float64

Interpolate converts a curve between the two band layouts, by linear interpolation in dB over log frequency, as Supersonic does. Inputs of the wrong length come back as a flat curve of the target type.

func Labels

func Labels(typ string) []string

Labels returns the band labels of typ, for the interface.

func TypeOf

func TypeOf(typ string) string

TypeOf returns typ if it is a known curve, and ISO15Band otherwise.

func Width

func Width(typ string) float64

Width returns the width of each band of typ, in octaves.

Types

type AutoEQ

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

AutoEQ fetches and caches AutoEQ's headphone index and profiles.

func NewAutoEQ

func NewAutoEQ(dir string, timeout time.Duration) *AutoEQ

func (*AutoEQ) Index

func (a *AutoEQ) Index(ctx context.Context) ([]Meta, error)

Index returns AutoEQ's headphone profiles, from memory, disk, or the network, in that order.

func (*AutoEQ) Profile

func (a *AutoEQ) Profile(ctx context.Context, m Meta) (*Profile, error)

Profile fetches a profile from memory, disk, or the network.

type Meta

type Meta struct {
	Name   string `json:"name"`
	Path   string `json:"path"`
	Source string `json:"source"`
	Type   string `json:"type"`
}

Meta is a headphone profile in AutoEQ's index.

type Preset

type Preset struct {
	Name    string    `json:"name"`
	Type    string    `json:"type"`
	Preamp  float64   `json:"preamp"`
	Bands   []float64 `json:"bands"`
	Builtin bool      `json:"-"`
	// Label is what the interface shows, in Chinese for the built-ins.
	Label string `json:"-"`
}

Preset is a named equalizer curve, built in or saved by the listener.

func Builtin

func Builtin(name string) (Preset, bool)

Builtin finds a built-in preset by name.

func Builtins

func Builtins() []Preset

Builtins returns the presets the app ships with, in the order the interface lists them.

type PresetStore

type PresetStore struct {
	Dir string
}

PresetStore keeps the listener's own presets as JSON files in Dir.

func NewPresetStore

func NewPresetStore(dir string) *PresetStore

func (*PresetStore) Delete

func (s *PresetStore) Delete(name string) error

Delete removes a preset of the listener's own.

func (*PresetStore) List

func (s *PresetStore) List() []Preset

List returns the built-in presets and then the listener's own.

func (*PresetStore) Save

func (s *PresetStore) Save(p Preset) error

Save writes a preset of the listener's own. It may not replace a built-in.

type Profile

type Profile struct {
	Meta
	Preamp float64   `json:"preamp"`
	Bands  []float64 `json:"bands"`
}

Profile is an AutoEQ FixedBandEQ curve: 10 bands and its preamp.

type Settings

type Settings struct {
	Enabled bool      `json:"enabled"`
	Type    string    `json:"type"`
	Preamp  float64   `json:"preamp"`
	Bands   []float64 `json:"bands"`
	// Preset is the built-in preset's name, or a user preset's, or empty
	// for a curve of the listener's own.
	Preset string `json:"preset,omitempty"`
	// AutoEQPath and AutoEQName remember the headphone profile applied,
	// if any.
	AutoEQPath string `json:"autoEQPath,omitempty"`
	AutoEQName string `json:"autoEQName,omitempty"`
}

Settings is the equalizer's part of settings.json. Older versions kept their equalizer under other keys, which are ignored: the equalizer starts again from Default.

func Default

func Default() Settings

Default returns the equalizer as it starts: off, flat, ISO 15 bands.

func (*Settings) Normalize

func (s *Settings) Normalize()

Normalize resets a curve that is incomplete or of an unknown type, as an older settings file's might be.

Jump to

Keyboard shortcuts

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