Exemplo n.º 1
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )

        self.beats_path = core.none_path_join(
            [self._data_home, self._track_paths["beat"][0]])
        self.chords_path = os.path.join(self._data_home,
                                        self._track_paths["chords"][0])
        self.keys_path = core.none_path_join(
            [self._data_home, self._track_paths["keys"][0]])
        self.sections_path = os.path.join(self._data_home,
                                          self._track_paths["sections"][0])
        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])

        self.title = os.path.basename(
            self._track_paths["sections"][0]).split(".")[0]
Exemplo n.º 2
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )
        self.sections_annotator1_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_uppercase"][0]])
        self.sections_annotator1_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_lowercase"][0]])
        self.sections_annotator2_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_uppercase"][0]])
        self.sections_annotator2_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_lowercase"][0]])

        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])
Exemplo n.º 3
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )

        self.drummer = self._track_metadata.get("drummer")
        self.session = self._track_metadata.get("session")
        self.style = self._track_metadata.get("style")
        self.tempo = self._track_metadata.get("tempo")
        self.beat_type = self._track_metadata.get("beat_type")
        self.time_signature = self._track_metadata.get("time_signature")
        self.duration = self._track_metadata.get("duration")
        self.split = self._track_metadata.get("split")
        self.midi_filename = self._track_metadata.get("midi_filename")
        self.audio_filename = self._track_metadata.get("audio_filename")

        self.midi_path = os.path.join(self._data_home,
                                      self._track_paths["midi"][0])

        self.audio_path = core.none_path_join(
            [self._data_home, self._track_paths["audio"][0]])
Exemplo n.º 4
0
    def __init__(self, track_id, data_home):
        if track_id not in DATA.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in Salami".format(track_id))

        self.track_id = track_id

        self._data_home = data_home
        self._track_paths = DATA.index["tracks"][track_id]
        self.sections_annotator1_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_uppercase"][0]])
        self.sections_annotator1_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_lowercase"][0]])
        self.sections_annotator2_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_uppercase"][0]])
        self.sections_annotator2_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_lowercase"][0]])

        metadata = DATA.metadata(data_home)
        if metadata is not None and track_id in metadata.keys():
            self._track_metadata = metadata[track_id]
        else:
            # annotations with missing metadata
            self._track_metadata = {
                "source": None,
                "annotator_1_id": None,
                "annotator_2_id": None,
                "duration": None,
                "title": None,
                "artist": None,
                "annotator_1_time": None,
                "annotator_2_time": None,
                "class": None,
                "genre": None,
            }
        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])
        self.source = self._track_metadata["source"]
        self.annotator_1_id = self._track_metadata["annotator_1_id"]
        self.annotator_2_id = self._track_metadata["annotator_2_id"]
        self.duration = self._track_metadata["duration"]
        self.title = self._track_metadata["title"]
        self.artist = self._track_metadata["artist"]
        self.annotator_1_time = self._track_metadata["annotator_1_time"]
        self.annotator_2_time = self._track_metadata["annotator_2_time"]
        self.broad_genre = self._track_metadata["class"]
        self.genre = self._track_metadata["genre"]
Exemplo n.º 5
0
 def __init__(
     self,
     track_id,
     data_home,
     dataset_name,
     index,
     metadata,
 ):
     super().__init__(
         track_id,
         data_home,
         dataset_name,
         index,
         metadata,
     )
     # Annotation paths
     self.pitch_path = core.none_path_join(
         [self._data_home, self._track_paths["pitch"][0]])
     self.mb_tags_path = core.none_path_join(
         [self._data_home, self._track_paths["metadata"][0]])
Exemplo n.º 6
0
    def __init__(self, track_id, data_home):
        if track_id not in DATA.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in Beatles".format(track_id))

        self.track_id = track_id

        self._data_home = data_home
        self._track_paths = DATA.index["tracks"][track_id]
        self.beats_path = core.none_path_join(
            [self._data_home, self._track_paths["beat"][0]])
        self.chords_path = os.path.join(self._data_home,
                                        self._track_paths["chords"][0])
        self.keys_path = core.none_path_join(
            [self._data_home, self._track_paths["keys"][0]])
        self.sections_path = os.path.join(self._data_home,
                                          self._track_paths["sections"][0])
        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])

        self.title = os.path.basename(
            self._track_paths["sections"][0]).split(".")[0]
