config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCompressorConfig = CompressorConfig{ThresholdDBFS: -18, Ratio: 4, AttackMs: 10, ReleaseMs: 100, KneeDB: 6}
View Source
var DefaultConvolutionConfig = ConvolutionConfig{WetDryMix: 1, Normalize: true}
View Source
var DefaultDCOffsetConfig = DCOffsetConfig{Pole: 0.995}
View Source
var DefaultDelayConfig = DelayConfig{DelayMs: 300, Feedback: 0.3, WetLevel: 0.5, DryLevel: 1}
View Source
var DefaultEqualizerConfig = EqualizerConfig{
	EqualizerMode: EqualizerModeSingle,
	Type:          EqualizerTypePeaking,
	FrequencyHz:   1000,
	Q:             0.7071067811865476,
	Bands:         10,
	LowHz:         20,
	HighHz:        20000,
	Gains:         "0,0,0,0,0,0,0,0,0,0",
}
View Source
var DefaultFadeConfig = FadeConfig{MemoryLimitBytes: defaultMemoryLimitBytes}
View Source
var DefaultFormatConfig = FormatConfig{}
View Source
var DefaultGainConfig = GainConfig{}
View Source
var DefaultGateConfig = GateConfig{ThresholdDBFS: -60, GateMode: GateModeHard, RangeDB: 40, AttackMs: 5, ReleaseMs: 50, OpenFrequencyHz: 20000, CloseFrequencyHz: 200}
View Source
var DefaultMixerConfig = MixerConfig{}
View Source
var DefaultMixerParameters = MixerParameters{Inputs: 1, Outputs: 1}
View Source
var DefaultNormalizeConfig = NormalizeConfig{
	TargetPeakDBFS:     -1,
	AllowAmplification: true,
	MemoryLimitBytes:   defaultMemoryLimitBytes,
}
View Source
var DefaultRemixConfig = RemixConfig{
	CenterMixDB:   -3.010299956639812,
	SurroundMixDB: -3.010299956639812,
	LFEMixDB:      math.Inf(-1),
	Normalize:     true,
}
View Source
var DefaultResampleConfig = ResampleConfig{}
View Source
var DefaultReverbConfig = ReverbConfig{RoomSize: 0.5, Damping: 0.5, WetLevel: 0.3, DryLevel: 1}
View Source
var DefaultSpeedConfig = SpeedConfig{Factor: 1, Mode: SpeedModeInterpolate}
View Source
var DefaultTrimConfig = TrimConfig{ThresholdDBFS: -60, TrimMode: TrimModeBoth, MemoryLimitBytes: defaultMemoryLimitBytes}

Functions

func ParseBandList

func ParseBandList(raw string) ([]float64, error)

Types

type CompressorConfig

type CompressorConfig struct {
	ThresholdDBFS float64 `name:"threshold-dbfs" check:"finite" help:"Level above which compression begins"`
	Ratio         float64 `name:"ratio" check:"finite" help:"Compression ratio applied above the threshold (e.g. 4 for 4:1)"`
	AttackMs      float64 `name:"attack-ms" check:"nonnegative,finite" help:"Time to react to level increases, in milliseconds"`
	ReleaseMs     float64 `name:"release-ms" check:"nonnegative,finite" help:"Time to recover after level drops, in milliseconds"`
	KneeDB        float64 `name:"knee-db" check:"nonnegative,finite" help:"Soft-knee width in dB around the threshold (0 for a hard knee)"`
	MakeupGainDB  float64 `name:"makeup-gain-db" check:"finite" help:"Gain applied after compression to restore level"`
}

func (CompressorConfig) Validate

func (c CompressorConfig) Validate() error

type ConvolutionConfig

type ConvolutionConfig struct {
	ImpulseResponse [][]float32
	ImpulseRate     int

	WetDryMix float64 `name:"wet-dry-mix" check:"nonnegative,finite" help:"Dry/wet balance: 0 = unprocessed input, 1 = fully convolved"`
	Normalize bool    `name:"normalize" help:"Scale the impulse response down if its gain could exceed unity, to avoid clipping"`
	BlockSize int     `name:"block-size" check:"nonnegative" help:"FFT hop size in samples, rounded up to a power of two; 0 selects a default"`
}

ConvolutionConfig configures a uniform partitioned FFT convolution filter. ImpulseResponse and ImpulseRate carry raw sample data rather than CLI-representable primitives, so they intentionally have no `name` tag: they are set only through the Go API (filter.WithImpulseResponse / filter.WithImpulseRate), never from a CLI flag string.

A single impulse response channel applies to every input channel (mono-apply broadcast); an impulse response with one channel per input channel convolves each input channel with its matching channel independently. Cross-channel ("true stereo") convolution is out of scope.

func (ConvolutionConfig) Validate

