You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, let's say I want to make an LFO into a MultiVCO (see #442).
I want a higher frequency range:
new_freq_range = ModuleParameterRange(
50.0,
2006.0,
curve=0.25,
name="frequency",
description="Frequency in Hz of oscillation",
)
So how do I change the ModuleParameterRange for the LFO frequency?
class MultiVCOSynth(AbstractSynth):
def __init__(self, synthconfig: Optional[SynthConfig] = None):
# Call the constructor in the parent AbstractSynth class
super().__init__(synthconfig=synthconfig)
# Add all the modules that we'll use for this synth
self.add_synth_modules(
[
("lfo", LFO),
]
)
# Do something here
def output(self) -> torch.Tensor:
return self.lfo()
Okay, I see that each module has `parameter_ranges` so let me replace the one I want:
for i, parameter_range in enumerate(self.lfo.parameter_ranges):
if parameter_range.name == "frequency":
self.lfo.parameter_ranges[i] = new_freq_range
Does not work, fails silently.
Oh, the module constructor has a dict, I should set that too:
Does not work, fails silently.
Okay wait, the module_parameter range is put in the constructor of individual parameters. (This is annoying because then module.parameter_ranges and module._parameter_range_dict should be `__` private to discourage the sort of monkeying I just did.)
Does not work, fails silently.
At this point I give up because there are too many moving parts, and do the ugly thing I know will work:
At the TOP of my code I do this
from torchsynth.module import LFO
new_freq_range = ModuleParameterRange(
50.0,
2006.0,
curve=0.25,
name="frequency",
description="Frequency in Hz of oscillation",
)
for i, parameter_range in enumerate(LFO.default_ranges):
if parameter_range.name == "frequency":
LFO.default_ranges[i] = new_freq_range
The text was updated successfully, but these errors were encountered:
So, let's say I want to make an LFO into a MultiVCO (see #442).
I want a higher frequency range:
So how do I change the ModuleParameterRange for the LFO frequency?
class MultiVCOSynth(AbstractSynth):
from torchsynth.module import LFO
new_freq_range = ModuleParameterRange(
50.0,
2006.0,
curve=0.25,
name="frequency",
description="Frequency in Hz of oscillation",
)
for i, parameter_range in enumerate(LFO.default_ranges):
if parameter_range.name == "frequency":
LFO.default_ranges[i] = new_freq_range
The text was updated successfully, but these errors were encountered: