Package gmisclib :: Module wavesurfer_lab
[frames] | no frames]

Module wavesurfer_lab

source code

When used as a script, this reads label files produced by wavesurfer and prints the result.

Also contains functions that can be used for reading and writing the label format preferred by Wavesurfer.

Functions
 
read(filename, loose=0)
Read in label (transcription) files produced by wavesurfer.
source code
 
write(fd, header, data)
Write label information to a file.
source code
Variables
  __package__ = 'gmisclib'

Imports: re, sys, DataError, NoSuchFileError, DataOutOfOrderError, BadFileFormatError, Error, end_marks, start_stop


Function Details

read(filename, loose=0)

source code 

Read in label (transcription) files produced by wavesurfer.

Note that leading or trailing spaces in the label are removed.

Parameters:
  • filename (str) - name of label file or '-' to mean sys.stdin
  • loose (int) - how many minor deviations from the ideal format are allowed
Returns:
(header, data). Data = [(starttime, endtime, label), ...].

write(fd, header, data)

source code 

Write label information to a file. Note: Expects data in [(t0, t1, label), ...] form.

Parameters:
  • fd (file or file-like object) - where to write
  • header (dict) - header information.
  • data ([(segment_start_time, segment_end_time, segment_label), ...]) - a listing of the segments to write to the file.