microphone

package module
v0.0.0-...-7d6b70e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: MIT Imports: 5 Imported by: 1

README

Microphone PkgGoDev

Library that wraps the gen2brain/malgo library with a beep.StreamCloser for streaming microphone input. Inspired by MarkKremer/microphone

go get -u github.com/aleitner/microphone

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Streamer

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

Streamer is an implementation of the beep.StreamCloser interface to provide access to the microphone through the malgo library.

func OpenStream

func OpenStream(ctx *malgo.AllocatedContext, deviceConfig malgo.DeviceConfig) (s *Streamer, format beep.Format, err error)

OpenStream opens a stream for the deviceConfig

func (*Streamer) Close

func (s *Streamer) Close() error

Close the stream

func (*Streamer) Err

func (s *Streamer) Err() error

Err returns an error that occurred during streaming. If no error occurred, nil is returned.

func (*Streamer) Start

func (s *Streamer) Start()

Start reading data from the microphone

func (*Streamer) Stop

func (s *Streamer) Stop()

Stop reading data from the microphone. reading can be resumed using the Start method

func (*Streamer) Stream

func (s *Streamer) Stream(samples [][2]float64) (int, bool)

Stream fills samples with the audio recorded with the microphone. Unless there is an error, this method will wait until samples is filled completely which may involve waiting for the OS to supply the data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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