#!/usr/bin/env python # 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.""" import contextlib import copy import struct import StringIO """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. struct_format: Format used in struct.unpack. size_bytes: Number of bytes for one sample. """ SAMPLE_FORMATS = dict( S32_LE=dict( message='Signed 32-bit integer, little-endian', struct_format='