pytimbre.audio.PeakChunk

class pytimbre.audio.PeakChunk(reader: FileIO = None, offset: int = None, size: int = None, name: str = None, channel_count: int = 1)

Bases: ChunkInformation

This class contains the information about the peaks within each channel of the wave file

__init__(reader: FileIO = None, offset: int = None, size: int = None, name: str = None, channel_count: int = 1)

Constructor for the peak chunk. This will read the peak from multiple channels :param reader: FileIO - the reader for the chunk data :param offset: int - the offset within the file of the actual data of the chunk :param size: int - the number of bytes within the chunk :param name: str - the name of the chunk :param channel_count: int - the number of channels within the wav file

Methods

__init__([reader, offset, size, name, ...])

Constructor for the peak chunk.

from_waveform(wfm)

This function creates an instance of the PeakChunk from the data within a Waveform object :param wfm: The data to build the PeakChunk from :type wfm: Waveform :return: The properly formatted PeakChunk object :rtype: PeakChunk

write_chunk(writer)

This function writes the contents of the chunk into the file at the current position of the FileIO object :param writer: FileIO - the writer that will put the data into the correct format at the current position

Attributes

chunk_name

chunk_offset

chunk_size

peak_amplitude

peak_sample

static from_waveform(wfm: Waveform)

This function creates an instance of the PeakChunk from the data within a Waveform object :param wfm: The data to build the PeakChunk from :type wfm: Waveform :return: The properly formatted PeakChunk object :rtype: PeakChunk

write_chunk(writer)

This function writes the contents of the chunk into the file at the current position of the FileIO object :param writer: FileIO - the writer that will put the data into the correct format at the current position