-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdf2c26
commit 71c7ad3
Showing
6 changed files
with
617 additions
and
107 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# This file is required to make Python treat the directories as containing packages | ||
__doc__ = "A Python Wrapprer of the Signalsmith Stretch C++ library for pitch and time stretching" | ||
__doc__ = "A simple python library for pitch shifting and time stretching" | ||
__version__ = "0.2.0" | ||
|
||
from . import Signalsmith |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import python_stretch as m | ||
import numpy as np | ||
|
||
def test_mono(): | ||
x1 = np.random.rand(1, 44100) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTransposeSemitones(12) | ||
|
||
y1 = ps.process(x1) | ||
del ps | ||
assert y1.shape == (1, 44100) | ||
|
||
def test_stereo(): | ||
x1 = np.random.rand(2, 44100) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTransposeSemitones(12) | ||
|
||
y1 = ps.process(x1) | ||
del ps | ||
assert y1.shape == (2, 44100) | ||
|
||
def test_multichannel(): | ||
nChannels = np.random.randint(3, 10) | ||
x1 = np.random.rand(nChannels, 44100) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTransposeSemitones(12) | ||
|
||
y1 = ps.process(x1) | ||
del ps | ||
|
||
assert y1.shape == (nChannels, 44100) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import python_stretch as m | ||
import numpy as np | ||
|
||
def test_mono_double_length(): | ||
x1 = np.random.rand(1,44100) | ||
x2 = np.random.rand(1,22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(0.5) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (1, 88200) | ||
assert y2.shape == (1, 44100) | ||
|
||
def test_mono_half_length(): | ||
x1 = np.random.rand(1,44100) | ||
x2 = np.random.rand(1,22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(2.) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (1, 22050) | ||
assert y2.shape == (1, 11025) | ||
|
||
def test_stereo_double_length(): | ||
x1 = np.random.rand(2,44100) | ||
x2 = np.random.rand(2,22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(0.5) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (2, 88200) | ||
assert y2.shape == (2, 44100) | ||
|
||
def test_stereo_half_length(): | ||
x1 = np.random.rand(2,44100) | ||
x2 = np.random.rand(2,22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(2.) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (2, 22050) | ||
assert y2.shape == (2, 11025) | ||
|
||
def test_multichannel_double_length(): | ||
n_channels = np.random.randint(3, 10) | ||
x1 = np.random.rand(n_channels, 44100) | ||
x2 = np.random.rand(n_channels, 22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(0.5) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (n_channels, 88200) | ||
assert y2.shape == (n_channels, 44100) | ||
|
||
def test_multichannel_half_length(): | ||
n_channels = np.random.randint(3, 10) | ||
x1 = np.random.rand(n_channels, 44100) | ||
x2 = np.random.rand(n_channels, 22050) | ||
|
||
ps = m.Signalsmith.Stretch() | ||
ps.setTimeFactor(2.) | ||
|
||
y1 = ps.process(x1) | ||
y2 = ps.process(x2) | ||
del ps | ||
|
||
assert y1.shape == (n_channels, 22050) | ||
assert y2.shape == (n_channels, 11025) |