segmenter

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SegmentFunc

type SegmentFunc func(time.Duration, []float32) error

SegmentFunc is a callback function which is called when a segment is ready to be processed. The first argument is the timestamp of the segment.

type Segmenter

type Segmenter struct {
	// contains filtered or unexported fields
}

func New

func New(r io.Reader, dur time.Duration, sample_rate int) (*Segmenter, error)

Create a new segmenter for "NumSamples" with a reader r If NumSamples is zero then no segmenting is performed

func (*Segmenter) Close

func (s *Segmenter) Close() error

Close the segmenter

func (*Segmenter) Decode

func (s *Segmenter) Decode(ctx context.Context, fn SegmentFunc) error

TODO: segments are output through a callback, with the samples and a timestamp TODO: we could do some basic silence and voice detection to segment to ensure we don't overtax the CPU/GPU with silence and non-speech

func (*Segmenter) Duration

func (s *Segmenter) Duration() time.Duration

Return the duration from the file or timestamp

Jump to

Keyboard shortcuts

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