package audio import "context" // EnhancementRequest asks a speech-enhancement backend (DeepFilterNet style) // to denoise a recording. Audio is carried as bytes (never a URL), mirroring // TranscriptionRequest (ADR-0024). type EnhancementRequest struct { // Audio is the encoded audio to enhance. Audio []byte // MIME is the audio MIME type (e.g. "audio/mpeg"); "" = let the backend // sniff it. MIME string // Filename is the multipart filename hint some backends key their format // detection on; "" derives one from MIME or falls back to "audio". Filename string } // EnhancementOption mutates an EnhancementRequest before it is sent. // Reserved for future request settings (the reference backend takes no // parameters). type EnhancementOption func(*EnhancementRequest) // Apply returns a copy of the request with all options applied. func (r EnhancementRequest) Apply(opts ...EnhancementOption) EnhancementRequest { for _, opt := range opts { opt(&r) } return r } // SpeechEnhancer denoises speech recordings. The result reuses SpeechResult // (audio bytes + MIME + Raw) — enhancement is audio-in/audio-out exactly // like synthesis. type SpeechEnhancer interface { // Enhance returns the denoised audio. Enhance(ctx context.Context, req EnhancementRequest, opts ...EnhancementOption) (*SpeechResult, error) } // SpeechEnhancerModelOption configures a SpeechEnhancer at construction time. // Reserved for future per-model settings. type SpeechEnhancerModelOption func(*SpeechEnhancerModelConfig) // SpeechEnhancerModelConfig carries per-model construction settings. type SpeechEnhancerModelConfig struct{} // ApplySpeechEnhancerModelOptions folds options into a config. func ApplySpeechEnhancerModelOptions(opts []SpeechEnhancerModelOption) SpeechEnhancerModelConfig { var cfg SpeechEnhancerModelConfig for _, opt := range opts { opt(&cfg) } return cfg } // SpeechEnhancementProvider mints SpeechEnhancers bound to one backend. type SpeechEnhancementProvider interface { // Name is the registry identifier for the provider. Name() string // SpeechEnhancerModel returns a SpeechEnhancer bound to the given id // (passed through to the backend verbatim; no catalog validation). SpeechEnhancerModel(id string, opts ...SpeechEnhancerModelOption) (SpeechEnhancer, error) }