Exemple #1
0
    def test_default(self):
        activations = np.array([[0.0, 1.0, 1.0, 0.4], [0.5, 0.9, 0.9, 0.7],
                                [1.0, 0.8, 0.8, 0.8]])
        mtrack = MultiTrack('Phoenix_ScotchMorris')
        stem_idx_list = [1, 2, 3]
        A.write_activations_to_csv(mtrack, activations, stem_idx_list)
        self.assertTrue(os.path.exists(mtrack.activation_conf_fpath))

        os.remove(mtrack.activation_conf_fpath)
Exemple #2
0
 def setUp(self):
     self.mtrack = MultiTrack("TablaBreakbeatScience_Animoog")
     self.melody1 = np.array([[0.0, 0.0], [1.0, 440.0], [2.0, 450.0],
                              [3.0, 460.0], [4.0, 0.0]])
     self.melody2 = np.array([[0.0, 430.0], [1.0, 440.0], [2.0, 450.0],
                              [3.0, 460.0], [4.0, 0.0]])
     self.melody3 = np.array([[0.0, 0.0, 120.0], [1.0, 440.0, 0.0],
                              [2.0, 450.0, 0.0], [3.0, 460.0, 234.1],
                              [4.0, 0.0, 123.1]])
Exemple #3
0
    def test_defaults(self):
        mtrack = MultiTrack('LizNelson_Rainfall')
        C, actual_index = A.compute_activation_confidence(mtrack)
        actual_shape = C.shape
        expected_shape = (6135, 6)
        self.assertEqual(expected_shape, actual_shape)

        expected_index = [1, 2, 3, 4, 5]
        self.assertEqual(expected_index, actual_index)
 def test_rankings(self):
     for track in self.track_list:
         mtrack = MultiTrack(track)
         rankings = list(mtrack.melody_rankings.values())
         # test that there are no duplicate rankings
         self.assertTrue(len(rankings) == len(set(rankings)))
         # test that rankings start at 1 and go up by step
         self.assertTrue(
             sorted(rankings) == list(range(1,
                                            len(rankings) + 1)))
Exemple #5
0
    def test_make_mtrack_basedir(self):
        mtrack = MultiTrack('MusicDelta_Rock')

        if os.path.exists(mtrack.audio_path):
            shutil.rmtree(mtrack.audio_path)

        self.assertFalse(os.path.exists(mtrack.audio_path))
        self.assertFalse(os.path.exists(mtrack._stem_dir_path))
        self.assertFalse(os.path.exists(mtrack._raw_dir_path))

        download.make_mtrack_basedir(mtrack)

        self.assertTrue(os.path.exists(mtrack.audio_path))
        self.assertTrue(os.path.exists(mtrack._stem_dir_path))
        self.assertTrue(os.path.exists(mtrack._raw_dir_path))
    def test_melody_annotations(self):
        for track in self.track_list:
            mtrack = MultiTrack(track)
            if not mtrack.has_melody or mtrack.duration is None:
                continue

            generated_melody1 = G.create_melody1_annotation(mtrack)
            actual_melody1 = mtrack.melody1_annotation
            self.assertTrue(
                array_almost_equal(actual_melody1, generated_melody1))

            generated_melody2 = G.create_melody2_annotation(mtrack)
            actual_melody2 = mtrack.melody2_annotation
            self.assertTrue(
                array_almost_equal(actual_melody2, generated_melody2))

            generated_melody3 = G.create_melody3_annotation(mtrack)
            actual_melody3 = mtrack.melody3_annotation
            self.assertTrue(
                array_almost_equal(actual_melody3, generated_melody3))
Exemple #7
0
 def setUp(self):
     self.mtrack = MultiTrack("MusicDelta_Beethoven")
     self.mtrack.duration = 27.371
     self.mtrack_nomel = MultiTrack("TablaBreakbeatScience_Animoog")
Exemple #8
0
 def test_sourceid_names(self):
     for track in self.track_list:
         mtrack = MultiTrack(track)
         print(mtrack.source_id_fpath)
         self.assertTrue(os.path.exists(mtrack.source_id_fpath))
Exemple #9
0
 def test_activation_conf_names(self):
     for track in self.track_list:
         mtrack = MultiTrack(track)
         if not mtrack.has_bleed:
             self.assertTrue(os.path.exists(mtrack.activation_conf_fpath))
Exemple #10
0
 def test_existing(self):
     mtrack = MultiTrack('LizNelson_Rainfall')
     download.download_stem(mtrack, 1)
     self.assertTrue(os.path.exists(mtrack.stems[1].audio_path))
Exemple #11
0
 def test_not_in_tracklist(self):
     mtrack = MultiTrack('MusicDelta_Beethoven')
     mtrack.dataset_version = 'asdf'
     with self.assertRaises(IOError):
         download.download_mix(mtrack)
Exemple #12
0
 def test_existing(self):
     mtrack = MultiTrack('LizNelson_Rainfall')
     download.download_mix(mtrack)
     self.assertTrue(os.path.exists(mtrack.mix_path))
Exemple #13
0
 def test_existing(self):
     mtrack = MultiTrack('LizNelson_Rainfall')
     download._download_metadata(mtrack.track_id, mtrack.dataset_version)
     self.assertTrue(os.path.exists(mtrack.mix_path))