Module audioio.audiomarkers
Working with marker lists.
Markers are used to mark specific positions or regions in the audio data. Each marker has a position (cue, event), a span, a label, and a text. Position, and span are handled with 1-D or 2-D arrays of ints, where each row is a marker and the columns are position and optional span. Labels and texts come in another 1-D or 2-D array of objects pointing to strings. Again, rows are the markers, first column are the labels, and second column the optional texts. Try to keep the labels short, and use text for longer descriptions.
write_markers()
: write markers to a text file or stream.print_markers()
: write markers to standard output.
Functions
def write_markers(fh, locs, labels=None, sep=' ', prefix='')
-
Write markers to a text file or stream.
Parameters
fh
:filename
orstream
- If not a stream, the file with name
fh
is opened. Otherwisefh
is used as a stream for writing. locs
:1-D
or2-D array
ofints
- Marker positions (first column) and optional spans (second column) for each marker (rows).
labels
:1-D
or2-D array
ofstring objects
- Labels (first column) and optional texts (second column) for each marker (rows).
sep
:str
- Column separator.
prefix
:str
- This string is written at the beginning of each line.
def print_markers(locs, labels=None, sep=' ', prefix='')
-
Write markers to standard output.
Parameters
locs
:1-D
or2-D array
ofints
- Marker positions (first column) and optional spans (second column) for each marker (rows).
labels
:1-D
or2-D array
ofstring objects
- Labels (first column) and optional texts (second column) for each marker (rows).
sep
:str
- Column separator.
prefix
:str
- This string is written at the beginning of each line.