### Use wavinfo Command Line Interface Source: https://github.com/iluvcapra/wavinfo/blob/master/README.md Shows how to use the installed shell command to quickly inspect metadata from a WAV file directly from the terminal. ```bash wavinfo test_files/A101_1.WAV ``` -------------------------------- ### Get WAV Cue Labels and Notes with Encoding Handling (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/examples/demo.ipynb Demonstrates retrieving cue marker labels and notes, including handling potential text encoding issues (e.g., UTF-8 for iZotope RX files), using the 'label_and_note' method within the 'cues' scope. ```Python path = "../tests/test_files/cue_chunks/izotoperx_cues_test.wav" info = WavInfoReader(path, info_encoding="utf-8") # iZotope RX seems to encode marker text as UTF-8 for cue in info.cues.each_cue(): print(f"Cue ID: {cue[0]}") label, note = info.cues.label_and_note(cue[0]) print(f" Label: {label}") print(f" At: {cue[1]}") print(f" Note: {note or ''}") ``` -------------------------------- ### Using the wavinfo Command-Line Interface Source: https://context7.com/iluvcapra/wavinfo/llms.txt This section details the usage of the wavinfo command-line tool for inspecting WAV file metadata. It covers basic usage for JSON output, specifying iXML or ADM formats for raw XML output, processing multiple files, and using interactive mode for exploring metadata scopes and fields. The example shows the structure of the JSON output. ```Bash # Basic usage - outputs JSON metadata wavinfo audio_file.wav # Output iXML metadata as raw XML wavinfo --ixml production_recording.wav # Output ADM metadata as raw XML wavinfo --adm atmos_master.wav # Process multiple files wavinfo file1.wav file2.wav file3.wav # Interactive mode for exploring metadata wavinfo -i recording.wav # (wavinfo) ls # List metadata keys # (wavinfo) cd bext # Navigate to bext scope # (wavinfo) ls # List bext fields # (wavinfo) cd .. # Go back up # (wavinfo) bye # Exit # Example JSON output structure: # { # "filename": "audio.wav", # "run_date": "2024-01-15T10:30:00.000000", # "application": "wavinfo 4.0.0", # "scopes": { # "fmt": { "sample_rate": 48000, "channel_count": 2, ... }, # "data": { "byte_count": 960000, "frame_count": 10000 }, # "bext": { "description": "...", "originator": "...", ... }, # } # } ``` -------------------------------- ### wavinfo JSON Output Example Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/command_line.md An example of the JSON output generated by wavinfo for a WAV file. This output includes various metadata scopes such as fmt, data, ixml, and bext. Binary data like UMID is base-64 encoded. ```json { "filename": "../tests/test_files/nuendo/wavinfo Test Project - Audio - 1OA.wav", "run_date": "2024-11-25T10:26:11.280053", "application": "wavinfo 3.0.0", "scopes": { "fmt": { "audio_format": 65534, "channel_count": 4, "sample_rate": 48000, "byte_rate": 576000, "block_align": 12, "bits_per_sample": 24 }, "data": { "byte_count": 576000, "frame_count": 48000 }, "ixml": { "track_list": [ { "channel_index": "1", "interleave_index": "1", "name": "", "function": "ACN0-FOA" }, { "channel_index": "2", "interleave_index": "2", "name": "", "function": "ACN1-FOA" }, { "channel_index": "3", "interleave_index": "3", "name": "", "function": "ACN2-FOA" }, { "channel_index": "4", "interleave_index": "4", "name": "", "function": "ACN3-FOA" } ], "project": "wavinfo Test Project", "scene": null, "take": null, "tape": null, "family_uid": "E5DDE719B9484A758162FF7B652383A3", "family_name": null }, "bext": { "description": "wavinfo Test Project Nuendo output", "originator": "Nuendo", "originator_ref": "USJPHNNNNNNNNN202829RRRRRRRRR", "originator_date": "2022-12-02", "originator_time": "10:21:06", "time_reference": 172800000, "version": 2, "umid": "base64:k/zr4qE4RiaXyd/fO7GuCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", "coding_history": "A=PCM,F=48000,W=24,T=Nuendo\r\n", "loudness_value": 327.67, "loudness_range": 327.67, "max_true_peak": 327.67, "max_momentary_loudness": 327.67, "max_shortterm_loudness": 327.67 } } } ``` -------------------------------- ### Accessing Broadcast-WAV (bext) Metadata Source: https://context7.com/iluvcapra/wavinfo/llms.txt Provides examples of accessing specific EBU Tech 3285 Broadcast-WAV metadata fields, including timestamps, UMID, and EBU R128 loudness measurements. ```python from wavinfo import WavInfoReader info = WavInfoReader('broadcast_audio.wav') if info.bext: bext = info.bext # Basic identification print(f"Description: {bext.description}") print(f"Originator: {bext.originator}") print(f"Originator Reference: {bext.originator_ref}") print(f"Date: {bext.originator_date}") print(f"Time: {bext.originator_time}") # Timeline position (samples from midnight) print(f"Time Reference: {bext.time_reference} samples") # BEXT version and coding history print(f"BEXT Version: {bext.version}") print(f"Coding History: {bext.coding_history}") # SMPTE UMID (if version >= 1) if bext.umid: print(f"UMID: {bext.umid.hex()}") # EBU R128 loudness (if version >= 2) if bext.loudness_value: print(f"Integrated Loudness: {bext.loudness_value} LUFS") print(f"Loudness Range: {bext.loudness_range} LU") print(f"Max True Peak: {bext.max_true_peak} dBTP") print(f"Max Momentary: {bext.max_momentary_loudness} LUFS") print(f"Max Short-term: {bext.max_shortterm_loudness} LUFS") # Get all bext data as dictionary bext_dict = bext.to_dict() ``` -------------------------------- ### GET /ixml/metadata Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/ixml.md Retrieves the primary iXML metadata fields from a WAV file, such as project, scene, take, and family identifiers. ```APIDOC ## GET /ixml/metadata ### Description Retrieves standard iXML production recorder metadata embedded in a WAV file. ### Method GET ### Endpoint /ixml/metadata ### Parameters None ### Request Example N/A (Library call: info.ixml) ### Response #### Success Response (200) - **project** (str) - The project or film name. - **scene** (str) - The scene or slate identifier. - **take** (str) - The take number. - **tape** (str) - The tape name. - **family_name** (str) - The name of the file family. - **family_uid** (str) - The globally-unique ID for the file family. #### Response Example { "project": "BMH", "scene": "A101", "take": "1", "tape": "18Y12M31", "family_uid": "USSDVGR1112089007124001008206300" } ``` -------------------------------- ### Get ADM Metadata as Dictionary Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/adm.md Convert all parsed ADM metadata from the WAV file into a Python dictionary format for easy access and manipulation. ```python adm_dict = reader.to_dict() print(adm_dict) ``` -------------------------------- ### GET /ixml/steinberg Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/ixml.md Retrieves vendor-specific Steinberg metadata from the iXML block if available. ```APIDOC ## GET /ixml/steinberg ### Description Accesses Steinberg-specific vendor metadata including media duration, start time, and program information. ### Method GET ### Endpoint /ixml/steinberg ### Parameters None ### Response #### Success Response (200) - **media_company** (str) - The media company name. - **media_duration** (float) - Total duration of the media. - **media_start_time** (float) - Start time offset. - **program_name** (str) - Name of the software program. - **program_version** (str) - Version of the software program. #### Response Example { "media_company": "Steinberg", "media_duration": 120.5, "media_start_time": 0.0, "program_name": "Nuendo", "program_version": "12.0" } ``` -------------------------------- ### GET /wavinfo/dolby_metadata Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Retrieves Dolby metadata segments from a parsed WAV file, including Atmos and Digital Plus information. ```APIDOC ## GET /wavinfo/dolby_metadata ### Description Reads and parses Dolby bitstream metadata segments from a WAV file using the WavDolbyMetadataReader. ### Method GET ### Endpoint wavinfo.wave_dbmd_reader.WavDolbyMetadataReader ### Parameters #### Request Body - **dbmd_data** (bytes) - Required - The raw Dolby metadata binary data extracted from the WAV file. ### Response #### Success Response (200) - **dolby_atmos** (List) - List of valid Dolby Atmos metadata segments. - **dolby_atmos_supplemental** (List) - List of valid Dolby Atmos Supplemental metadata segments. - **dolby_digital_plus** (List) - List of valid Dolby Digital Plus metadata segments. - **segment_list** (List) - A list of tuples containing (SegmentType, checksum_valid_bool, parsed_dataclass). ### Response Example { "dolby_atmos": [], "dolby_digital_plus": [{ "program_id": 1, "lfe_on": true, "bitstream_mode": "COMPLETE_MAIN", "audio_coding_mode": "CH_ORD_3_2", "datarate_kbps": 640 }] } ``` -------------------------------- ### Read WAV Format Chunk Info (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/examples/demo.ipynb This snippet illustrates accessing the 'fmt' scope from a WavInfoReader object to get essential audio format details such as sample rate, channel count, block alignment, and bits per sample. ```Python (info.fmt.sample_rate, info.fmt.channel_count, info.fmt.block_align, info.fmt.bits_per_sample) ``` -------------------------------- ### Get Information for a Specific Track Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/adm.md Retrieve detailed information about a specific audio track within the WAV file, identified by its index. Returns a dictionary containing content and pack format details, or None if the index is invalid. ```python track_index = 0 track_info = reader.track_info(index=track_index) if track_info: print(f"Track {track_index} Info: {track_info}") else: print(f"No information found for track {track_index}") ``` -------------------------------- ### Accessing Broadcast WAV Metadata Fields in Python Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/bext.md This Python code snippet demonstrates how to access various fields within the Broadcast WAV metadata extension using the wavinfo library. It prints the description, originator details, and coding history. Ensure the 'wavinfo' library is installed and an info object is initialized with a WAV file containing BEXT metadata. ```python print(info.bext.description) print("----------") print("Originator:", info.bext.originator) print("Originator Ref:", info.bext.originator_ref) print("Originator Date:", info.bext.originator_date) print("Originator Time:", info.bext.originator_time) print("Time Reference:", info.bext.time_reference) print(info.bext.coding_history) ``` -------------------------------- ### Get ADM XML as String Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/adm.md Retrieve the raw ADM XML content as a string from the WavADMReader instance. This is useful for inspection or further processing. ```python xml_string = reader.xml_str() print(xml_string) ``` -------------------------------- ### Initialize WavDolbyMetadataReader Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Demonstrates how to instantiate the metadata reader to access Dolby bitstream information from a data source. ```python from wavinfo.wave_dbmd_reader import WavDolbyMetadataReader # Assuming dbmd_data is the extracted metadata bytes from the WAV file reader = WavDolbyMetadataReader(dbmd_data) # Accessing metadata segments atmos_data = reader.dolby_atmos() dd_plus_data = reader.dolby_digital_plus() ``` -------------------------------- ### Reading WAV Metadata with WavInfoReader Source: https://context7.com/iluvcapra/wavinfo/llms.txt Demonstrates how to initialize the WavInfoReader to extract audio format details and various metadata scopes. It shows handling of file paths, custom text encodings, and reading from file handles. ```python from wavinfo import WavInfoReader # Basic usage - read a WAV file info = WavInfoReader('path/to/audio.wav') # Access audio format information print(f"Sample Rate: {info.fmt.sample_rate} Hz") print(f"Channels: {info.fmt.channel_count}") print(f"Bit Depth: {info.fmt.bits_per_sample}") print(f"Duration (frames): {info.data.frame_count}") # Access various metadata scopes (each returns None if not present) bext = info.bext ixml = info.ixml adm = info.adm dolby = info.dolby cues = info.cues smpl = info.smpl riff_info = info.info # Custom text encoding for legacy files info = WavInfoReader('file.wav', info_encoding='cp1252', bext_encoding='latin_1') # Read from file handle instead of path with open('audio.wav', 'rb') as f: info = WavInfoReader(f) ``` -------------------------------- ### Initialize WavInfoReader and Access Metadata (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/quickstart.md This snippet shows how to create an instance of WavInfoReader to parse a WAV file and access different metadata scopes like ADM and iXML. It requires the wavinfo library and a path to a WAV file. ```python import wavinfo path = 'path/to/your/wave/audio.wav' info = wavinfo.WavInfoReader(path) adm_metadata = info.adm ixml_metadata = info.ixml ``` -------------------------------- ### Initialize WavInfoReader and Access Metadata Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/quickstart.md This snippet shows how to initialize the WavInfoReader with a WAV file path and access different metadata scopes like ADM and iXML. ```APIDOC ## Initialize WavInfoReader and Access Metadata ### Description This example demonstrates how to create an instance of `WavInfoReader` to parse a WAV file and then access specific metadata scopes such as ADM and iXML. ### Method Instantiation and Attribute Access ### Endpoint N/A (Local File Processing) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import wavinfo path = 'path/to/your/wave/audio.wav' # Initialize the reader info = wavinfo.WavInfoReader(path) # Access metadata scopes adm_metadata = info.adm ixml_metadata = info.ixml print(f"ADM Metadata: {adm_metadata}") print(f"iXML Metadata: {ixml_metadata}") ``` ### Response #### Success Response (200) Output will show the retrieved metadata objects or None if not present. #### Response Example ``` ADM Metadata: iXML Metadata: ``` ``` -------------------------------- ### Extract Metadata with WavInfoReader Source: https://github.com/iluvcapra/wavinfo/blob/master/README.md Demonstrates how to initialize the WavInfoReader class to parse a WAV file and access specific metadata structures like ADM and iXML. ```python from wavinfo import WavInfoReader path = '../tests/test_files/A101_1.WAV' info = WavInfoReader(path) adm_metadata = info.adm ixml_metadata = info.ixml ``` -------------------------------- ### Iterating Metadata Fields with walk() Source: https://context7.com/iluvcapra/wavinfo/llms.txt Shows how to use the walk() method to iterate over all available metadata fields in a file. This is useful for comprehensive extraction or converting metadata into a structured dictionary. ```python from wavinfo import WavInfoReader info = WavInfoReader('production_audio.wav') # Iterate through all metadata for scope, key, value in info.walk(): print(f"[{scope}] {key}: {value}") # Build a dictionary of all metadata by scope metadata_dict = {} for scope, key, value in info.walk(): if scope not in metadata_dict: metadata_dict[scope] = {} metadata_dict[scope][key] = value ``` -------------------------------- ### Reading Sampler Loop Metadata from WAV Files (Python) Source: https://context7.com/iluvcapra/wavinfo/llms.txt This Python code demonstrates how to use WavInfoReader to access sampler metadata, including loop points, MIDI note assignments, and SMPTE timecode offsets from a WAV file. It covers MIDI information, manufacturer/product details, sample period, SMPTE format and offset, and loop point configurations. Dependencies: wavinfo library. ```Python from wavinfo import WavInfoReader info = WavInfoReader('sample_library.wav') if info.smpl: smpl = info.smpl # MIDI information print(f"MIDI Note: {smpl.midi_note}") print(f"Pitch Detune: {smpl.midi_pitch_detune_cents} cents") # Sampler identification print(f"Manufacturer: {smpl.manufacturer}") print(f"Product: {smpl.product}") print(f"Sample Period: {smpl.sample_period_ns} ns") # SMPTE timecode print(f"SMPTE Format: {smpl.smpte_format}") # 0, 24, 25, 29, 30 hh, mm, ss, ff = smpl.smpte_offset print(f"SMPTE Offset: {hh:02d}:{mm:02d}:{ss:02d}:{ff:02d}") # Loop points for loop in smpl.sample_loops: print(f"Loop {loop.ident}:") print(f" Type: {loop.loop_type_desc()}" ) # FORWARD, BACKWARD, etc. print(f" Start: {loop.start} samples") print(f" End: {loop.end} samples") print(f" Detune: {loop.detune_cents} cents") print(f" Repetitions: {loop.repetition_count} (0=infinite)") # Sampler-specific user data if smpl.sampler_udata: print(f"User Data: {len(smpl.sampler_udata)} bytes") # Get all sampler data as dictionary smpl_dict = smpl.to_dict() ``` -------------------------------- ### Iterate Through WAV Cues Metadata (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/examples/demo.ipynb This snippet shows how to iterate through cue markers in a WAV file using the 'cues' scope and the 'each_cue' method. It retrieves the cue identifier and its sample offset. ```Python path = "../tests/test_files/cue_chunks/STE-000.wav" info = WavInfoReader(path) for cue in info.cues.each_cue(): print(f"Cue ID: {cue[0]}") print(f"Cue Offset: {cue[1]}") ``` -------------------------------- ### walk() Metadata Iteration Source: https://context7.com/iluvcapra/wavinfo/llms.txt The walk() method allows for comprehensive metadata extraction by iterating through all available scopes and keys. ```APIDOC ## METHOD walk() ### Description Iterates through all metadata fields present in the file, yielding them as (scope, key, value) tuples. ### Method GET (Internal Method) ### Response #### Success Response (Iterator) - **scope** (str) - The metadata category (e.g., 'fmt', 'bext', 'ixml') - **key** (str) - The specific field name - **value** (any) - The field value ``` -------------------------------- ### Initialize WavADMReader Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/adm.md Instantiate the WavADMReader class to read ADM XML data from a WAV file. It requires the XML data and channel data as bytes. ```python from wavinfo.wave_adm_reader import WavADMReader # Assuming axml_data and chna_data are bytes objects containing the respective data reader = WavADMReader(axml_data=b'...', chna_data=b'chna_data_bytes') ``` -------------------------------- ### WavInfoReader Initialization Source: https://context7.com/iluvcapra/wavinfo/llms.txt Initializes the WavInfoReader to parse audio file metadata from a file path or file handle, with optional encoding support for legacy files. ```APIDOC ## CLASS WavInfoReader ### Description Initializes the reader to extract metadata from a WAVE or RF64 file. It parses the file structure once and provides property-based access to various metadata scopes. ### Method Constructor (Python Class) ### Parameters #### Path Parameters - **path_or_file** (str or file-like object) - Required - The file path or an open binary file handle to the audio file. #### Query Parameters - **info_encoding** (str) - Optional - Character encoding for RIFF INFO fields (default: cp1252). - **bext_encoding** (str) - Optional - Character encoding for BEXT fields (default: latin_1). ### Request Example from wavinfo import WavInfoReader info = WavInfoReader('path/to/audio.wav', info_encoding='utf-8') ### Response #### Success Response (Object) - **fmt** (object) - Audio format properties (sample_rate, channel_count, etc.) - **bext** (object) - Broadcast-WAV metadata - **ixml** (object) - iXML production metadata - **adm** (object) - Audio Definition Model metadata - **cues** (object) - Cue markers and notes - **info** (object) - RIFF INFO metadata ``` -------------------------------- ### Walk Through All Metadata Fields (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/quickstart.md Demonstrates iterating through all available metadata fields within a WAV file using the walk() method of the WavInfoReader object. This method yields tuples of scope, key, and value for each metadatum. ```python for scope, key, value in info.walk(): print(f"Scope: {scope}, Key: {key}, Value: {value}") ``` -------------------------------- ### Read INFO Metadata from WAV file Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/info.md Demonstrates how to initialize the WavInfoReader and access specific INFO metadata fields such as artist, copyright, and comments. The reader uses a specified encoding to decode the metadata strings. ```python from wavinfo import WavInfoReader bullet_path = '../tests/test_files/BULLET Impact Plastic LCD TV Screen Shatter Debris 2x.wav' bullet = WavInfoReader(bullet_path) print("INFO Artist:", bullet.info.artist) print("INFO Copyright:", bullet.info.copyright) print("INFO Comment:", bullet.info.comment) ``` -------------------------------- ### Extract iXML Production Recorder Metadata Source: https://context7.com/iluvcapra/wavinfo/llms.txt Demonstrates how to access production-specific metadata like scene, take, and track information from a WAV file. It also shows how to retrieve Steinberg-specific extensions and convert the iXML data into a dictionary. ```python from wavinfo import WavInfoReader info = WavInfoReader('field_recording.wav') if info.ixml: ixml = info.ixml # Production information print(f"Project: {ixml.project}") print(f"Scene: {ixml.scene}") print(f"Take: {ixml.take}") print(f"Tape: {ixml.tape}") # File family (for multi-track recordings) print(f"Family UID: {ixml.family_uid}") print(f"Family Name: {ixml.family_name}") # Track information for track in ixml.track_list: print(f"Track {track.channel_index}: {track.name} ({track.function})") # Access raw XML for custom parsing raw_xml = ixml.raw_xml # lxml ElementTree xml_string = ixml.xml_str() # XML as string # Steinberg-specific metadata (from Nuendo/Cubase) if ixml.steinberg: steinberg = ixml.steinberg print(f"Speaker Arrangement: {steinberg.audio_speaker_arrangement}") print(f"Sample Format Size: {steinberg.sample_format_size}") print(f"Media Company: {steinberg.media_company}") # Get all ixml data as dictionary ixml_dict = ixml.to_dict() ``` -------------------------------- ### Accessing Cue Markers and Regions in WAV Files (Python) Source: https://context7.com/iluvcapra/wavinfo/llms.txt This Python code demonstrates how to use the WavInfoReader to access embedded cue points, labels, notes, and timed regions from a WAV file. It shows how to iterate through cues, retrieve labels and notes, identify region markers, and access raw cue data, labels, and ranges. Dependencies: wavinfo library. ```Python from wavinfo import WavInfoReader info = WavInfoReader('edited_audio.wav') if info.cues: cues = info.cues # Iterate through all cue points for cue_id, sample_offset in cues.each_cue(): print(f"Cue {cue_id} at sample {sample_offset}") # Get label and note for this cue label, note = cues.label_and_note(cue_id) if label: print(f" Label: {label}") if note: print(f" Note: {note}") # Get range length if this is a region marker range_length = cues.range(cue_id) if range_length: print(f" Region length: {range_length} samples") # Access raw cue entries for cue in cues.cues: print(f"Cue: name={cue.name}, position={cue.position}, sample_offset={cue.sample_offset}") # Access all labels for label in cues.labels: print(f"Label: cue_id={label.name}, text={label.text}") # Access range labels (ltxt chunks) for range_label in cues.ranges: print(f"Range: cue_id={range_label.name}, length={range_label.length}, purpose={range_label.purpose}") # Get all cues data as dictionary cues_dict = cues.to_dict() ``` -------------------------------- ### Open WAV File for Metadata Reading with WavInfoReader (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/examples/demo.ipynb This snippet shows the basic usage of the WavInfoReader class to open a WAV file and access its metadata. It imports the necessary class and instantiates the reader with a file path. ```Python from wavinfo import WavInfoReader path = '../tests/test_files/sounddevices/A101_1.WAV' info = WavInfoReader(path) ``` -------------------------------- ### Iterating and Retrieving Cue Metadata Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/cue.md Demonstrates how to use the WavCuesReader to iterate over cues and retrieve associated labels, notes, and range lengths for specific cue identifiers. ```python from wavinfo import WavInfoReader # Initialize reader with specific encoding reader = WavInfoReader('example.wav', info_encoding='latin_1') if reader.cues: cues_reader = reader.cues # Iterate through each cue for name, offset in cues_reader.each_cue(): label, note = cues_reader.label_and_note(name) range_len = cues_reader.range(name) print(f"Cue {name} at {offset}: Label={label}, Note={note}, Range={range_len}") ``` -------------------------------- ### Read Basic WAV Data Chunk Info (Python) Source: https://github.com/iluvcapra/wavinfo/blob/master/examples/demo.ipynb Demonstrates how to access the 'data' scope of a WavInfoReader object to retrieve the total frame count and byte count of the WAV file. This provides fundamental information about the audio data's size. ```Python (info.data.frame_count, info.data.byte_count) ``` -------------------------------- ### WavInfoReader - Cue Markers and Regions Source: https://context7.com/iluvcapra/wavinfo/llms.txt Access embedded cue points, labels, notes, and timed regions from WAV files. ```APIDOC ## GET /wavinfo/cues ### Description Retrieves embedded cue points, labels, and region markers from a WAV file. ### Method GET ### Parameters #### Request Body - **file_path** (string) - Required - Path to the target WAV file. ### Response #### Success Response (200) - **cues** (object) - Dictionary containing cue IDs, labels, notes, and range lengths. ### Response Example { "cues": { "1": {"position": 1024, "label": "Start", "note": "Intro"}, "2": {"position": 44100, "range_length": 22050} } } ``` -------------------------------- ### wavinfo CLI Basic Usage Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/command_line.md The wavinfo command-line tool reads WAV files and outputs metadata to standard output. It supports JSON output by default, with options to extract specific metadata like iXML or ADM. ```shell wavinfo [[-i] | [--ixml | --adm]] INFILE + ``` -------------------------------- ### WavInfoReader Class Documentation Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/quickstart.md Detailed documentation for the WavInfoReader class, including its constructor and available metadata scopes. ```APIDOC ## WavInfoReader Class Documentation ### Description Provides a comprehensive overview of the `WavInfoReader` class, its initialization parameters, and the various metadata scopes it exposes for accessing information within WAV audio files. ### Class `wavinfo.wave_reader.WavInfoReader` ### Constructor #### `__init__(path, info_encoding='latin_1', bext_encoding='ascii')` Creates a new `WavInfoReader` object to parse a WAV audio file for metadata. * **Parameters:** * `path` (pathlike object or IO): The path to the WAV file or an open file handle. * `info_encoding` (str): Encoding for RIFF-defined metadata fields (default: 'latin_1'). * `bext_encoding` (str): Encoding for Broadcast-WAV extension string fields (default: 'ascii'). ### Attributes (Metadata Scopes) * **`adm`** (*WavADMReader* | None): Accesses ADM Audio Definition Model metadata. * **`bext`** (*WavBextReader* | None): Accesses Broadcast-Wave metadata. * **`cues`** (*WavCuesReader* | None): Accesses RIFF cues markers, labels, and notes. * **`data`** (*WavDataDescriptor* | None): Provides statistics of the data section. * **`dolby`** (*WavDolbyMetadataReader* | None): Accesses Dolby bitstream metadata. * **`fmt`** (*WavAudioFormat* | None): Retrieves the Wave audio data format. * **`info`** (*WavInfoChunkReader* | None): Accesses RIFF INFO metadata. * **`ixml`** (*WavIXMLFormat* | None): Accesses iXML metadata. * **`smpl`** (*WavSmplReader* | None): Accesses Sampler smpl metadata. * **`url`** (str): The file:// URL for the WAV file. ### Methods #### `walk() → Generator[str, str, Any]` Iterates through all available metadata fields in the WAV file. * **Yields:** Tuples of `(scope, key, value)` for each metadatum. The `scope` can be one of 'fmt', 'data', 'ixml', 'bext', 'info', 'dolby', 'cues', 'adm', or 'smpl'. ``` -------------------------------- ### wavinfo CLI Metadata Extraction Options Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/command_line.md This section describes the command-line flags for wavinfo to control the output format. Options include default JSON, interactive mode (-i), iXML metadata (--ixml), and ADM XML metadata (--adm). ```shell # Default: Output JSON wavinfo file.wav # Interactive mode wavinfo -i file.wav # Output iXML metadata wavinfo --ixml file.wav # Output ADM XML metadata wavinfo --adm file.wav ``` -------------------------------- ### Extract WAV Audio Format Info - Python Source: https://context7.com/iluvcapra/wavinfo/llms.txt This Python snippet demonstrates how to use WavInfoReader to extract and display audio format details such as audio format code, channel count, sample rate, byte rate, block align, and bits per sample from a WAV file. It also calculates and prints the audio duration and total byte count. ```python from wavinfo import WavInfoReader info = WavInfoReader('audio.wav') fmt = info.fmt print(f"Audio Format Code: {fmt.audio_format}") # 1=PCM, 3=Float, 65534=Extensible print(f"Channel Count: {fmt.channel_count}") print(f"Sample Rate: {fmt.sample_rate} Hz") print(f"Byte Rate: {fmt.byte_rate} bytes/sec") print(f"Block Align: {fmt.block_align} bytes") print(f"Bits Per Sample: {fmt.bits_per_sample}") # Calculate duration data = info.data duration_seconds = data.frame_count / fmt.sample_rate print(f"Duration: {duration_seconds:.2f} seconds") print(f"Total Bytes: {data.byte_count}") ``` -------------------------------- ### Read ADM (Audio Definition Model) Metadata Source: https://context7.com/iluvcapra/wavinfo/llms.txt Shows how to parse EBU ADM metadata for object-based audio. This includes iterating through programme structures, audio objects, and accessing channel UID entries from the chna chunk. ```python from wavinfo import WavInfoReader info = WavInfoReader('atmos_master.wav') if info.adm: adm = info.adm # Get programme structure programme = adm.programme() print(f"Programme: {programme['programme_name']} ({programme['programme_id']})") print(f"Start: {programme['programme_start']}, End: {programme['programme_end']}") # Iterate contents and objects for content in programme['contents']: print(f" Content: {content['content_name']} ({content['content_id']})") for obj in content['objects']: print(f" Object: {obj['object_name']} (Pack: {obj['pack_id']})") print(f" Track UIDs: {obj['track_uids']}") # Get info for a specific audio track (0-indexed) track_info = adm.track_info(0) if track_info: print(f"Track 0 - Content: {track_info['content_name']}") print(f" Object: {track_info['audio_object_name']}") print(f" Channel Format: {track_info['channel_format_name']}") print(f" Pack Format: {track_info['pack_format_name']} ({track_info['pack_type']})") # Channel UID entries from chna chunk for entry in adm.channel_uids: print(f"Track {entry.track_index}: UID={entry.uid}, Pack={entry.pack_ref}") # Get raw ADM XML adm_xml_string = adm.xml_str() # Get all ADM data as dictionary adm_dict = adm.to_dict() ``` -------------------------------- ### wavinfo Interactive Mode Commands Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/command_line.md When running wavinfo in interactive mode (-i), users can navigate and query the metadata tree using specific commands. These commands allow exploration of the file's metadata structure. ```shell ls cd .. bye ? help ``` -------------------------------- ### WavInfoReader - Sampler Loop Metadata Source: https://context7.com/iluvcapra/wavinfo/llms.txt Read sampler metadata including loop points, MIDI note assignments, and SMPTE timecode offsets. ```APIDOC ## GET /wavinfo/smpl ### Description Extracts sampler-specific metadata such as MIDI pitch, loop points, and SMPTE timecode information. ### Method GET ### Response #### Success Response (200) - **smpl** (object) - Dictionary containing midi_note, manufacturer, smpte_offset, and sample_loops. ### Response Example { "smpl": { "midi_note": 60, "sample_loops": [{"ident": 1, "start": 0, "end": 44100, "type": "FORWARD"}] } } ``` -------------------------------- ### WavAudioFormat Class Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/classes.md Represents the audio format details of a WAV file. ```APIDOC ## WavAudioFormat Class ### Description Represents the audio format details of a WAV file, including channel count, sample rate, and bit depth. ### Class Definition `wavinfo.wave_reader.WavAudioFormat(audio_format, channel_count, sample_rate, byte_rate, block_align, bits_per_sample)` ### Fields - **audio_format** (int) - Alias for field number 0. - **channel_count** (int) - Alias for field number 1. - **sample_rate** (int) - Alias for field number 2. - **byte_rate** (int) - Alias for field number 3. - **block_align** (int) - Alias for field number 4. - **bits_per_sample** (int) - Alias for field number 5. ``` -------------------------------- ### Enum: SurroundEXMode Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Specifies the Dolby Surround-EX mode. ```APIDOC ## Enum: SurroundEXMode ### Description Dolby Surround-EX mode. dsurexmod § 4.3.9.1 ``` -------------------------------- ### Broadcast-WAV (bext) Metadata Access Source: https://context7.com/iluvcapra/wavinfo/llms.txt Access specific EBU Tech 3285 Broadcast-WAV extension metadata including timestamps, UMID, and loudness measurements. ```APIDOC ## PROPERTY bext ### Description Provides access to the BEXT metadata scope, including production information and loudness data for R128 compliance. ### Response #### Success Response (Object) - **description** (str) - File description - **originator** (str) - Originating device - **time_reference** (int) - Samples from midnight - **loudness_value** (float) - Integrated loudness in LUFS - **umid** (bytes) - SMPTE UMID identifier ``` -------------------------------- ### Access iXML Metadata in Python Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/ixml.md This Python code snippet demonstrates how to access and print various metadata fields from an iXML object, such as project, scene, take, tape, and file family information. It assumes an 'info.ixml' object is available. ```python print("iXML Project:", info.ixml.project) print("iXML Scene:", info.ixml.scene) print("iXML Take:", info.ixml.take) print("iXML Tape:", info.ixml.tape) print("iXML File Family Name:", info.ixml.family_name) print("iXML File Family UID:", info.ixml.family_uid) ``` -------------------------------- ### Enum: PreferredDownMixMode Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Indicates the preferred downmix mode. ```APIDOC ## Enum: PreferredDownMixMode ### Description Indicates the creating engineer’s preference of what the receiver should downmix. § 4.3.8.1 ``` -------------------------------- ### WavInfoReader INFO Access Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/info.md Accessing INFO metadata fields from a WAV file using the WavInfoReader class. ```APIDOC ## GET /wavinfo/info ### Description Retrieves the INFO metadata chunk from a WAV or AVI file. This includes fields like Artist, Copyright, and Comments. ### Method GET ### Parameters #### Path Parameters - **file_path** (string) - Required - The local system path to the WAV or AVI file. #### Configuration Parameters - **info_encoding** (string) - Optional - The character encoding used to decode metadata strings (default: 'latin_1'). ### Request Example ```python from wavinfo import WavInfoReader reader = WavInfoReader('path/to/file.wav', info_encoding='utf-8') ``` ### Response #### Success Response (200) - **artist** (string) - The 'IART' field representing the artist or composer. - **copyright** (string) - The 'ICOP' field representing copyright information. - **comment** (string) - The 'ICMT' field representing user comments. - **title** (string) - The 'INAM' field representing the title of the work. #### Response Example { "artist": "Composer Name", "copyright": "2023", "comment": "Field recording", "title": "Sound Effect 01" } ``` -------------------------------- ### Dolby Digital Plus Metadata Fields Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md This section details the various fields within the Dolby Digital Plus metadata structure, including their types and descriptions. ```APIDOC ## Dolby Digital Plus Metadata ### Description This section details the various fields within the Dolby Digital Plus metadata structure, including their types and descriptions. ### Fields - **audio_coding_mode** ([AudioCodingMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.AudioCodingMode)) - Indicates which channels are in use. acmod § 4.3.2.3 - **bitstream_mode** ([BitStreamMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.BitStreamMode)) - The kind of service of this stream. bsmod § 4.3.2.2 - **center_downmix_level** ([CenterDownMixLevel](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.CenterDownMixLevel)) - When the front three channels are in use, gives the center downmix level. - **copyright_bitstream** (bool) - True if this bitstream is copyrighted. - **datarate_kbps** (int) - Data rate of this bitstream in kilobits per second - **dolby_headphone_encoded** ([HeadphoneMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.HeadphoneMode)) - Dolby Headphone mode - **dolby_surround_encoded** ([DolbySurroundEncodingMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.DolbySurroundEncodingMode)) - If the acmod is LR, this indicates if the channels are encoded in Dolby Surround. - **downmix_mode** ([PreferredDownMixMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.PreferredDownMixMode)) - Preferred downmix mode - **langcode** (int) - Language code - **langcode_present** (bool) - True if there is a langcode present in the metadata. - **lfe_on** (bool) - True if LFE is enabled. § 4.3.2.1 - **loro_center_downmix_level** ([DownMixLevelToken](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.DownMixLevelToken)) - LoRo preferred center downmix level - **loro_surround_downmix_level** ([DownMixLevelToken](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.DownMixLevelToken)) - LoRo preferred surround downmix level - **ltrt_center_downmix_level** ([DownMixLevelToken](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.DownMixLevelToken)) - LtRt preferred center downmix level - **ltrt_surround_downmix_level** ([DownMixLevelToken](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.DownMixLevelToken)) - LtRt preferred surround downmix level - **mixlevel** ([MixLevel](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.MixLevel)) - Mix level - **original_bitstream** (bool) - True if this bitstream is original. - **prod_info_exists** (bool) - True if mixlevel and roomtype are valid - **program_id** (int) - Program ID number, this identifies the program in a multi-program element. § 4.3.1 - **roomtype** ([RoomType](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.RoomType)) - Room Type - **stream_dependency** ([StreamDependency](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.StreamDependency)) - Indicates if this stream can be decoded independently or not - **surround_downmix_level** ([SurroundDownMixLevel](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.SurroundDownMixLevel)) - When the surround channels are in use, gives the surround downmix level. - **surround_ex_mode** ([SurroundEXMode](#wavinfo.wave_dbmd_reader.DolbyDigitalPlusMetadata.SurroundEXMode)) - Surround-EX mode ``` -------------------------------- ### Define Surround EX Mode Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Represents the Dolby Surround-EX mode. This is a class used within Dolby Digital Plus metadata. ```python class SurroundEXMode(*values): pass ``` -------------------------------- ### Enum: MixLevel Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Represents the mix level. ```APIDOC ## Enum: MixLevel ### Description § 4.3.6.2 ``` -------------------------------- ### Enum: RoomType Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Specifies the room type. ```APIDOC ## Enum: RoomType ### Description roomtyp 4.3.6.3 ``` -------------------------------- ### Define Gain Coefficients for Downmix Scenarios Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Defines constants representing gain coefficients used in various metadata fields for downmix scenarios. These are part of the DownMixLevelToken class. ```python class DownMixLevelToken(*values): MINUS_1_5DB = 3 MINUS_3DB = 4 MINUS_4_5DB = 5 MINUS_6DB = 6 MUTE = 7 PLUS_1_5DB = 1 PLUS_3DB = 0 UNITY = 2 ``` -------------------------------- ### Read ADM Audio Programme Data Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/adm.md Extract and read the ADM audioProgramme data structure, along with its associated reference properties, into a dictionary. ```python programme_data = reader.programme() print(programme_data) ``` -------------------------------- ### Enum: HeadphoneMode Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Defines the Dolby Headphone mode. ```APIDOC ## Enum: HeadphoneMode ### Description dheadphonmod § 4.3.9.2 ``` -------------------------------- ### Enum: RFCompressionProfile Source: https://github.com/iluvcapra/wavinfo/blob/master/docs/source/scopes/dolby.md Defines RF compression profiles. ```APIDOC ## Enum: RFCompressionProfile ### Description compr1 RF compression profile § 4.3.10 (fig 42) ```