API Reference

Core functionality

This library provides an interface for reading JAMS into Python, or creating them programatically.

Function reference

load(path_or_file[, validate, strict, fmt]) Load a JAMS Annotation from a file.

Object reference

JAMS([annotations, file_metadata, sandbox]) Top-level Jams Object
FileMetadata([title, artist, release, …]) Metadata for a given audio file.
AnnotationArray([annotations]) This list subclass provides serialization and search/filtering for annotation collections.
AnnotationMetadata([curator, version, …]) Data structure for metadata corresponding to a specific annotation.
Curator([name, email]) Container object for curator metadata.
Annotation(namespace[, data, …]) Annotation base class.
Observation(time, duration, value, confidence) Core observation type: (time, duration, value, confidence).
Sandbox(unconstrained) Functionally identical to JObjects, but the class hierarchy might be confusing if all objects inherit from Sandboxes.
JObject(**kwargs) Dict-like object for JSON Serialization.
Observation(time, duration, value, confidence) Core observation type: (time, duration, value, confidence).

Namespace management

add_namespace(filename) Add a namespace definition to our working set.
namespace(ns_key) Construct a validation schema for a given namespace.
namespace_array(ns_key) Construct a validation schema for arrays of a given namespace.
is_dense(ns_key) Determine whether a namespace has dense formatting.
values(ns_key) Return the allowed values for an enumerated namespace.
get_dtypes(ns_key) Get the dtypes associated with the value and confidence fields for a given namespace.
list_namespaces() Print out a listing of available namespaces

Display

display(annotation[, meta]) Visualize a jams annotation through mir_eval
display_multi(annotations[, fig_kw, meta]) Display multiple annotations with shared axes

Sonification

sonify(annotation[, sr, duration]) Sonify a jams annotation through mir_eval

Evaluation

beat(ref, est, \*\*kwargs) Beat tracking evaluation
chord(ref, est, \*\*kwargs) Chord evaluation
melody(ref, est, \*\*kwargs) Melody extraction evaluation
onset(ref, est, \*\*kwargs) Onset evaluation
segment(ref, est, \*\*kwargs) Segment evaluation
tempo(ref, est, \*\*kwargs) Tempo evaluation
pattern(ref, est, \*\*kwargs) Pattern detection evaluation
hierarchy(ref, est, \*\*kwargs) Multi-level segmentation evaluation
transcription(ref, est, \*\*kwargs) Note transcription evaluation

Namespace conversion

convert(annotation, target_namespace) Convert a given annotation to the target namespace.

Utility functions

import_lab(namespace, filename[, infer_duration]) Load a .lab file as an Annotation object.
expand_filepaths(base_dir, rel_paths) Expand a list of relative paths to a give base directory.
smkdirs(dpath[, mode]) Safely make a full directory path if it doesn’t exist.
filebase(filepath) Return the extension-less basename of a file path.
find_with_extension(in_dir, ext[, depth, sort]) Naive depth-search into a directory for files with a given extension.