Beispiel #1
0
 def test_cut_audio_mask(self):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               recording=Mock(sampling_rate=16000))
     mask = cut.supervisions_audio_mask()
     assert mask.sum() == 0
Beispiel #2
0
 def test_cut_audio_mask(self, supervisions):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               recording=Mock(sampling_rate=16000),
               supervisions=supervisions)
     mask = cut.supervisions_audio_mask()
     assert (mask[:8000] == 1).all()
     assert (mask[8000:] == 0).all()
Beispiel #3
0
 def test_cut_audio_mask(self, supervisions, alignment):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               recording=Mock(sampling_rate=16000),
               supervisions=supervisions)
     mask = cut.supervisions_audio_mask(use_alignment_if_exists=alignment)
     if alignment == "word":
         ones = np.index_exp[list(
             chain(range(0, 1600), range(3200, 6400), range(9600, 12800)))]
         zeros = np.index_exp[list(
             chain(range(1600, 3200), range(6400, 9600),
                   range(12800, 32000)))]
     else:
         ones = np.index_exp[list(chain(range(0, 8000), range(9600,
                                                              12800)))]
         zeros = np.index_exp[list(
             chain(range(8000, 9600), range(12800, 32000)))]
     assert (mask[ones] == 1).all()
     assert (mask[zeros] == 0).all()