clantime

Script courtesy of Andrei Amatuni; Last updated: March 2017

Given a folder filled with CLAN files, this script will output a csv with a list of all the files and the amount of subregion, silence, and skip time for each file.

It depends on there being unique onset and offset comments for these regions. So, for every "subregion starts" comment, there should be a "subregion ends" comment. There can't be duplicates of any given comment, or else the script will consider it an error. Because these comments should always come in pairs, there should always be an even number of them. If for some reason there's not an even number of comments with the word "subregion" or "silence" or "skip" in them, then the script will consider the file as having errors, and output all the comments to an errors.txt file.

usage

$ python clantime.py input_dir output.csv

Some common reasons why the script might run into an error:

  • One of the subregions has 3 comments, 1 starting comment and 2 duplicate ending comments

  • The word "silence" is in a regular comment that doesn't designate the begin or end of a "silence" region, leading to an uneven amount of comments with the word "silence" in them. For example:

    • %xcom: the silence was broken by the tea kettle

  • there is a "begin skip" without a corresponding "end skip", or vice versa

Last updated