Skip to content

Commit

Permalink
update in index
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayy24 committed Nov 7, 2024
1 parent d264549 commit 809d3a9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
6 changes: 3 additions & 3 deletions docs/source/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
:target: http://creativecommons.org/publicdomain/zero/1.0/

* - BRID
- - audio:
- annotations:
- - audio:
- annotations:
- - :ref:`beats`
- :ref:`tempo`
- 35
- 367
- .. image:: https://licensebuttons.net/l/by-nc-sa/4.0/80x15.png
:target: https://creativecommons.org/licenses/by-nc-sa/4.0

Expand Down
36 changes: 19 additions & 17 deletions mirdata/datasets/brid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**Dataset Overview:**
BRID comprises a total of 35 tracks, averaging about 30 seconds each, amounting to approximately 2 hours and 57 minutes of music. These tracks include recordings of various Brazilian instruments, played in different Brazilian rhythmic styles.
BRID comprises a total of 367 tracks, averaging about 30 seconds each, amounting to approximately 2 hours and 57 minutes of music. These tracks include recordings of various Brazilian instruments, played in different Brazilian rhythmic styles.
**Instruments and Rhythms:**
Expand Down Expand Up @@ -41,7 +41,7 @@
import numpy as np
from typing import BinaryIO, Optional, TextIO, Tuple

from mirdata import annotations, core, io, jams_utils
from mirdata import annotations, core, download_utils, io, jams_utils


BIBTEX = """
Expand All @@ -58,30 +58,33 @@
"test": "sample",
"1.0": core.Index(
filename="brid_full_index_1.0.json",
url="https://zenodo.org/records/14048016/files/brid_full_index_1.0.json?download=1",
checksum="18701a7b6c20e549c0394bbd80c01699",
url="https://zenodo.org/records/14052434/files/brid_full_index_1.0.json?download=1",
checksum="6292a6d36d6ae267534107f4e5f6bcca",
),
"sample": core.Index(filename="brid_full_index_1.0_sample.json"),
}


REMOTES = None
REMOTES = {
"annotations": download_utils.RemoteFileMetadata(
filename="annotations.zip",
url="https://zenodo.org/records/14051323/files/annotations.zip?download=1",
checksum="678b2fa99c8d220cddd9f5e20d55d0c1",
destination_dir="BRID_1.0",
),
"audio": download_utils.RemoteFileMetadata(
filename="audio.zip",
url="https://zenodo.org/records/14051323/files/audio.zip?download=1",
checksum="3514b53d66515181f95619adb71a59b4",
destination_dir="BRID_1.0",
),
}


LICENSE_INFO = (
"Creative Commons Attribution Non Commercial Share Alike 4.0 International."
)

DOWNLOAD_INFO = """
Unfortunately the BRID dataset is not available for download.
If you have the BRID dataset, place the contents into a folder called
BRID with the following structure:
> BRID_1.0/
> audio/
> annotations/beats
> annotations/tempo
and copy the BRID folder to {}
"""


class Track(core.Track):
"""BRID Rhythm class
Expand Down Expand Up @@ -230,5 +233,4 @@ def __init__(self, data_home=None, version="default"):
indexes=INDEXES,
remotes=REMOTES,
license_info=LICENSE_INFO,
download_info=DOWNLOAD_INFO,
)
20 changes: 11 additions & 9 deletions scripts/make_brid_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,28 @@ def make_brid_rhythm_index(dataset_data_path):
beat_file = f"{idx}.beats"
tempo_file = f"{idx}.bpm"

relative_beat_path = os.path.join("Annotations", "beats", beat_file)
relative_tempo_path = os.path.join("Annotations", "tempo", tempo_file)
# Set relative paths to None if files do not exist
relative_beat_path = os.path.join("Annotations", "beats", beat_file) if os.path.exists(os.path.join(beats_path, beat_file)) else None
relative_tempo_path = os.path.join("Annotations", "tempo", tempo_file) if os.path.exists(os.path.join(tempo_path, tempo_file)) else None


# Check if annotation files exist
beat_file_path = os.path.join(beats_path, beat_file)
tempo_file_path = os.path.join(tempo_path, tempo_file)
beat_file_path = os.path.join(beats_path, beat_file) if relative_beat_path else None
tempo_file_path = os.path.join(tempo_path, tempo_file) if relative_tempo_path else None

# Add track information to index
cmr_index["tracks"][idx] = {
"audio": (
os.path.join(dataset_folder_name, relative_audio_path),
md5(os.path.join(root, filename)),
),
"beats": (
os.path.join(dataset_folder_name, relative_beat_path),
md5(beat_file_path) if os.path.exists(beat_file_path) else None,
os.path.join(dataset_folder_name, relative_beat_path) if relative_beat_path else None,
md5(beat_file_path) if beat_file_path else None,
),
"tempo": (
os.path.join(dataset_folder_name, relative_tempo_path),
md5(tempo_file_path) if os.path.exists(tempo_file_path) else None,
os.path.join(dataset_folder_name, relative_tempo_path) if relative_tempo_path else None,
md5(tempo_file_path) if tempo_file_path else None,
)
}

Expand Down

0 comments on commit 809d3a9

Please sign in to comment.