tempo_eval.read_annotations

tempo_eval.read_annotations(path, derive_version=None, namespace='tempo', derive_item_id=<function <lambda>>, validate=True, split_by_corpus=False)[source]

Recursively read all jam files from the given directory.

Parameters
  • path (str) – base directory

  • derive_version (Optional[Callable[[str, Annotation], str]]) – function that derives a version a given annotation

  • namespace (Union[str, Iterable[str]]) – one or more jam annotation namespace(s), e.g., tempo for tempo annotations

  • derive_item_id (Callable[[str, JAMS], str]) – function that returns an id given a file name and jams

  • validate (bool) – validate jam while reading (validation impacts performance negatively)

  • split_by_corpus (bool) – wrap results in a dict with corpus names (extracted from jams) as keys

Return type

Union[Dict[str, Dict[str, Dict[str, Annotation]]], Dict[str, Dict[str, Dict[str, Dict[str, Annotation]]]]]

Returns

jam annotation objects, organized as nested dicts with version and item ids as keys, if split_by_corpus the outermost dict uses corpus names as keys

Raises

FileNotFoundError – if path does not exist or is not a directory