blue_st_sdk.features.audio.adpcm package

Submodules

blue_st_sdk.features.audio.adpcm.bv_audio_sync_manager module

class blue_st_sdk.features.audio.adpcm.bv_audio_sync_manager.BVAudioSyncManager[source]

Bases: object

The feature contains all mandatory ADPCM synchronization parameters extracted from an AudioSync received packet.

classmethod get_index_in()[source]

Returns the adpcm_index_in parameter value.

Returns:
int: Current adpcm index.
classmethod get_pred_sample_in()[source]

Returns The adpcm_predsample_in parameter value.

Returns:
short: The adpcm predsample actual value.
classmethod initialize_reset_flag()[source]

Initialize reset flag.

classmethod is_intra()[source]

Returns the intra_flag parameter state.

Returns:
boolean: True if is activated, False elsewhere.
classmethod set_synchronization_parameters(sample)[source]
Populate all mandatory adpcm synchronization parameters from an input
FeatureAudioADPCMSync Sample.
Args:
sample (Sample): A Sample exctracted from a received
FeatureAudioADPCMSync synchronization packet (6 bytes).

blue_st_sdk.features.audio.adpcm.feature_audio_adpcm module

class blue_st_sdk.features.audio.adpcm.feature_audio_adpcm.ADPCMEngine[source]

Bases: object

DPCM Engine class. It contains all the operations and parameters necessary to decompress the received audio.

__init__()[source]

Constructor.

decode(code, sync_manager)[source]

ADPCM_Decode.

Args:
code (byte): It contains a 4-bit ADPCM sample.
Returns:
int: A 16-bit ADPCM sample.
class blue_st_sdk.features.audio.adpcm.feature_audio_adpcm.FeatureAudioADPCM(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the compressed audio data acquired from a microphone.

Data is a twenty bytes array.

AUDIO_PACKAGE_SIZE = 40
DATA_LENGTH_BYTES = 20
DATA_MAX = 0
DATA_MIN = 256
FEATURE_DATA_NAME = 'Audio'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'ADPCM Audio'
FEATURE_UNIT = None
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
bv_sync_manager = None
engine_adpcm = None
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
data (bytearray): The data read from the feature (a 20 bytes array). offset (int): Offset where to start reading data (0 by default).
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read (20) and the extracted data (audio info, the 40 shorts array).
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_audio(sample)[source]

Get the audio data from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
short[]: audio values if the data array is valid, None[] otherwise.
set_audio_sync_parameters(sample)[source]
Set the object synchronization parameters necessary to the
decompression process.
Args:
sample (blue_st_sdk.feature.Sample): Extracted sample which
contains the synchronization parameters.

blue_st_sdk.features.audio.adpcm.feature_audio_adpcm_sync module

class blue_st_sdk.features.audio.adpcm.feature_audio_adpcm_sync.FeatureAudioADPCMSync(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the audio synchronization parameters mandatory to the ADPCM audio decompression.

ADPCM_INDEX_INDEX = 0
ADPCM_PREDSAMPLE_INDEX = 1
DATA_LENGTH_BYTES = 6
DATA_MAX = 32767
DATA_MIN = -32768
FEATURE_DATA_NAME = ['ADPCM_index', 'ADPCM_predsample']
FEATURE_INDEX_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'ADPCM Sync'
FEATURE_PREDSAMPLE_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_UNIT = None
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]
Extract the audio sync data from the feature’s raw data.
In this case it reads a short integer (adpcm_index) and an integer (adpcm_predsample).
Args:
data (bytearray): The data read from the feature (a 6 bytes array). offset (int): Offset where to start reading data (0 by default).
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read (6) and the extracted data (audio sync info, a short and an int).
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
static get_index()[source]
Method which extract the index synchronization parameter from a buffer
passed as parameter
Args:
sample (blue_st_sdk.feature.Sample): Sample data (6 bytes).
Returns:
short: The ADPCM index synch parameter if the data array is valid, “None” otherwise.
static get_predicted_sample()[source]
Method which extract the predsample synchronization parameter from a
buffer passed as parameter
Args:
sample (blue_st_sdk.feature.Sample): Sample data (6 bytes).
Returns:
short: The ADPCM predsample synch parameter if the data array is valid, “None” otherwise.

Module contents