Documentation ¶
Index ¶
Constants ¶
const ( // DefaultAudioLenMs is the number of milliseconds of audio we send for connection checks DefaultAudioLenMs = 6000 // DefaultChunkMs is the default value for how often audio is sent to the cloud DefaultChunkMs = 120 // SampleRate defines how many samples per second should be sent SampleRate = 16000 // SampleBits defines how many bits each sample should contain SampleBits = 16 // DefaultTimeout is the length of time before the process will cancel a voice request DefaultTimeout = 9 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NewMemPipe ¶
NewMemPipe returns a connected pair of a MsgIO and a Receiver that directly transmit data over channels; the Receiver should be passed in to the cloud process to get data from the MsgIO
Types ¶
type ChanMsgSender ¶
type Handler ¶
type Handler = pb.IntentService
Handler aliases the IntentService field from our protobuf that determines which backend service (Google, MS, etc) should handle this request
const ( // HandlerDefault represents the default backend service chosen by chipper HandlerDefault Handler = pb.IntentService_DEFAULT // HandlerGoogle will have Google's DialogFlow service handle requests HandlerGoogle Handler = pb.IntentService_DIALOGFLOW // HandlerMicrosoft will have Microsoft's Bing/LUIS speech service handle requests HandlerMicrosoft Handler = pb.IntentService_BING_LUIS // HandlerAmazon will have Amazon's Lex service handle requests HandlerAmazon Handler = pb.IntentService_LEX )
type IPCMsgSender ¶
type MsgIO ¶
MsgIO defines the API for sending audio data from an external source into the cloud process (and potentially receiving info back)
type Option ¶
type Option func(o *options)
Option defines an option that can be set on the cloud process
func WithChunkMs ¶
WithChunkMs determines how often the cloud process will stream data to the cloud
func WithCompression ¶
WithCompression sets whether compression will be performed on audio before uploading (and returns the same Options struct to allow method chaining)
func WithErrorListener ¶
func WithErrorListener(value util.ErrorListener) Option
WithErrorListener specifies that the given ErrorListener should be passed errors that result from voice requests
func WithHandler ¶
WithHandler sets the intent service (MS, Google, etc) that should handle this request on the server, if one is desired
func WithRequireToken ¶
func WithRequireToken() Option
WithRequireToken specifies that a failure to obtain an access token from the TMS should be treated as a fatal error for requests (temporary - eventually TMS tokens will be required)
func WithSaveAudio ¶
WithSaveAudio sets whether the chipper server should save the audio we send to it
func WithTokener ¶
WithTokener sets the accessor that should be used to obtain tokens
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process contains the data associated with an instance of the cloud process, and can have receivers and callbacks associated with it before ultimately being started with Run()
func (*Process) AddIntentWriter ¶
AddIntentWriter adds the given Writer to the list of writers that will receive intents from the cloud
func (*Process) AddReceiver ¶
AddReceiver adds the given Receiver to the list of sources the cloud process will listen to for data
func (*Process) AddTestReceiver ¶
AddTestReceiver adds the given Receiver to the list of sources the cloud process will listen to for data. Additionally, it will be marked as a test receiver, which means that data sent on this receiver will send a message to the mic requesting it notify the AI of a hotword event on our behalf.
func (*Process) ChunkSamples ¶
ChunkSamples is the number of samples that should be in each chunk
func (*Process) Run ¶
Run starts the cloud process, which will run until stopped on the given channel
func (*Process) StreamSize ¶
StreamSize is the size in bytes of each chunk
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is an object that should be passed in to the cloud process and determines how it will receive audio data from external sources
func NewIpcReceiver ¶
NewIpcReceiver constructs a Receiver that receives audio data and hotword signals over the given IPC connection