Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Float32ToPCM ¶
Float32ToPCM converts a slice of float32 samples to PCM byte data (int16)
Types ¶
type AudioOptions ¶
type AudioOptions struct { SampleRate float64 Latency time.Duration FramesPerBuffer int Channels int BytesPerSample int BitsPerSample int }
func ComputeAudioOptions ¶
func ComputeAudioOptions(opts *AudioOptions) (*AudioOptions, error)
type AudioStream ¶
type AudioStream struct {
// contains filtered or unexported fields
}
func NewInputStream ¶
func NewInputStream( logger *slog.Logger, opts *AudioOptions, callback func([]float32), ) (*AudioStream, error)
func (*AudioStream) Close ¶
func (a *AudioStream) Close() error
func (*AudioStream) Start ¶
func (a *AudioStream) Start() error
func (*AudioStream) Stop ¶
func (a *AudioStream) Stop() error
type VAD ¶
type VAD struct {
// contains filtered or unexported fields
}
VAD represents the Voice Activity Detection module
type VADCallbacks ¶
type VADCallbacks struct { OnSpeechStart func() OnSpeechEnd func() OnPause func() OnFlush func([]float32) }
VADCallbacks defines the callbacks for VAD events
type VADConfig ¶
type VADConfig struct { EnergyThreshold float64 // Threshold for energy to detect speech FlushInterval time.Duration // Interval for periodic buffer flushing SilenceDuration time.Duration // Duration of continuous silence to detect end of speech PauseDuration time.Duration // Duration of brief silence to detect a pause within speech }
VADConfig defines configuration options for the VAD
Click to show internal directories.
Click to hide internal directories.