Skip to content

Commit

Permalink
RIR test updated
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaKh committed Nov 27, 2023
1 parent 78837f0 commit b7f76b6
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions test/test_audio_augmentations.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,23 @@ def test_add_white_noise():
assert noisy.shape[1] == data.shape[1]


# def test_RIR():
# """Tests the RIR transform with a synthetic data.

# - verifies if the output of transform is different than the input data
# - verifies that the size has not changed
# """
# from tonic.audio_augmentations import RIR

# np.random.seed(123)

# sr = 16_000 # sample rate
# sl = 1 # sample length
# data = np.random.rand(1, sr * sl).astype("float32")
# aug = RIR(samplerate=sr)
# RIR_augmented = aug(data)
# assert RIR_augmented is not data
# assert RIR_augmented.shape[1] == data.shape[1]
def test_RIR():
"""Tests the RIR transform with a synthetic data.
- verifies if the output of transform is different than the input data
- verifies that the size has not changed
"""
from tonic.audio_augmentations import RIR

np.random.seed(123)

sr = 16_000 # sample rate
sl = 1 # sample length
data = np.random.rand(1, sr * sl).astype("float32")
rir_audio_path = (
"tutorial-assets/Lab41-SRI-VOiCES-rm1-impulse-mc01-stu-clo-8000hz.wav"
)
aug = RIR(samplerate=sr, rir_audio=rir_audio_path)
RIR_augmented = aug(data)
assert RIR_augmented is not data
assert RIR_augmented.shape[1] == data.shape[1]

0 comments on commit b7f76b6

Please sign in to comment.