Registry / serialization / jams
library0.3.5pypypi✓ verified 84d ago

JAMS is a Python library implementing a JSON-based music annotation format, providing a formal schema for generic annotations. It allows for storing multiple annotations per file and includes schema definitions for a wide range of annotation types like beats, chords, segments, and tags. The library also features error detection, validation, and a translation layer to interface with `mir_eval` for evaluating annotations. It is actively maintained, with the current version being 0.3.5, and supports recent Python versions.

pip install jams
INSTALL
IMPORT
SIG · JAMS
J
jams
serializationpythonv0.3.5
Install
12.2s avg
Import
3659ms
Disk
311MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 3.767s · 311.5MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 12.2s · import 3.551s · 298MB
311MB installed
● package 311MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JAMS
import jams jam = jams.JAMS()
The primary container for all JAMS data.
Annotation
import jams annotation = jams.Annotation(namespace='beat')
Represents a single annotation layer within a JAMS object.
AnnotationMetadata
import jams metadata = jams.AnnotationMetadata(data_source='my_source')
Metadata pertaining to a specific annotation.
FileMetadata
import jams file_meta = jams.FileMetadata(duration=120.0)
Metadata for the audio file itself.

This quickstart demonstrates how to create a `jams.JAMS` object, populate its `file_metadata`, and add `Annotation` objects for 'beat' and 'tempo'. It shows how to add individual observations to annotations and structure the metadata. The example uses placeholder values to avoid external dependencies like `librosa` for initial setup.

import jams import os # Create a new JAMS object jam = jams.JAMS() # Set file metadata jam.file_metadata.duration = 180.0 # Example duration in seconds jam.file_metadata.title = 'Example Track' jam.file_metadata.artist = 'Example Artist' # Create a new Annotation for beats beat_annotation = jams.Annotation(namespace='beat') beat_annotation.annotation_metadata = jams.AnnotationMetadata( data_source='manual annotation', curator=jams.Curator(name='AI Assistant') ) # Add some example beat observations beat_annotation.append(time=0.5, duration=0.0) beat_annotation.append(time=1.0, duration=0.0) beat_annotation.append(time=1.5, duration=0.0) # Add the beat annotation to the JAMS object jam.annotations.append(beat_annotation) # Create a new Annotation for tempo tempo_annotation = jams.Annotation(namespace='tempo', time=0, duration=jam.file_metadata.duration) tempo_annotation.annotation_metadata = jams.AnnotationMetadata( data_source='estimated', curator=jams.Curator(name='AI Assistant') ) tempo_annotation.append(time=0.0, duration=jam.file_metadata.duration, value=120.0, confidence=1.0) # Add the tempo annotation to the JAMS object jam.annotations.append(tempo_annotation) # Print the JAMS object (its __repr__ is quite informative) print(jam) # Optionally save to a .jams file # jam.save('example.jams') # To load: # loaded_jam = jams.load('example.jams')
Debug
Known issues
breakingThe `JamsFrame` class was removed in version 0.3.0 in favor of a simpler observation storage structure. Code directly using `pandas.DataFrame` methods on `Annotation.data` will break.
fix
Migrate to directly manipulating `Annotation` objects and using methods like `Annotation.to_interval_values()` or `Annotation.to_dataframe()` for DataFrame conversion when needed. The underlying data structure is now simpler, and direct observation handling is preferred.
affects: >=0.3.0
breakingThe behavior of `jams.import_lab()` changed in version 0.3.0. It now returns a single `Annotation` object instead of constructing and returning a full `JAMS` object.
fix
Adjust code that expects a full `JAMS` object from `import_lab` to handle the returned `Annotation` object. You may need to create a `JAMS` object manually and append the imported `Annotation`.
affects: >=0.3.0
gotchaInternal changes in v0.3.5 migrated from the deprecated `imp` package to `importlib` and replaced `np.float_` with `np.float64`. While primarily internal, advanced users interacting with JAMS's internals or specific numerical types might observe changes.
fix
Ensure your environment uses modern Python 3, and generally avoid direct reliance on internal implementation details. If working with numerical types exposed by JAMS, prefer `numpy.float64` for consistency.
affects: >=0.3.5
gotchaStarting from version 0.3.4, `jams` explicitly requires `jsonschema >= 3.0` (and `numpy >= 1.20.0`, `pandas >= 1.2.0`, `mir_eval >= 0.8.2`, `sortedcontainers >= 2.1.0`, `decorator` as per v0.3.5 `setup.cfg`). Using older versions of these dependencies might lead to validation or runtime issues.
fix
Upgrade `jsonschema` and other core dependencies (numpy, pandas, mir_eval, sortedcontainers, decorator) to the specified versions or newer to ensure compatibility and proper functionality.
affects: >=0.3.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'jams'
The 'jams' library is not installed in your Python environment or the environment where your script is being run.
fix
Run `pip install jams` in your terminal to install the library.
ParameterError: Unknown JAMS extension format: "jams"
This error typically occurs when `jams.load()` encounters a JAMS file that is corrupted, uses an unrecognized internal format, or has a file extension that leads the loader to misinterpret its structure.
fix
Ensure your JAMS file is valid and consistent with the expected schema for your `jams` library version. If the issue persists, try validating the JAMS file with `jams.validate()` or inspect the file for corruption.
NamespaceError: Unknown namespace: 'segment_isophonics'
You are attempting to create or access a JAMS annotation using a namespace (e.g., 'segment_isophonics') that is not defined or has been deprecated in the version of the `jams` library you are using.
fix
Consult the `jams` library's documentation or the `jams.schema` module to find a list of valid and current namespaces. For example, 'segment_isophonics' was renamed to 'segment_open'. Update your code to use a recognized namespace.
AttributeError: 'Annotation' object has no attribute 'value'
You are trying to directly access or set an attribute (like 'value' or 'confidence') on a `jams.Annotation` object, but that specific attribute is not available for the annotation's defined namespace or is handled through specific methods like `append()`.
fix
Instead of direct assignment, use the `append()` method to add data to an annotation, passing `value` as a keyword argument if the namespace supports it (e.g., `annotation.append(time=..., duration=..., value=...)`). Always refer to the schema for the specific namespace to understand its data structure.
Upgrade
Version history
0.3.5latest on PyPI · released Jun 18, 2025
Audit
Dependencies
numpyrequiredCore numerical operations for data storage.
jsonschemarequiredUsed for validation of JAMS objects against their schema.
pandasrequiredProvides DataFrame capabilities for structured data handling (though JamsFrame was removed, Annotation can convert to DataFrame).
mir_evalrequiredProvides evaluation metrics for music information retrieval tasks, integrated with JAMS for annotation evaluation.
sortedcontainersrequiredData structure for efficient sorted collections.
decoratorrequiredUsed for decorator utility functions.
librosaoptionalCommonly used for audio analysis in examples; not a strict runtime dependency for JAMS itself.
Agent activity
9 hits · last 30 days
node
8
Resources