Documentation
¶
Overview ¶
Package audio provides audio analysis utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSegment ¶
ExtractSegment extracts a segment from samples.
Types ¶
type AnalyzeConfig ¶
type AnalyzeConfig struct {
// TargetDuration is the desired segment length in seconds
TargetDuration float64
// StepSize is the sliding window step in seconds
StepSize float64
// FrameSize is the analysis frame size in seconds
FrameSize float64
// SilenceThreshold is the RMS threshold for silence detection (0-1)
SilenceThreshold float64
// TopN returns the top N segments
TopN int
}
AnalyzeConfig configures the segment analysis.
func DefaultAnalyzeConfig ¶
func DefaultAnalyzeConfig() AnalyzeConfig
DefaultAnalyzeConfig returns sensible defaults.
type SegmentMetrics ¶
type SegmentMetrics struct {
// MeanEnergy is the average RMS energy (higher = louder speech)
MeanEnergy float64
// EnergyVariance measures consistency (lower = more consistent)
EnergyVariance float64
// SpeechRatio is the fraction of frames with speech activity
SpeechRatio float64
// SilenceGaps is the number of silence gaps > 0.5s
SilenceGaps int
// MaxSilenceGap is the longest silence gap in seconds
MaxSilenceGap float64
// PeakClipping is the fraction of samples near clipping
PeakClipping float64
}
SegmentMetrics contains quality metrics for a segment.
type SegmentScore ¶
type SegmentScore struct {
StartSample int
EndSample int
StartTime float64
EndTime float64
Score float64
Metrics SegmentMetrics
}
SegmentScore represents a scored segment of audio.
func FindBestSegments ¶
func FindBestSegments(samples []float64, sampleRate uint32, config AnalyzeConfig) ([]SegmentScore, error)
FindBestSegments analyzes audio and returns the best segments for voice cloning.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package codec provides audio codec implementations for telephony.
|
Package codec provides audio codec implementations for telephony. |
|
Package converter provides audio format conversion for voice gateways.
|
Package converter provides audio format conversion for voice gateways. |
|
Package format defines audio format types for voice processing.
|
Package format defines audio format types for voice processing. |
Click to show internal directories.
Click to hide internal directories.