func (c ConvolutionConfig) Validate() error

type DCOffsetConfig

type DCOffsetConfig struct {
	Pole float64 `name:"pole" help:"DC offset filter pole"`
}

func (DCOffsetConfig) Validate

func (c DCOffsetConfig) Validate() error

type DelayConfig

type DelayConfig struct {
	DelayMs  float64 `name:"delay-ms" check:"positive,finite" help:"Delay time in milliseconds"`
	Feedback float64 `` /* 144-byte string literal not displayed */
	WetLevel float64 `name:"wet-level" check:"nonnegative,finite" help:"Delayed signal level"`
	DryLevel float64 `name:"dry-level" check:"nonnegative,finite" help:"Unprocessed signal level"`
}

func (DelayConfig) Validate

func (c DelayConfig) Validate() error

type EqualizerConfig

type EqualizerConfig struct {
	EqualizerMode EqualizerMode `name:"mode" help:"single (one parametric/shelf/pass band) or multiband (cascaded peaking bands across a frequency range)"`

	Type        EqualizerType `name:"type" depends-on:"mode=single" help:"Filter shape: peaking, lowshelf, highshelf, lowpass, or highpass"`
	FrequencyHz float64       `` /* 147-byte string literal not displayed */
	GainDB      float64       `` /* 127-byte string literal not displayed */
	Q           float64       `` /* 126-byte string literal not displayed */

	Bands       int     `` /* 163-byte string literal not displayed */
	LowHz       float64 `name:"low-hz" depends-on:"mode=multiband" check:"positive,finite" help:"Lower bound for automatic band split"`
	HighHz      float64 `name:"high-hz" depends-on:"mode=multiband" check:"positive,finite" help:"Upper bound for automatic band split"`
	ManualBands string  `` /* 141-byte string literal not displayed */
	Gains       string  `` /* 126-byte string literal not displayed */
}

func (EqualizerConfig) Validate

func (c EqualizerConfig) Validate() error

type EqualizerMode

type EqualizerMode string
const (
	EqualizerModeSingle    EqualizerMode = "single"
	EqualizerModeMultiband EqualizerMode = "multiband"
)

func (EqualizerMode) Valid

func (v EqualizerMode) Valid() bool

type EqualizerType

type EqualizerType string
const (
	EqualizerTypePeaking   EqualizerType = "peaking"
	EqualizerTypeLowShelf  EqualizerType = "lowshelf"
	EqualizerTypeHighShelf EqualizerType = "highshelf"
	EqualizerTypeLowPass   EqualizerType = "lowpass"
	EqualizerTypeHighPass  EqualizerType = "highpass"
)

func (EqualizerType) Valid

func (v EqualizerType) Valid() bool

type FadeConfig

type FadeConfig struct {
	FadeIn           time.Duration `name:"fade-in" check:"nonnegative" help:"Fade-in duration"`
	FadeOut          time.Duration `name:"fade-out" check:"nonnegative" help:"Fade-out duration"`
	MemoryLimitBytes int64         `name:"memory-limit-bytes" help:"Maximum buffered memory"`
	TempDir          string        `name:"temp-dir" help:"Temporary directory"`
}

func (FadeConfig) Validate

func (c FadeConfig) Validate() error

type FormatConfig

type FormatConfig struct {
	Format        media.SampleFormat `name:"format" help:"Target sample format"`
	BitsPerSample int                `name:"bits-per-sample" check:"nonnegative" help:"Target effective bit depth"`
}

func (FormatConfig) EffectiveBitsPerSample

func (c FormatConfig) EffectiveBitsPerSample() int

func (FormatConfig) Validate

func (c FormatConfig) Validate() error

type GainConfig

type GainConfig struct {
	Decibels float64 `name:"decibels" check:"finite" help:"Gain in dB"`
}

func (GainConfig) Validate

func (c GainConfig) Validate() error

type GateConfig

type GateConfig struct {
	ThresholdDBFS    float64  `name:"threshold-dbfs" check:"finite" help:"Level below which the gate begins to close"`
	GateMode         GateMode `` /* 171-byte string literal not displayed */
	RangeDB          float64  `` /* 151-byte string literal not displayed */
	AttackMs         float64  `` /* 139-byte string literal not displayed */
	ReleaseMs        float64  `` /* 141-byte string literal not displayed */
	OpenFrequencyHz  float64  `` /* 145-byte string literal not displayed */
	CloseFrequencyHz float64  `` /* 148-byte string literal not displayed */
}

func (GateConfig) Validate

func (c GateConfig) Validate() error

type GateMode

