Help us shape the future of Go! Take the 2026 Go Developer Survey

audio

package
v1.13.11 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAudioLevelConfig = AudioLevelConfig{
		ActiveLevel:     35,
		MinPercentile:   40,
		UpdateInterval:  400,
		SmoothIntervals: 2,
	}
)

Functions

func ConvertAudioLevel

func ConvertAudioLevel(level float64) float64

convert decibel back to linear

Types

type AudioLevel

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

keeps track of audio level for a participant

func NewAudioLevel

func NewAudioLevel(params AudioLevelParams) *AudioLevel

func (*AudioLevel) GetLevel

func (l *AudioLevel) GetLevel(now int64) (float64, bool)

returns current smoothed audio level

func (*AudioLevel) Observe

func (l *AudioLevel) Observe(level uint8, durationMs uint32, arrivalTime int64)

Observes a new frame

func (*AudioLevel) ObserveWithRTPTimestamp added in v1.9.10

func (l *AudioLevel) ObserveWithRTPTimestamp(level uint8, ts uint32, arrivalTime int64)

func (*AudioLevel) SetConfig added in v1.9.12

func (l *AudioLevel) SetConfig(config AudioLevelConfig)

type AudioLevelConfig added in v1.8.1

type AudioLevelConfig struct {
	// minimum level to be considered active, 0-127, where 0 is loudest
	ActiveLevel uint8 `yaml:"active_level,omitempty"`
	// percentile to measure, a participant is considered active if it has exceeded the ActiveLevel more than
	// MinPercentile% of the time
	MinPercentile uint8 `yaml:"min_percentile,omitempty"`
	// interval to update clients, in ms
	UpdateInterval uint32 `yaml:"update_interval,omitempty"`
	// smoothing for audioLevel values sent to the client.
	// audioLevel will be an average of `smooth_intervals`, 0 to disable
	SmoothIntervals uint32 `yaml:"smooth_intervals,omitempty"`
}

type AudioLevelParams

type AudioLevelParams struct {
	ClockRate uint32
}

Jump to

Keyboard shortcuts

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