def test_load_sound(self): s1 = Sound.from_file(self.audio_file) y, sr = librosa.load(self.audio_file) s2 = Sound(y, sr) self.assertTrue(numpy.all(s1.y == s2.y)) s3 = Sound(numpy.random.rand(random.randint(1, 100000)), random.choice((88200, 44100, 22050, 11025)))
def setUp(self): self.s1 = Sound.from_file(example_audio_file()) freq, dt, sr = 440.0, 10.0, 22050 t = numpy.linspace(0, dt, sr * dt) self.s2 = Sound(numpy.sin(2 * numpy.pi * freq * t), sr) self.sounds = [self.s1, self.s2]
def setUp(self): self.s1 = Sound.from_file(example_audio_file()) freq, dt, sr = 440.0, 10.0, 22050 t = numpy.linspace(0, dt, sr * dt) self.s2 = Sound(numpy.sin(2 * numpy.pi * freq * t), sr) self.sounds = [self.s1, self.s2, copy.deepcopy(self.s1)] self.sampler = Sampler(backend='dummy')