A follow up on the custom tables...
-
Didn't want to pollute more @DanH thread https://forum.hise.audio/topic/13831/stock-table-upgrade
@griffinboy BTW, how do write your LUT from the curve?
since y AND x are determined by the curve's dynamic, x might not be an integer for writing the LUTIn my case I use a Newton-Raphson loop in order to find an integer for x, and so it's corresponding y value...
How do you handle this?
-
I resample it into discrete sample values.
It's the same idea as wavetable synthesis oscillators, or a sampler. We end up with a waveform shape sampled to the amount of samples we want.You'll incur aliasing if you don't take measures against that.
-
@griffinboy Nice! I'll have a check on this to see how I can adapt...
-
For getting started, just using linear interpolation will be usable.
When you take in your table, sample it to a table of like, 2048 or 4096 samples using linear interpolation. And then you can read it using linear interp too for different speed playback.
It will be aliased, but for use cases like slow modulations, it doesn't matter terribly. Like, if its an LFO, it won't be unusable with alias.
For antialiasing, it's a complex ordeal.
See this paper:
http://www.mp3-tech.org/programmer/docs/resampler.pdf -
@ustk That being said my curve is made for a waveshaper (not modulation). Meaning that the worst case scenario is to get point that aren't absolutely perfect but unnoticeable to the hear... The reading of the LUT is still interpolated of course. So in the end the mouse precision when dragging a node on the interface is far more approximative.
What I don't like though in the NR algorithm is the extra computation it requires...
-
Ah yeah you'll be fine linearly interpolating the waveshaper curve. The one thing to watch out for maybe is cases where you want discontinuities. Linterp will very slightly smooth those, you may want logic to preserve jumps. Like you said, the actual drawing of the curve by the user is of limited fidelity / accuracy, and that's the real limit.
I'm doing all sorts of interpretation in mine to assume intent from the user.
-
I just saw this new thread... :-)
Here's some info for you that I noticed recently:
If you use the content callback of a table as follows:Table.setContentCallback(tableCallback); inline function tableCallback(i) { // Your code }ireturns the index of the point that you control from outside, for example from a panel or a slider.
This was very useful for my use case.