Format Conversion
minispeaker.processor.convert
sampleformat_to_dtype
python
def sampleformat_to_dtype(
sample_format: SampleFormat) -> Union[uint8, int16, int32, float32]Converts a SampleFormat to the numpy equivalent dtype.
Arguments:
sample_formatSampleFormat - miniaudioSampleFormatof the audio sample.
Returns:
Union[uint8, int16, int32, float32]: A corresponding numpy dtype.
dtype_to_sampleformat
python
def dtype_to_sampleformat(
dtype: Union[None, uint8, int16, int32, float32]) -> SampleFormatConverts a numpy dtype to an equivalent SampleFormat.
Arguments:
dtypeUnion[None, uint8, int16, int32, float32] - Numpy dtype of the audio sample.
Raises:
ValueError- When a inconvertible dtype is given
Returns:
SampleFormat- Corresponding miniaudioSampleFormat.