set VoiceLimit of sine Wave Generator
-
sorry for the very basic question but how can I set the VoiceLimit of the Sine Wave Generator using a knob? - I've tried this
inline function onKnob1Control(component, value) { OSC1.setAttribute(OSC1.VoiceLimit, value); }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
and even tried just setting it n the property editor with no luck (I'd rather script though). Can't find anything in the API browser either. what's the trick here?
-
try this?
inline function onKnob1Control(component, value) { OSC1.setAttribute(2, value); }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
if you dump parameter ID & values, you see this in code editor.
"Voice Limit" is paramter [2]
-
@Chazrox Thanks, good idea but it doesn't work, I'm using a Sine Wave Generator and although I can set octave, semitone etc using numbers, there seems to be no number for VoiceLimit
-
@rglides i found something weird...
this script "works" kinda lol....but for some reason the value doesnt reflect visually on the module's text label.
If you paramter dump after each value change, you can see that it is in fact changing it.try this and see what happens. Move Knob1 then close and open OSC1 module and you'll see it changes. I imagine you can figure out whats happening from that. Its kinda weird. Buggy??
const var OSC1 = Synth.getChildSynth("OSC1"); const var Knob1 = Content.getComponent("Knob1"); inline function onKnob1Control(component, value) { local LimitNOW = OSC1.getAttribute(2); if (value) { OSC1.setAttribute(2, value); Console.print(LimitNOW); } }; Content.getComponent("Knob1").setControlCallback(onKnob1Control);
HiseSnippet 1157.3ocyW0saaaCElx1LaVcKXsnWrKEB1EtCcAx4ulhfg4Dmjsf1jXDklsqVGsDkMWnH0jnxl2Pd21ixdD1av1gTxQxoNNtdsESAH.776GO7vuCcuDoOMMUlfrrOeTLEY8IXuQB0vtCILA5n8QVKiOljpnIN4h1aTLIMkFfrrp+sZAVMafLe+82rGgSD9zRQHzERlO8krHlpTZuNufw4GRBnmyhpX8FcNxWJ5J4xL.O0wtnXh+kjAzSHZypgQeGIcHx5KwqsVn+1ttau95a5RHqGPHazlt9yogaE5uo6ycC5uoK72VHqkNHfojIdJhhlhrZrmLXj2P4uJxSvErTVeNUunMxCxbt3Ck7.8VTKE0cHiGzabgJEgrv8JKa0yKaOFeLKfci7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piatnNt0h53yVTG299cTOzZ2LkLJ+JKBcbuCLuD1x5.AA53M2NP+KTMLew.
If I chang the knob while im playing, I can tell its working because if you go from 1 voices to 3 you can hear the polyphony changing.
-
@Chazrox oh!! so it does! Thanks man!
-
@rglides Yeet!
-
@rglides just remove the .changed();. not needed, I was being hacky. lmao
-
@Chazrox hehe hackerman to the rescue. Getting weird audio glitches in the generators now, not sure it's related, will keep playing around
-
@rglides Ah it's cos I set the saturation to max when testing earlier. All good, this really helps, thanks again!
-
@rglides lol.
I think Voice Limit does falls into the category of one of those features that cause zipping if you adjust in real time.
-
@rglides oh SWEET! so its not what I said. Thats great news. haha.
-
@Chazrox that could be true, I know setting to 1 probably isn't a good idea too. But no, I was getting some really strange sounds cos of the max saturation for sure - EDIT changing in real-time sounds fine actually, very smooth
-
@rglides I was just playing with it and it doesnt have a problem with zero even so I really dont know. hahaha
-
@rglides shiiid. You're all good then!
-
@Chazrox oh interesting, yeah I would have thought that'd be some kind of mute hack but nope
-
@Chazrox said in set VoiceLimit of sine Wave Generator:
Voice Limit" is paramter [2]
Avoid the magic number, use the parameter name instead OSC1.VoiceLimit
-
@d-healey ah, are these the proverbial "magic numbers" I hear about? It worked either way, I just chose the short version obviously thinking it was better. Thank You!
-
@Chazrox Yeah a magic number means you're using the value of a constant instead of the constant itself. So to anyone else looking at your code - or you in the future when you've forgotten what your code does - they just see a number that magically does something but have no idea what it refers to.
-
@d-healey That makes sense. Now I know wth that means. haha Ty.
Hope all is blessed!
-
Yeah it's true, I did update to this
inline function onknb_OSC1_VoiceLimitControl(component, value) { OSC1.setAttribute(OSC1.VoiceLimit, value); }; Content.getComponent("knb_OSC1_VoiceLimit").setControlCallback(onknb_OSC1_VoiceLimitControl);
but it was very helpful to discover that the function was always working, just not updating in real-time in module window, so the help was massive
edit: 'update' I mean revert hehe