Skip to content

Commit

Permalink
added time stretch test
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Oct 19, 2015
1 parent c1a5703 commit 62d62fc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_pyrb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
# -*- encoding: utf-8 -*-

import pyrubberband
import numpy as np

def test_stretch():

sr = 8000
duration = 5
y = np.zeros(sr * duration)

def __test(rate):
y_s = pyrubberband.time_stretch(y, sr, rate=rate)

assert np.allclose(rate * len(y_s), len(y))

for rate in [0.5, 1.0, 2.0]:
yield __test, rate

0 comments on commit 62d62fc

Please sign in to comment.