pytimbre.audio.DataChunk¶
- class pytimbre.audio.DataChunk(reader: FileIO = None, offset: int = None, size: int = None, name: str = None, fmt: FormatChunk = None, peak: PeakChunk = None, s0: int = None, s1: int = None, normalized: bool = False)¶
Bases:
ChunkInformationThis class understand the various types of data formats that exist within wav files
- __init__(reader: FileIO = None, offset: int = None, size: int = None, name: str = None, fmt: FormatChunk = None, peak: PeakChunk = None, s0: int = None, s1: int = None, normalized: bool = False)¶
This constructor employs the Format_Chunk object to understand how to read the data from the wav file. :param reader: FileIO - The file object to read the data :param offset: int - the offset of the beginning of the data chunk’s data :param size: int - the overall size of the data chunk’s data :param name: str - the name of the chunk :param fmt: Format_Chunk - the object that understands how to format the waveform :param s0: int - the starting sample :param s1: int - the ending sample :param normalized: bool - a flag determining whether the contents of the data files were normalized to the peak
values
Methods
__init__([reader, offset, size, name, fmt, ...])This constructor employs the Format_Chunk object to understand how to read the data from the wav file. :param reader: FileIO - The file object to read the data :param offset: int - the offset of the beginning of the data chunk's data :param size: int - the overall size of the data chunk's data :param name: str - the name of the chunk :param fmt: Format_Chunk - the object that understands how to format the waveform :param s0: int - the starting sample :param s1: int - the ending sample :param normalized: bool - a flag determining whether the contents of the data files were normalized to the peak values.
from_waveform(wfm)Create an instance of the DataChunk from the information within the Waveform object :param wfm: The audio data :type wfm: Waveform :return: Properly formatted DataChunk :rtype: DataChunk
write_chunk(file[, normalize])Write the information within the chunk to the audio file in the correct manner :param normalize: Whether to normalize the data or not before writing to the file :type normalize: bool :param file: the file object to write the chunk into :type file: FileIO
Attributes
chunk_namechunk_offsetchunk_sizesamples- static from_waveform(wfm: Waveform)¶
Create an instance of the DataChunk from the information within the Waveform object :param wfm: The audio data :type wfm: Waveform :return: Properly formatted DataChunk :rtype: DataChunk
- write_chunk(file, normalize: bool = False)¶
Write the information within the chunk to the audio file in the correct manner :param normalize: Whether to normalize the data or not before writing to the file :type normalize: bool :param file: the file object to write the chunk into :type file: FileIO