Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
Option is the type for a function option
func Callback ¶
Callback is a functional option to set the callback which will be executed whenever new data has been read from the audio device (e.g. microphone).
func Channels ¶
Channels is a functional option to set the amount of channels to be used with the audio device. Typically this is either Mono (1) or Stereo (2). Make sure that your audio device supports the specified amount of channels.
func DeviceName ¶
DeviceName is a functional option to specify the name of the Audio device
func FramesPerBuffer ¶
FramesPerBuffer is a functional option which sets the amount of sample frames our audio device will request / provide when executing the callback. Example: A buffer with 960 frames at 48000kHz / stereo contains 1920 samples and results in 20ms Audio.
func Samplerate ¶
Samplerate is a functional option to set the sampling rate of the audio device. Make sure your audio device supports the specified sampling rate.
type Options ¶
type Options struct { HostAPI string DeviceName string Channels int Samplerate float64 FramesPerBuffer int Latency time.Duration Callback audio.OnDataCb }
Options contains the parameters for initializing a soundcard reader.
type ScReader ¶
ScReader implements the audio.Source interface and is used to read (record) audio from a local sound card (e.g. microphone).
func NewScReader ¶
NewScReader returns a soundcard reader which steams audio asynchronously from an a local audio device (e.g. a microphone).