logue-sdk icon indicating copy to clipboard operation
logue-sdk copied to clipboard

LUTs in Q31

Open dukesrg opened this issue 4 years ago • 0 comments

Oscillator runtime API lookups are in float now, but OSC_CYCLE natively uses Q31 format. This looks weird and leads to excessive calculations, like

  • using f32_to_q31 with one FP multiplication per each sample is required
  • clipping in +/-1.0 is needed per each sample in case several waves are combined, but not the case for saturated integer math, natively supported by ARM.

I did the test: reversed necessary funcitons of osc_api and float_math to Q31 math, made a precalculation of useneeded LUTs into Q31 format on oscillator init and used only integer math (including Q31) inside the OSC_CYCLE main loop. This gives roughly 50% performance increase. This really makes sence when you trying to combine dozens of waves in unison.

Maybe it is too late to change horses in midstream, but this could give a glue to performance optimization for someone.

dukesrg avatar May 05 '20 07:05 dukesrg