Exemplo n.º 7
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )
        self.sections_annotator1_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_uppercase"][0]])
        self.sections_annotator1_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_1_lowercase"][0]])
        self.sections_annotator2_uppercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_uppercase"][0]])
        self.sections_annotator2_lowercase_path = core.none_path_join(
            [self._data_home, self._track_paths["annotator_2_lowercase"][0]])

        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])
        self.source = self._track_metadata.get("source")
        self.annotator_1_id = self._track_metadata.get("annotator_1_id")
        self.annotator_2_id = self._track_metadata.get("annotator_2_id")
        self.duration = self._track_metadata.get("duration")
        self.title = self._track_metadata.get("title")
        self.artist = self._track_metadata.get("artist")
        self.annotator_1_time = self._track_metadata.get("annotator_1_time")
        self.annotator_2_time = self._track_metadata.get("annotator_2_time")
        self.broad_genre = self._track_metadata.get("class")
        self.genre = self._track_metadata.get("genre")
    def __init__(self, track_id, data_home, remote_index=None, remote_index_name=None):
        if remote_index is not None and remote_index_name is not None:
            data = core.LargeData(remote_index_name, remote_index=remote_index)
        else:
            data = DATA

        if track_id not in data.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in AcousticBrainz genre Dataset".format(
                    track_id
                )
            )

        self.track_id = track_id
        self._data_home = data_home
        self._track_paths = data.index["tracks"][track_id]
        self.path = core.none_path_join([self._data_home, self._track_paths["data"][0]])
Exemplo n.º 9
0
    def __init__(self, track_id, data_home):
        if track_id not in DATA.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in Groove MIDI".format(track_id))

        self.track_id = track_id

        self._data_home = data_home
        self._track_paths = DATA.index["tracks"][track_id]

        metadata = DATA.metadata(data_home)
        if metadata is not None and track_id in metadata:
            self._track_metadata = metadata[track_id]
        else:
            self._track_metadata = {
                "drummer": None,
                "session": None,
                "style": None,
                "tempo": None,
                "beat_type": None,
                "time_signature": None,
                "midi_filename": None,
                "audio_filename": None,
                "duration": None,
                "split": None,
            }

        self.drummer = self._track_metadata["drummer"]
        self.session = self._track_metadata["session"]
        self.style = self._track_metadata["style"]
        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"]
        self.split = self._track_metadata["split"]
        self.midi_filename = self._track_metadata["midi_filename"]
        self.audio_filename = self._track_metadata["audio_filename"]

        self.midi_path = os.path.join(self._data_home,
                                      self._track_paths["midi"][0])

        self.audio_path = core.none_path_join(
            [self._data_home, self._track_paths["audio"][0]])
Exemplo n.º 10
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )

        self.midi_path = os.path.join(self._data_home,
                                      self._track_paths["midi"][0])

        self.audio_path = core.none_path_join(
            [self._data_home, self._track_paths["audio"][0]])
Exemplo n.º 11
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )

        self.path = core.none_path_join([self._data_home, self._track_paths["data"][0]])
        self.genre = [genre for genre in self.track_id.split("#")[4:] if genre != ""]
        self.mbid = self.track_id.split("#")[2]
        self.mbid_group = self.track_id.split("#")[3]
        self.split = self.track_id.split("#")[1]
Exemplo n.º 12
0
    def __init__(
        self,
        track_id,
        data_home,
        dataset_name,
        index,
        metadata,
    ):
        super().__init__(
            track_id,
            data_home,
            dataset_name,
            index,
            metadata,
        )

        # Audio path
        self.audio_path = os.path.join(self._data_home, self._track_paths["audio"][0])

        # Annotation paths
        self.ctonic_path = core.none_path_join(
            [self._data_home, self._track_paths["ctonic"][0]]
        )
        self.pitch_path = core.none_path_join(
            [self._data_home, self._track_paths["pitch"][0]]
        )
        self.tempo_path = core.none_path_join(
            [self._data_home, self._track_paths["tempo"][0]]
        )
        self.sama_path = core.none_path_join(
            [self._data_home, self._track_paths["sama"][0]]
        )
        self.sections_path = core.none_path_join(
            [self._data_home, self._track_paths["sections"][0]]
        )
        self.phrases_path = core.none_path_join(
            [self._data_home, self._track_paths["phrases"][0]]
        )
        self.metadata_path = core.none_path_join(
            [self._data_home, self._track_paths["metadata"][0]]
        )
Exemplo n.º 13
0
    def __init__(self, track_id, data_home):
        if track_id not in DATA.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in Saraga Hindustani".format(
                    track_id))

        self.track_id = track_id

        self._data_home = data_home
        self._track_paths = DATA.index["tracks"][track_id]

        # Audio path
        self.audio_path = os.path.join(self._data_home,
                                       self._track_paths["audio"][0])

        # Annotation paths
        self.ctonic_path = core.none_path_join(
            [self._data_home, self._track_paths["ctonic"][0]])
        self.pitch_path = core.none_path_join(
            [self._data_home, self._track_paths["pitch"][0]])
        self.tempo_path = core.none_path_join(
            [self._data_home, self._track_paths["tempo"][0]])
        self.sama_path = core.none_path_join(
            [self._data_home, self._track_paths["sama"][0]])
        self.sections_path = core.none_path_join(
            [self._data_home, self._track_paths["sections"][0]])
        self.phrases_path = core.none_path_join(
            [self._data_home, self._track_paths["phrases"][0]])
        self.metadata_path = core.none_path_join(
            [self._data_home, self._track_paths["metadata"][0]])

        # Track attributes
        metadata = DATA.metadata(self.metadata_path)
        if (metadata is not None
                and metadata["title"].replace(" ", "_") in self.track_id):
            self._track_metadata = metadata
        else:
            # in case the metadata is missing
            self._track_metadata = {
                "title": None,
                "raags": None,
                "length": None,
                "album_artists": None,
                "forms": None,
                "mbid": None,
                "artists": None,
                "release": None,
                "works": None,
                "taals": None,
                "layas": None,
            }

        self.title = self._track_metadata["title"]
        self.artists = self._track_metadata["artists"]
        self.album_artists = self._track_metadata["album_artists"]
        self.mbid = self._track_metadata["mbid"]
        self.raags = (self._track_metadata["raags"]
                      if "raags" in self._track_metadata.keys() is not None
                      else None)
        self.forms = (self._track_metadata["forms"]
                      if "forms" in self._track_metadata.keys() is not None
                      else None)
        self.release = (self._track_metadata["release"]
                        if "release" in self._track_metadata.keys() is not None
                        else None)
        self.works = (self._track_metadata["works"]
                      if "works" in self._track_metadata.keys() is not None
                      else None)
        self.taals = (self._track_metadata["taals"]
                      if "taals" in self._track_metadata.keys() is not None
                      else None)
        self.layas = (self._track_metadata["layas"]
                      if "layas" in self._track_metadata.keys() is not None
                      else None)
