Documentation
¶
Overview ¶
Package audiomedia analyzes immutable local audio and owns cancellable playback. Callers retain ownership of the verified snapshot and must not modify it while an operation runs. The package never reopens its pathname or closes its file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Play ¶
Play starts local audio only when called explicitly. Native PCM/WAV offsets skip complete sample frames. Compressed offsets use output-side decoder seek. Every helper reads verified bytes through pipes; no path or URL reaches it.
func PlayWithProgress ¶ added in v1.40.3
func PlayWithProgress(ctx context.Context, file *os.File, format string, offset time.Duration, report func(time.Duration)) error
PlayWithProgress reports positions from FFplay's audio clock in the original recording. The player estimates device buffering; reports are not exact audible positions. No report arrives until the player supplies a usable clock. Reports run serially, must return promptly, and stop before this function returns. Callers must reject stale reports when replacing playback and handle no reports. A nil report preserves Play's behavior. The caller still owns the file.
func Waveform ¶
Waveform draws uncolored amplitudes on a fixed 0..1 scale. Multiple rows use symmetric Braille columns; a single row uses an eight-level block sparkline. Dimensions are bounded independently from accepted audio size. Zero samples produce a baseline; absent audio produces no invented waveform.
Types ¶
type Analysis ¶
type Analysis struct {
Format string `json:"format"`
Bytes int64 `json:"bytes"`
Duration float64 `json:"duration"`
Peaks []float64 `json:"peaks"`
}
func Analyze ¶
Analyze scans the supplied snapshot without changing its seek offset. A caller may use a context deadline to bound this optional work after preserving audio. Duration counts decoded frames. Each peak is the maximum absolute sample over all channels in its interval; opposite-phase stereo cannot cancel the waveform.
type UnavailableError ¶
UnavailableError identifies a missing optional helper without exposing paths.
func (*UnavailableError) Error ¶
func (e *UnavailableError) Error() string
func (*UnavailableError) Unwrap ¶
func (e *UnavailableError) Unwrap() error