pytimbre.utilities.metadata.AudioMetaData¶
- class pytimbre.utilities.metadata.AudioMetaData¶
Bases:
objectThis class contains the various named elements of the audio that exist within the Wave file canonical descriptions of the elements of the List Chunk. This also provides methods to create the header for the StandardBinaryFile and the ListChunk for the Wave file.
- __init__()¶
Initialize the object
Methods
__init__()Initialize the object
add_field(field_name, field_value)This will add a new field to the meta_data_information dictionary :param field_name: the name of the field, or the key :type field_name: str :param field_value: the value to assign :type field_value: Any
convert_standard_binary_header(header_line)This function will take the information within the header line and remove the semicolon in the front and all ellipsoid markers to determine the name of the property.
field_present(field_name)This examines the keys of the dictionary and determines whether this field already exists :param field_name: the name of the field to search the dictionary for :type field_name: str :return: whether the field_name exists within the dictionary keys :rtype: bool
from_header(header)This creates a class from the information within the header of the StandardBinaryFile.
from_list_chunk(chunk)This creates the class from the List Chunk class.
This function will read the header information from the file and create the information within this class based on the information within the binary file's header.
get_field(field_name)read_format(sample_format_key, data_format_key)read_sample_count(key)read_sample_rate(key)Python does not provide the ability to read a line of text from a binary file.
read_start_time(key)Attributes
archival_locationartistcolor_palette_countcommissioned_organizationcopyrightcreation_datecreation_softwarecropping_informationdata_keysdata_sourcedescriptiondigitizing_engineerdots_per_inchengineer_namegeneral_commentskey_wordslightness_settingsoriginal_formoriginating_object_dimensionsoriginating_object_mediumsubject_genresubject_nametitletrack_number- add_field(field_name, field_value)¶
This will add a new field to the meta_data_information dictionary :param field_name: the name of the field, or the key :type field_name: str :param field_value: the value to assign :type field_value: Any
- static convert_standard_binary_header(header_line: str)¶
This function will take the information within the header line and remove the semicolon in the front and all ellipsoid markers to determine the name of the property. It also splits based on the colon to determine the value
@author: Frank Mobley
Parameters¶
- header_lineSTRING
The line of text from the header of the file
Returns¶
- nameSTRING
The name of the property or attribute
- valueSTRING
The value of the property
- field_present(field_name)¶
This examines the keys of the dictionary and determines whether this field already exists :param field_name: the name of the field to search the dictionary for :type field_name: str :return: whether the field_name exists within the dictionary keys :rtype: bool
- static from_header(header: dict)¶
This creates a class from the information within the header of the StandardBinaryFile. All elements are stored within the dictionary until the specific words are defined as the property names. :param header: the collection of information from the header of the StandardBinaryFile :type header: dict :return: The formatted metadata collection of information :rtype: AudioMetaData
- static from_list_chunk(chunk)¶
This creates the class from the List Chunk class. It will populate the data from the properties of that object into the properties within this class. :param chunk: The List Chunk object to create the current project :type chunk: ListChunk :returns: AudioMetaData
- static from_standard_binary_file(path: str)¶
This function will read the header information from the file and create the information within this class based on the information within the binary file’s header. :param path: the location of the standard binary file :type path: str :return: The header as a collection of metadata :rtype: AudioMetaData
- static read_standard_binary_file_header_line(binary_file)¶
Python does not provide the ability to read a line of text from a binary file. This function will read from the current position in the file to the new line character. The set of bytes is then converted to a string and returned to the calling function.
@author: frank Mobley
Parameters¶
- binary_fileFILE
The file pointer that will be read from
Returns¶
The string representing a line of ASCII characters from the file.