Exemplo n.º 14
0
    def __init__(self, track_id, data_home):
        if track_id not in DATA.index["tracks"]:
            raise ValueError(
                "{} is not a valid track ID in Saraga Carnatic".format(track_id)
            )

        self.track_id = track_id

        self._data_home = data_home
        self._track_paths = DATA.index["tracks"][track_id]

        # Audio path
        self.audio_path = os.path.join(
            self._data_home, self._track_paths["audio-mix"][0]
        )

        # Multitrack audios path
        if self._track_paths["audio-ghatam"][0] is not None:
            self.audio_ghatam_path = os.path.join(
                self._data_home, self._track_paths["audio-ghatam"][0]
            )
        if self._track_paths["audio-mridangam-left"][0] is not None:
            self.audio_mridangam_left_path = os.path.join(
                self._data_home, self._track_paths["audio-mridangam-left"][0]
            )
        if self._track_paths["audio-mridangam-right"][0] is not None:
            self.audio_mridangam_right_path = os.path.join(
                self._data_home, self._track_paths["audio-mridangam-right"][0]
            )
        if self._track_paths["audio-violin"][0] is not None:
            self.audio_violin_path = os.path.join(
                self._data_home, self._track_paths["audio-violin"][0]
            )
        if self._track_paths["audio-vocal-s"][0] is not None:
            self.audio_vocal_s_path = os.path.join(
                self._data_home, self._track_paths["audio-vocal-s"][0]
            )
        if self._track_paths["audio-vocal"][0] is not None:
            self.audio_vocal_path = os.path.join(
                self._data_home, self._track_paths["audio-vocal"][0]
            )

        # Annotation paths
        self.ctonic_path = core.none_path_join(
            [self._data_home, self._track_paths["ctonic"][0]]
        )
        self.pitch_path = core.none_path_join(
            [self._data_home, self._track_paths["pitch"][0]]
        )
        self.pitch_vocal_path = core.none_path_join(
            [self._data_home, self._track_paths["pitch-vocal"][0]]
        )
        self.tempo_path = core.none_path_join(
            [self._data_home, self._track_paths["tempo"][0]]
        )
        self.sama_path = core.none_path_join(
            [self._data_home, self._track_paths["sama"][0]]
        )
        self.sections_path = core.none_path_join(
            [self._data_home, self._track_paths["sections"][0]]
        )
        self.phrases_path = core.none_path_join(
            [self._data_home, self._track_paths["phrases"][0]]
        )
        self.metadata_path = core.none_path_join(
            [self._data_home, self._track_paths["metadata"][0]]
        )

        # Track attributes
        metadata = DATA.metadata(self.metadata_path)
        if (
            metadata is not None
            and metadata["title"].replace(" ", "_") in self.track_id
        ):
            self._track_metadata = metadata
        else:
            # in case the metadata is missing
            self._track_metadata = {
                "raaga": None,
                "form": None,
                "title": None,
                "work": None,
                "length": None,
                "taala": None,
                "album_artists": None,
                "mbid": None,
                "artists": None,
                "concert": None,
            }

        self.title = self._track_metadata["title"]
        self.artists = self._track_metadata["artists"]
        self.album_artists = self._track_metadata["album_artists"]
        self.mbid = self._track_metadata["mbid"]
        self.raaga = (
            self._track_metadata["raaga"]
            if "raaga" in self._track_metadata.keys() is not None
            else None
        )
        self.form = (
            self._track_metadata["form"]
            if "form" in self._track_metadata.keys() is not None
            else None
        )
        self.work = (
            self._track_metadata["work"]
            if "work" in self._track_metadata.keys() is not None
            else None
        )
        self.taala = (
            self._track_metadata["taala"]
            if "taala" in self._track_metadata.keys() is not None
            else None
        )
        self.concert = (
            self._track_metadata["concert"]
            if "concert" in self._track_metadata.keys() is not None
            else None
        )