Documentation
¶
Overview ¶
Package eq holds the graphic equalizer's curves and settings, its presets, and the AutoEQ headphone profiles.
Index ¶
- Constants
- func BandCount(typ string) int
- func BuildEqualizerFilter(preamp float64, gains []float64, typ string) string
- func Frequencies(typ string) []float64
- func Interpolate(gains []float64, from, to string) []float64
- func Labels(typ string) []string
- func TypeOf(typ string) string
- func Width(typ string) float64
- type AutoEQ
- type Meta
- type Preset
- type PresetStore
- type Profile
- type Settings
Constants ¶
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 BuildEqualizerFilter ¶
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 ¶
Frequencies returns the center frequencies of typ, in Hz.
func Interpolate ¶
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.
Types ¶
type AutoEQ ¶
type AutoEQ struct {
// contains filtered or unexported fields
}
AutoEQ fetches and caches AutoEQ's headphone index and profiles.
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.
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 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.