Skip to content

Commit

Permalink
Fix parameter inference for Valhalla Supermassive. (spotify#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Sep 12, 2022
1 parent d3d4a4f commit bf29495
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pedalboard/pedalboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ def __init__(self, plugin, parameter_name, search_steps: int = 1000):
self.ranges: Dict[Tuple[float, float], Union[str, float, bool]] = {}

with self.__get_cpp_parameter() as cpp_parameter:
start_of_range: float = 0
text_value: Optional[str] = None

for fetch_slow in (False, True):
start_of_range: float = 0
text_value: Optional[str] = None

self.ranges = {}
for x in range(0, search_steps + 1):
raw_value = x / search_steps
Expand Down
3 changes: 3 additions & 0 deletions tests/test_external_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ def test_float_parameters(plugin_filename: str, parameter_name: str):
_min, _max, _ = parameter_value.range
step_size = parameter_value.step_size
new_values = np.arange(_min, _max, step_size)
# Because sometimes np.arange(_min, _max) gives values _slightly outside_
# of [_min, _max] thanks to floating point:
new_values = [max(_min, min(_max, new_value)) for new_value in new_values]

epsilon = parameter_value.step_size or parameter_value.approximate_step_size or 0.001

Expand Down

0 comments on commit bf29495

Please sign in to comment.