Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f0s_to_jams is not compliant with pitch_contour namespace #217

Closed
lostanlen opened this issue Apr 7, 2020 · 0 comments · Fixed by #212
Closed

f0s_to_jams is not compliant with pitch_contour namespace #217

lostanlen opened this issue Apr 7, 2020 · 0 comments · Fixed by #212
Labels
bug Something isn't working
Milestone

Comments

@lostanlen
Copy link
Collaborator

The function jams_utils.f0s_to_jams produces a jam object whose Annotation is marked as pitch_contour. However, this Annotation is not compliant with the official pitch_contour namespace of JAMS. The consequence is that orchset Tracks cannot be exported to JAMS.

Minimal non-working example:

from mirdata import orchset

X = orchset.load()
keys = list(X.keys())
key = keys[0]
jam = X[key].to_jams()
jam.validate()

Result:

---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
~/miniconda3/lib/python3.7/site-packages/jams/core.py in validate(self, strict)
   1807         try:
-> 1808             schema.VALIDATOR.validate(self.__json_light__, schema.JAMS_SCHEMA)
   1809 

~/miniconda3/lib/python3.7/site-packages/jsonschema/validators.py in validate(self, *args, **kwargs)
    352             for error in self.iter_errors(*args, **kwargs):
--> 353                 raise error
    354 

ValidationError: None is not of type 'number'

Failed validating 'type' in schema['properties']['file_metadata']['properties']['duration']:
    {'minimum': 0.0, 'type': 'number'}

On instance['file_metadata']['duration']:
    None

During handling of the above exception, another exception occurred:

SchemaError                               Traceback (most recent call last)
<ipython-input-2-dbd09b7b0fbe> in <module>
----> 1 jam.validate()

~/miniconda3/lib/python3.7/site-packages/jams/core.py in validate(self, strict)
   1821         except jsonschema.ValidationError as invalid:
   1822             if strict:
-> 1823                 raise SchemaError(str(invalid))
   1824             else:
   1825                 warnings.warn(str(invalid))

SchemaError: None is not of type 'number'

Failed validating 'type' in schema['properties']['file_metadata']['properties']['duration']:
    {'minimum': 0.0, 'type': 'number'}

On instance['file_metadata']['duration']:
    None

It appears that the values in the Annotation of f0s_to_jams are of type float, as they describe the frequency in Hertz.
However, pitch_contour values are supposed to be triplets: (index, frequency, voicing).
Note that voicing is boolean ... this is pre-Bittner and Bosch ISMIR 2019 ;)

@lostanlen lostanlen added the bug Something isn't working label Apr 7, 2020
rabitt pushed a commit that referenced this issue Apr 7, 2020
… adds duration to most to_jams() methods; uses jams_converter in gtzan_genre
rabitt pushed a commit that referenced this issue Apr 8, 2020
* fix GTZAN capitalization in docstring

* Implement gtzan_genre.Track.to_jams

* black -S . gtzan_genre

* test JAMS parser for GTZAN

* import jams in gtzan_genre

* import mirdata in gtzan_genre

* define VERSION and ANNOTATION_RULES for gtzan_genre

* fixes #217; adds test that jams validation succeeds for all datasets; adds duration to most to_jams() methods; uses jams_converter in gtzan_genre

* run black

* update tags_data to tags_gtzan_data

authored-by: Rachel Bittner <rmb456@nyu.edu>
@rabitt rabitt added this to the 0.2.0 milestone Apr 10, 2020
nkundiushuti pushed a commit that referenced this issue Nov 4, 2020
 
gtzan_genre.Track.to_jams (#212)

* fix GTZAN capitalization in docstring

* Implement gtzan_genre.Track.to_jams

* black -S . gtzan_genre

* test JAMS parser for GTZAN

* import jams in gtzan_genre

* import mirdata in gtzan_genre

* define VERSION and ANNOTATION_RULES for gtzan_genre

* fixes #217; adds test that jams validation succeeds for all datasets; adds duration to most to_jams() methods; uses jams_converter in gtzan_genre

* run black

* update tags_data to tags_gtzan_data

authored-by: Rachel Bittner <rmb456@nyu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants