Login / Register 0 items | $0.00 New @ KVR
mystran
KVRAF
 
4837 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Tue May 15, 2018 4:04 pm Re: Wavetable synthesis. theory, practice, fear?

earlevel wrote:
mystran wrote:What would be wrong with this:
Code: Select all
return wave->data[int(wave->size * phase)]
     - wave->data[int(wave->size * offsetPhase)];

For what it's worth, I actually spent a little bit of effort to try to make sure to use names that would result in the correct mental associations, which also making it as easy as possible to parse visually.

Nothing wrong with it. For me, a sample has a size (16-bit, etc.), and a buffer of samples has a length, but no big deal. Maybe due to decades of C (sizeof, strlen, etc.). Anyway, like I said, I word things a little differently for examples, and maybe "waveTable->waveTableLen" is over-explaining, but hey. I stress enough about the wording of my articles ;-)


Well... i suppose you could choose "length" just as well, but STL likes to use "size()" so I went with that. :)
Image <- plugins | forum
stratum
KVRAF
 
1738 posts since 29 May, 2012

Postby stratum; Wed May 16, 2018 1:31 am Re: Wavetable synthesis. theory, practice, fear?

Well... i suppose you could choose "length" just as well, but STL likes to use "size()" so I went with that. :)


STL is work of Russian hackers in their own style :lol:
~stratum~
LiteX2
KVRer
 
13 posts since 3 May, 2018

Postby LiteX2; Sat May 19, 2018 6:33 am Re: Wavetable synthesis. theory, practice, fear?

In defense of everybody who has ever coded anything - naming is hard! And as I am reminded daily when refactoring my old code: it may very well be a lot easier to write code than it is to read it. Maybe this is one of the reasons people always seem to want to create new "better" languages. :)
Previous

Moderator: Moderators (Main)

Return to DSP and Plug-in Development