speaker

package
v1.6.0-dev.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Implementation of a speaker using portaudio

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize()

Initialize inits the library. This handles OS level init of the library.

func Teardown

func Teardown()

Teardown cleans up the library. This handles OS level cleanup.

Types

type AudioConfig

type AudioConfig struct {
	OutputChannels int
	SamplingRate   float32
}

AudioConfig init config for library

type Speaker

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

Microphone is a representation of a microphone

func New

func New(cfg AudioConfig) (*Speaker, error)

New creates a new speaker using portaudio

func (*Speaker) Mute

func (s *Speaker) Mute()

Mute silences the mic

func (*Speaker) Start

func (s *Speaker) Start() error

Start begins the listening on the microphone

func (*Speaker) Stop

func (s *Speaker) Stop() error

Stop terminates listening on the mic

func (*Speaker) Stream

func (s *Speaker) Stream(r io.Reader) error

Stream is a helper function to stream audio data to the speaker

func (*Speaker) Unmute

func (s *Speaker) Unmute()

Unmute restores recording on the mic

func (*Speaker) Write

func (s *Speaker) Write(p []byte) (n int, err error)

Write sends audio data to the speaker

Directories

Path Synopsis
Microphone defines a interface for a Microphone implementation
Microphone defines a interface for a Microphone implementation

Jump to

Keyboard shortcuts

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