#!/usr/bin/env python2 # Copyright 2014 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """This module provides abstraction of audio data.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import contextlib import copy import numpy as np import struct from six.moves import range import six """The dict containing information on how to parse sample from raw data. Keys: The sample format as in aplay command. Values: A dict containing: message: Human-readable sample format. dtype_str: Data type used in numpy dtype. Check https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html for supported data type. size_bytes: Number of bytes for one sample. """ SAMPLE_FORMATS = dict( S32_LE=dict( message='Signed 32-bit integer, little-endian', dtype_str='