def test_baliset_play(): b1 = noise.Baliset() b1.next_notes([("1:1", 1, 0.2), ("2:1", 0.5, 0.8)]) bwave = b1.play() wave1 = noise.SawtoothWave(196, 0.2, 1).play() wave2 = noise.SawtoothWave(392, 0.8, 0.5).play() np.testing.assert_allclose(bwave[:len(wave1) - 10], wave1[:-10], atol=0.0001) np.testing.assert_allclose(bwave[-len(wave2) + 10:], wave2[10:], atol=0.0001)
def test_baliset_get_duration(): b1 = noise.Baliset() b1.next_notes([("1:1", 1, 0.2), ("3:1", 1, 0.8)]) assert abs(b1.get_duration() - 1) < 0.0001