Repository: mir-dataset-loaders/mirdata

Issue:
Tempo description missing from datasets table
(my fault, introduced in #207 !)

The table of datasets is missing documentation for "tempo", which is referenced in groove_midi
https://mirdata.readthedocs.io/en/latest/source/datasets.html


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/mir-dataset-loaders/mirdata/pull/232?src=pr&el=h1) Report
> Merging [#232](https://codecov.io/gh/mir-dataset-loaders/mirdata/pull/232?src=pr&el=desc) into [master](https://codecov.io/gh/mir-dataset-loaders/mirdata/commit/bfbe6ccafaf87d85dbd213f1da2bcb2be3e19e9f&el=desc) will **not change** coverage by `%`.
> The diff coverage is `n/a`.


```diff
@@           Coverage Diff           @@
##           master     #232   +/-   ##
=======================================
  Coverage   95.91%   95.91%           
=======================================
  Files          20       20           
  Lines        2080     2080           
=======================================
  Hits         1995     1995           
  Misses         85       85           
```

lostanlen: Very nice. While you're at it, perhaps you can close #220? i.e. rename the `groove_midi.Track.bpm` property into `.tempo`


lostanlen: huh, so sorry. i don't know why i keep closing PRs inadvertently
rabitt: > Very nice. While you're at it, perhaps you can close #220? i.e. rename the `groove_midi.Track.bpm` property into `.tempo`? In this way, we have three datasets using the same name for the same thing.

Sure - I assume you mean #221 ?
lostanlen: yes, sorry #221 . tempo vs bpm
magdalenafuentes: Just related comment: noticed `rwc_popular` is denoted as `rwc_popular_` in the table, that's wrong right? 

Patch:
diff --git a/docs/source/datasets.rst b/docs/source/datasets.rst
index ad7daf4..f58837a 100644
--- a/docs/source/datasets.rst
+++ b/docs/source/datasets.rst
@@ -33,8 +33,8 @@ click the link provided in the "Module" column.
 | dali_            | DALI                | - audio: 📺         | - :ref:`lyrics`           | 5358   |
 |                  |                     | - annotations: ✅   | - Vocal :ref:`notes`      |        |
 +------------------+---------------------+---------------------+---------------------------+--------+
-| groove_midi_     | Groove MIDI         | - audio: ✅         | - :ref:`beats`            | 1150   |
-|                  | Dataset             | - midi: ✅          | - :ref:`tempo`            |        |
+| groove_midi_     | | Groove MIDI       | - audio: ✅         | - :ref:`beats`            | 1150   |
+|                  | | Dataset           | - midi: ✅          | - :ref:`tempo`            |        |
 |                  |                     |                     | - :ref:`drums`            |        |
 +------------------+---------------------+---------------------+---------------------------+--------+
 | gtzan_genre_     | Gtzan-Genre         | - audio: ✅         | - :ref:`genre`            | 1000   |
@@ -45,6 +45,7 @@ click the link provided in the "Module" column.
 |                  |                     |                     | - :ref:`key`              |        |
 |                  |                     |                     | - :ref:`notes`            |        |
 |                  |                     |                     | - :ref:`f0`               |        |
+|                  |                     |                     | - :ref:`tempo`            |        |
 +------------------+---------------------+---------------------+---------------------------+--------+
 | ikala_           | iKala               | - audio: ❌         | - Vocal :ref:`F0`         | 252    |
 |                  |                     | - annotations: ❌   | - :ref:`lyrics`           |        |
@@ -71,6 +72,7 @@ click the link provided in the "Module" column.
 |                  |                     | - annotations: ✅   | - :ref:`sections`         |        |
 |                  |                     |                     | - :ref:`vocal-activity`   |        |
 |                  |                     |                     | - :ref:`chords`           |        |
+|                  |                     |                     | - :ref:`tempo`            |        |
 +------------------+---------------------+---------------------+---------------------------+--------+
 | salami_          | Salami              | - audio: ❌         | - :ref:`sections`         | 1359   |
 |                  |                     | - annotations: ✅   |                           |        |
@@ -94,7 +96,7 @@ the dataset specific documentation to ensure the data is as you expect.
 
 Beats
 ^^^^^
-Musical beats, typically encoded as sequence of time stamps and corresponding beat positions.
+Musical beats, typically encoded as sequence of timestamps and corresponding beat positions.
 This implicitly includes *downbeat* information (the beginning of a musical measure).
 
 .. _chords:
@@ -118,7 +120,7 @@ one another, as multiple drums can be played at the same time.
 F0
 ^^
 Musical pitch contours, typically encoded as time series indidcating the musical pitch over time.
-The time series typically have evenly spaced time stamps, each with a correspoinding pitch value
+The time series typically have evenly spaced timestamps, each with a correspoinding pitch value
 which may be encoded in a number of formats/granularities, including midi note numbers and Hertz.
 
 .. _genre:
@@ -166,6 +168,14 @@ Musical note events, typically encoded as sequences of start time, end time, lab
 indicates a musical pitch, which may be in a number of formats/granularities, including midi note numbers,
 Hertz, or pitch class.
 
+.. _sections:
+
+Sections
+^^^^^^^^
+Musical sections, which may be "flat" or "hierarchical", typically encoded by a sequence of
+timestamps indicating musical section boundary times. Section annotations sometimes also
+include labels for sections, which may indicate repetitions and/or the section type (e.g. Chorus, Verse).
+
 .. _technique:
 
 Technique
@@ -173,13 +183,14 @@ Technique
 The playing technique used by a particular instrument, for example "Pizzicato". This label may be global
 for a given recording or encoded as a sequence of labeled events.
 
-.. _sections:
+.. _tempo:
 
-Sections
-^^^^^^^^
-Musical sections, which may be "flat" or "heirarchical", typically encoded by a sequence of
-time stamps indicating musical section boundary times. Section annotations sometimes also
-include labels for sections, which may indicate repetitions and/or the section type (e.g. Chorus, Verse).
+Tempo
+^^^^^
+The tempo of a song, typical in units of beats-per-minute (bpm). This is often indicated globally per track,
+but in practice tracks may have tempos that change, and some datasets encode tempo as time-varying quantity.
+Additionally, there may be multiple reasonable tempos at any given time (for example, often 2x or 0.5x a
+tempo value will also be "correct"). For this reason, some datasets provide two or more different tempo values.
 
 .. _vocal-activity:
 
@@ -192,6 +203,7 @@ of annotation is implicitly available when Vocal F0_ or Vocal Notes_ annotations
 .. _article: https://link.springer.com/article/10.1007/s10844-013-0250-y
 .. _beatles: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.beatles
 .. _dali: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.dali
+.. _groove_midi: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.groove_midi
 .. _gtzan_genre: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.gtzan_genre
 .. _guitarset: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.guitarset
 .. _ikala: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.ikala
@@ -204,7 +216,7 @@ of annotation is implicitly available when Vocal F0_ or Vocal Notes_ annotations
 .. _rwc_pop: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.rwc_pop
 .. _salami: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.salami
 .. _tinysol: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.tinysol
-.. _groove_midi: https://mirdata.readthedocs.io/en/latest/source/mirdata.html#module-mirdata.groove_midi
+
 
 
 
diff --git a/mirdata/groove_midi.py b/mirdata/groove_midi.py
index cdc0fe9..a08022b 100644
--- a/mirdata/groove_midi.py
+++ b/mirdata/groove_midi.py
@@ -204,7 +204,7 @@ def _load_metadata(data_home):
                 'session': str(session),
                 'track_id': str(track_id),
                 'style': str(style),
-                'bpm': int(bpm),
+                'tempo': int(bpm),
                 'beat_type': str(beat_type),
                 'time_signature': str(time_signature),
                 'midi_filename': str(midi_filename),
@@ -234,7 +234,7 @@ class Track(track.Track):
         session (str): Type of session  (ex. 'session1', 'eval_session')
         track_id (str): track id of the track (ex. 'drummer1/eval_session/1')
         style (str): Style (genre, groove type) of the track (ex. 'funk/groove1')
-        bpm (int): Track bpm (ex. 138)
+        tempo (int): Track tempo in beats per minute (ex. 138)
         beat_type (str): Whether the track is a beat or a fill (ex. 'beat')
         time_signature (str): Time signature of the track (ex. '4-4', '6-8')
         midi_path (str): Path to the midi file
@@ -266,7 +266,7 @@ class Track(track.Track):
                 "drummer": None,
                 "session": None,
                 "style": None,
-                "bpm": None,
+                "tempo": None,
                 "beat_type": None,
                 "time_signature": None,
                 "midi_filename": None,
@@ -278,7 +278,7 @@ class Track(track.Track):
         self.drummer = self._track_metadata["drummer"]
         self.session = self._track_metadata["session"]
         self.style = self._track_metadata["style"]
-        self.bpm = self._track_metadata["bpm"]
+        self.tempo = self._track_metadata["tempo"]
         self.beat_type = self._track_metadata["beat_type"]
         self.time_signature = self._track_metadata["time_signature"]
         self.duration = self._track_metadata["duration"]
@@ -331,7 +331,7 @@ class Track(track.Track):
         # Initialize top-level JAMS container
         return jams_utils.jams_converter(
             beat_data=[(self.beats, 'midi beats')],
-            tempo_data=[(self.bpm, 'midi tempo')],
+            tempo_data=[(self.tempo, 'midi tempo')],
             event_data=[(self.drum_events, 'annotated drum patterns')],
             metadata=self._track_metadata,
         )


Test patch:
diff --git a/tests/test_groove_midi.py b/tests/test_groove_midi.py
index a64a06a..f9f70e7 100644
--- a/tests/test_groove_midi.py
+++ b/tests/test_groove_midi.py
@@ -15,7 +15,7 @@ def test_track():
         'session': 'drummer1/eval_session',
         'track_id': 'drummer1/eval_session/1',
         'style': 'funk/groove1',
-        'bpm': 138,
+        'tempo': 138,
         'beat_type': 'beat',
         'time_signature': '4-4',
         'midi_filename': 'drummer1/eval_session/1_funk-groove1_138_beat_4-4.mid',
@@ -68,7 +68,7 @@ def test_load_metadata():
         'session': 'drummer1/eval_session',
         'track_id': 'drummer1/eval_session/1',
         'style': 'funk/groove1',
-        'bpm': 138,
+        'tempo': 138,
         'beat_type': 'beat',
         'time_signature': '4-4',
         'midi_filename': 'drummer1/eval_session/1_funk-groove1_138_beat_4-4.mid',