def test_holophonor_play():
    h1 = noise.Holophonor()
    h1.next_notes([("1:1", 1, 0.2), ("2:1", 0.5, 0.8)])
    hwave = h1.play()
    wave1 = noise.StutterNote(65, 0.2, 1).play()
    wave2 = noise.StutterNote(130, 0.8, 0.5).play()
    np.testing.assert_allclose(hwave[:len(wave1) - 10],
                               wave1[:-10],
                               atol=0.0001)
    np.testing.assert_allclose(hwave[-len(wave2) + 10:],
                               wave2[10:],
                               atol=0.0001)
def test_stutter_note_add():
    sn1 = noise.StutterNote(100, 1, 1)
    n1 = noise.Note([noise.SimpleWave(400, 1, 2)])
    n2 = sn1 + n1
    waves = n2.get_waves()
    assert waves[:-1] == sn1.get_waves()
    assert waves[-1:] == n1.get_waves()
Пример #3
0
def test_stutter_note_get_waves():
    sn1 = noise.StutterNote(100, 1, 1)
    waves = sn1.get_waves()
    for wave in waves:
        assert abs(wave.get_duration() - 1 / 40) < 0.0001
    for wave in waves[::2]:
        assert wave.play().max() == 0
        assert wave.play().min() == 0
def test_stutter_note_get_waves():
    sn1 = noise.StutterNote(100, 1, 1)
    waves = sn1.get_waves()
    for wave in waves:
        assert abs(wave.get_duration() - 1 / 40) < 0.0001
    if waves[0].play().max() == 0:
        sl = slice(None, None, 2)
    else:
        sl = slice(1, None, 2)
    for wave in waves[sl]:
        assert wave.play().max() == 0
        assert wave.play().min() == 0
def test_stutter_note_play():
    sn1 = noise.StutterNote(100, 2, 0.5)
    sn1.amplitude = 0.1
    assert sn1.play().max() <= 0.1
    assert sn1.play().min() >= -0.1
def test_stutter_note_get_duration():
    sn1 = noise.StutterNote(100, 9.1, 1)
    assert abs(sn1.get_duration() - 9.1) < 0.0001