From dd6cf05465d029b8628ecc8ee5a5fcd2197843f6 Mon Sep 17 00:00:00 2001 From: Eugene Gritskevich Date: Fri, 26 Apr 2024 21:49:52 +0200 Subject: [PATCH] Don't calculate heavy room parameters if augmentation is not goiing to be applied --- audiomentations/augmentations/room_simulator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audiomentations/augmentations/room_simulator.py b/audiomentations/augmentations/room_simulator.py index 3a71e610..ee1ca208 100644 --- a/audiomentations/augmentations/room_simulator.py +++ b/audiomentations/augmentations/room_simulator.py @@ -204,6 +204,9 @@ def randomize_parameters(self, samples: NDArray[np.float32], sample_rate: int): raise super().randomize_parameters(samples, sample_rate) + if not self.parameters["should_apply"]: + return + self.parameters["size_x"] = random.uniform(self.min_size_x, self.max_size_x) self.parameters["size_y"] = random.uniform(self.min_size_y, self.max_size_y) self.parameters["size_z"] = random.uniform(self.min_size_z, self.max_size_z)