Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Documentation Improvements: cues #25

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,22 @@ source for all WAVE file metadata.
* [iXML][ixml] production recorder metadata, including project, scene, and
take tags, recorder notes and file family information.
* iXML `STEINBERG` sound library attributes.
* Wave embedded cue markers, cue marker labels, notes and timed ranges as used
* Wave embedded [cue markers][cues], cue marker labels, notes and timed ranges as used
by Zoom, iZotope RX, etc.
* Most of the common [RIFF INFO][info-tags] metadata fields.
* The __wav format__ is also parsed, so you can access the basic sample rate
* The [wav format][format] is also parsed, so you can access the basic sample rate
and channel count information.

[bext]: https://wavinfo.readthedocs.io/en/latest/scopes/bext.html
[smpte_330m2011]: https://wavinfo.readthedocs.io/en/latest/scopes/bext.html#wavinfo.wave_bext_reader.WavBextReader.umid
[adm]: https://wavinfo.readthedocs.io/en/latest/scopes/adm.html
[ebu3285s6]: https://wavinfo.readthedocs.io/en/latest/scopes/dolby.html
[ixml]: https://wavinfo.readthedocs.io/en/latest/scopes/ixml.html
[info-tags]: https://wavinfo.readthedocs.io/en/latest/scopes/info.html
[eburf64]: https://tech.ebu.ch/docs/tech/tech3306v1_1.pdf

[format]:https://wavinfo.readthedocs.io/en/latest/classes.html#wavinfo.wave_reader.WavAudioFormat
[cues]:https://wavinfo.readthedocs.io/en/latest/scopes/cue.html
[bext]:https://wavinfo.readthedocs.io/en/latest/scopes/bext.html
[smpte_330m2011]:https://wavinfo.readthedocs.io/en/latest/scopes/bext.html#wavinfo.wave_bext_reader.WavBextReader.umid
[adm]:https://wavinfo.readthedocs.io/en/latest/scopes/adm.html
[ebu3285s6]:https://wavinfo.readthedocs.io/en/latest/scopes/dolby.html
[ixml]:https://wavinfo.readthedocs.io/en/latest/scopes/ixml.html
[info-tags]:https://wavinfo.readthedocs.io/en/latest/scopes/info.html
[eburf64]:https://tech.ebu.ch/docs/tech/tech3306v1_1.pdf


## How To Use
Expand Down
9 changes: 9 additions & 0 deletions docs/source/scopes/cue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ Class Reference

.. autoclass:: wavinfo.wave_cues_reader.WavCuesReader
:members:

.. autoclass:: wavinfo.wave_cues_reader.CueEntry
:members:

.. autoclass:: wavinfo.wave_cues_reader.LabelEntry
:members:

.. autoclass:: wavinfo.wave_cues_reader.NoteEntry
:members:
24 changes: 23 additions & 1 deletion wavinfo/wave_cues_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@


class CueEntry(NamedTuple):
"""
A ``cue`` element structure.
"""
#: Cue "name" or id number
name: int
#: Cue position, as a frame count in the play order of the WAVE file. In
#: principle this can be affected by playlists and ``wavl`` chunk
#: placement.
position: int
chunk_id: bytes
chunk_start: int
Expand All @@ -114,7 +121,8 @@ def format_size(cls) -> int:
@classmethod
def read(cls, data: bytes) -> 'CueEntry':
assert len(data) == cls.format_size(), \
f"cue data size incorrect, expected {calcsize(cls.Format)} found {len(data)}"
(f"cue data size incorrect, expected {calcsize(cls.Format)}"
"found {len(data)}")

parsed = unpack(cls.Format, data)

Expand All @@ -124,6 +132,9 @@ def read(cls, data: bytes) -> 'CueEntry':


class LabelEntry(NamedTuple):
"""
A ``labl`` structure.
"""
name: int
text: str

Expand All @@ -137,6 +148,9 @@ def read(cls, data: bytes, encoding: str):


class RangeLabel(NamedTuple):
"""
A ``ltxt`` structure.
"""
name: int
length: int
purpose: str
Expand All @@ -163,9 +177,17 @@ def read(cls, data: bytes, fallback_encoding: str):

@dataclass
class WavCuesReader:

#: Every ``cue`` entry in the file
cues: List[CueEntry]

#: Every ``labl`` in the file
labels: List[LabelEntry]

#: Every ``ltxt`` in the file
ranges: List[RangeLabel]

#: Every ``note`` in the file
notes: List[NoteEntry]

@classmethod
Expand Down
Loading