type GateMode string
const (
	// GateModeHard instantly silences every sample below the threshold.
	GateModeHard GateMode = "hard"
	// GateModeLowpass is a Buchla-style low-pass gate: as the level falls
	// below the threshold, a one-pole low-pass filter and the output level
	// close together (envelope-controlled), so the sound darkens and fades
	// out smoothly instead of being cut off abruptly.
	GateModeLowpass GateMode = "lowpass"
)

func (GateMode) Valid

func (v GateMode) Valid() bool

type MixerConfig

type MixerConfig struct{}

MixerConfig has no per-instance settings yet: the CLI-registered mixer always mixes every input with equal weight (see register_mixer.go), so there is nothing left to configure once MixerParameters has fixed the port topology. Custom per-input weighting stays a Go-API-only concern (mixer.New), reached by constructing a node.Filter directly instead of through this registration.

func (MixerConfig) Validate

func (MixerConfig) Validate() error

type MixerParameters

type MixerParameters struct {
	Inputs  int `name:"in" check:"positive" help:"Number of input ports"`
	Outputs int `name:"out" check:"positive" help:"Number of output ports"`
}

MixerParameters chooses a mixer's port topology: Inputs input ports ("in0".."in{Inputs-1}") and Outputs output ports ("out0".."out{Outputs-1}"). It is resolved once per invocation, before MixerConfig is even decoded, since a mixer's actual port set  Eand therefore what InputRequirements its manifest declares  Edepends on these values. See registry.ParameterizedFilterManifest.

func (MixerParameters) Validate

func (p MixerParameters) Validate() error

type NormalizeConfig

type NormalizeConfig struct {
	TargetPeakDBFS     float64 `name:"target-peak-dbfs" check:"finite" help:"Target peak level"`
	AllowAmplification bool    `name:"allow-amplification" help:"Allow gain above unity"`
	MemoryLimitBytes   int64   `name:"memory-limit-bytes" help:"Maximum buffered memory"`
	TempDir            string  `name:"temp-dir" help:"Temporary directory"`
}

func (NormalizeConfig) Validate

func (c NormalizeConfig) Validate() error

type RemixConfig

type RemixConfig struct {
	Layout        media.ChannelLayout `name:"layout" help:"Target channel layout"`
	CenterMixDB   float64             `name:"center-mix-db" check:"finite" help:"Center channel mix level"`
	SurroundMixDB float64             `name:"surround-mix-db" check:"finite" help:"Surround channel mix level"`
	LFEMixDB      float64             `name:"lfe-mix-db" help:"LFE channel mix level"`
	Normalize     bool                `name:"normalize" help:"Normalize remix levels"`
}

func (RemixConfig) Validate

func (c RemixConfig) Validate() error

type ResampleConfig

type ResampleConfig struct {
	SampleRate int `name:"sample-rate" check:"positive" help:"Target sample rate"`
}

func (ResampleConfig) Validate

func (c ResampleConfig) Validate() error

type ReverbConfig

type ReverbConfig struct {
	RoomSize float64 `name:"room-size" check:"nonnegative,finite" help:"Room size / decay time (0-1)"`
	Damping  float64 `name:"damping" check:"nonnegative,finite" help:"High-frequency damping applied to the reverb tail (0-1)"`
	WetLevel float64 `name:"wet-level" check:"nonnegative,finite" help:"Reverberated signal level"`
	DryLevel float64 `name:"dry-level" check:"nonnegative,finite" help:"Unprocessed signal level"`
}

func (ReverbConfig) Validate

func (c ReverbConfig) Validate() error

type SpeedConfig

type SpeedConfig struct {
	Factor float64   `` /* 138-byte string literal not displayed */
	Mode   SpeedMode `` /* 150-byte string literal not displayed */
}

func (SpeedConfig) Validate

func (c SpeedConfig) Validate() error

type SpeedMode

type SpeedMode string
const (
	SpeedModeInterpolate SpeedMode = "interpolate"
	SpeedModeRelabel     SpeedMode = "relabel"
)

func (SpeedMode) Valid

func (v SpeedMode) Valid() bool

type TrimConfig

type TrimConfig struct {
	ThresholdDBFS      float64  `name:"threshold-dbfs" check:"finite" help:"Silence threshold"`
	TrimMode           TrimMode `name:"mode" help:"Which end to trim: both, start, or end"`
	ApproximateSilence bool     `` /* 234-byte string literal not displayed */
	MemoryLimitBytes   int64    `name:"memory-limit-bytes" help:"Maximum buffered memory"`
	TempDir            string   `name:"temp-dir" help:"Temporary directory"`
}

func (TrimConfig) Validate

func (c TrimConfig) Validate() error

type TrimMode

type TrimMode string
const (
	TrimModeBoth  TrimMode = "both"
	TrimModeStart TrimMode = "start"
	TrimModeEnd   TrimMode = "end"
)

func (TrimMode) Valid

func (v TrimMode) Valid() bool

Jump to

Keyboard shortcuts

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