Skip to content

Commit 6425e91

Browse files
authored
fixes #99 (#104)
1 parent 8a6748d commit 6425e91

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

sox/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ def mcompand(self, n_bands=2, crossover_frequencies=[1600],
22222222
raise ValueError(
22232223
"Tuple values in tf_points lists must be <= 0 (dB)."
22242224
)
2225-
if len(tf_points) > len(set([p[0] for p in tfp])):
2225+
if len(tfp) > len(set([p[0] for p in tfp])):
22262226
raise ValueError("Found duplicate x-value in tf_points list.")
22272227

22282228
if not isinstance(gain, list) or len(gain) != n_bands:

tests/test_transform.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,35 @@ def test_tf_points_valid(self):
30913091
self.assertEqual(expected_res, actual_res)
30923092
tfm_assert_array_to_file_output(INPUT_FILE, OUTPUT_FILE, tfm)
30933093

3094+
def test_tf_points_valid2(self):
3095+
tfm = new_transformer()
3096+
tfm.mcompand(
3097+
n_bands=3,
3098+
crossover_frequencies=[6500, 8000],
3099+
attack_time=[0.001, 0.001, 0.001],
3100+
decay_time=[0.020, 0.020, 0.020],
3101+
soft_knee_db=[None, 2.0, None],
3102+
tf_points=[[(-40, -40), (0, 0)],
3103+
[(-40, -40), (-30, -38), (-20, -36), (0, -34)],
3104+
[(-40, -40), (0, 0)]],
3105+
gain=[None, None, None])
3106+
actual_args = tfm.effects
3107+
expected_args = [
3108+
'mcompand',
3109+
'0.001000,0.020000 -40.000000,-40.000000,0.000000,0.000000',
3110+
'6500.000000',
3111+
('0.001000,0.020000 2.000000:-40.000000,-40.000000,-30.000000,' +
3112+
'-38.000000,-20.000000,-36.000000,0.000000,-34.000000'),
3113+
'8000.000000',
3114+
'0.001000,0.020000 -40.000000,-40.000000,0.000000,0.000000'
3115+
]
3116+
3117+
self.assertEqual(expected_args, actual_args)
3118+
3119+
actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE)
3120+
expected_res = True
3121+
self.assertEqual(expected_res, actual_res)
3122+
30943123
def test_tf_points_wrong_len(self):
30953124
tfm = new_transformer()
30963125
with self.assertRaises(ValueError):

0 commit comments

Comments
 (0)