PebbleOS
Loading...
Searching...
No Matches
Functions
Speex encoder

Speex wideband (16 kHz) encoder used to stream dictation audio. More...

Functions

bool voice_speex_init (void)
 Initialize the encoder and allocate its buffers.
 
void voice_speex_deinit (void)
 Release the encoder and its buffers.
 
void voice_speex_get_transfer_info (AudioTransferInfoSpeex *info)
 Get the transfer info sent to the phone before the encoded audio.
 
int voice_speex_get_frame_size (void)
 Get the frame size.
 
int16_t * voice_speex_get_frame_buffer (void)
 Get the buffer the microphone fills with one frame.
 
size_t voice_speex_get_frame_buffer_size (void)
 Get the frame buffer size.
 
int voice_speex_encode_frame (int16_t *samples, uint8_t *encoded_data, size_t max_encoded_size)
 Encode one frame.
 
bool voice_speex_is_initialized (void)
 Check whether the encoder is initialized.
 

Detailed Description

Speex wideband (16 kHz) encoder used to stream dictation audio.

The encoder owns the microphone frame buffer. Samples are boosted by a fixed gain before encoding; stereo input is downmixed to mono with Speex stereo side information.

Function Documentation

◆ voice_speex_deinit()

void voice_speex_deinit ( void  )

Release the encoder and its buffers.

◆ voice_speex_encode_frame()

int voice_speex_encode_frame ( int16_t *  samples,
uint8_t *  encoded_data,
size_t  max_encoded_size 
)

Encode one frame.

Parameters
[in,out]samplesvoice_speex_get_frame_size() samples, modified in place (gain and downmix).
[out]encoded_dataEncoded output.
max_encoded_sizeSize of encoded_data in bytes.
Returns
Number of encoded bytes, or -1 on error.

◆ voice_speex_get_frame_buffer()

int16_t * voice_speex_get_frame_buffer ( void  )

Get the buffer the microphone fills with one frame.

Returns
Frame buffer, or NULL if not initialized.

◆ voice_speex_get_frame_buffer_size()

size_t voice_speex_get_frame_buffer_size ( void  )

Get the frame buffer size.

Returns
Frame buffer size in bytes, or 0 if not initialized.

◆ voice_speex_get_frame_size()

int voice_speex_get_frame_size ( void  )

Get the frame size.

Returns
Samples per frame across all channels, or 0 if not initialized.

◆ voice_speex_get_transfer_info()

void voice_speex_get_transfer_info ( AudioTransferInfoSpeex *  info)

Get the transfer info sent to the phone before the encoded audio.

The encoder must be initialized.

Parameters
[out]infoTransfer info.

◆ voice_speex_init()

bool voice_speex_init ( void  )

Initialize the encoder and allocate its buffers.

Does nothing if already initialized.

Returns
true on success.

◆ voice_speex_is_initialized()

bool voice_speex_is_initialized ( void  )

Check whether the encoder is initialized.

Returns
true if initialized.