Nu:Tekt NTS-1 digital SDK  v1.1-0
osc_api.h
Go to the documentation of this file.
1 /*
2  BSD 3-Clause License
3 
4  Copyright (c) 2018, KORG INC.
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice, this
11  list of conditions and the following disclaimer.
12 
13  * Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17  * Neither the name of the copyright holder nor the names of its
18  contributors may be used to endorse or promote products derived from
19  this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //*/
32 
44 #ifndef __osc_api_h
45 #define __osc_api_h
46 
47 #include "float_math.h"
48 #include "int_math.h"
49 #include "fixed_math.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #define __fast_inline static inline __attribute__((always_inline, optimize("Ofast")))
56 
57  /*===========================================================================*/
58  /* Runtime Environment */
59  /*===========================================================================*/
60 
69  extern const uint32_t k_osc_api_platform;
70 
74  extern const uint32_t k_osc_api_version;
75 
81  uint32_t _osc_mcu_hash(void);
82 
83  __fast_inline uint32_t osc_mcu_hash(void) {
84  return _osc_mcu_hash();
85  }
86 
87 #define k_samplerate (48000)
88 #define k_samplerate_recipf (2.08333333333333e-005f)
89 
92  /*===========================================================================*/
93  /* Lookup tables */
94  /*===========================================================================*/
95 
101 #define k_midi_to_hz_size (152)
102 
103  extern const float midi_to_hz_lut_f[k_midi_to_hz_size];
104 
105 #define k_note_mod_fscale (0.00392156862745098f)
106 #define k_note_max_hz (23679.643054f)
107 
114  __fast_inline float osc_notehzf(uint8_t note) {
115  return midi_to_hz_lut_f[clipmaxu32(note,k_midi_to_hz_size-1)];
116  }
117 
124  __fast_inline float osc_w0f_for_note(uint8_t note, uint8_t mod) {
125  const float f0 = osc_notehzf(note);
126  const float f1 = osc_notehzf(note+1);
127 
128  const float f = clipmaxf(linintf(mod * k_note_mod_fscale, f0, f1), k_note_max_hz);
129 
130  return f * k_samplerate_recipf;
131  }
132 
141 #define k_wt_sine_size_exp (7)
142 #define k_wt_sine_size (1U<<k_wt_sine_size_exp)
143 #define k_wt_sine_u32shift (24)
144 #define k_wt_sine_frrecip (5.96046447753906e-008f) // 1/(1<<24)
145 #define k_wt_sine_mask (k_wt_sine_size-1)
146 #define k_wt_sine_lut_size (k_wt_sine_size+1)
147 
148  extern const float wt_sine_lut_f[k_wt_sine_lut_size];
149 
156  __fast_inline float osc_sinf(float x) {
157  const float p = x - (uint32_t)x;
158 
159  // half period stored -- wrap around and invert
160  const float x0f = 2.f * p * k_wt_sine_size;
161  const uint32_t x0p = (uint32_t)x0f;
162 
163  const uint32_t x0 = x0p & k_wt_sine_mask;
164  const uint32_t x1 = (x0 + 1) & k_wt_sine_mask;
165 
166  const float y0 = linintf(x0f - x0p, wt_sine_lut_f[x0], wt_sine_lut_f[x1]);
167  return (x0p < k_wt_sine_size)?y0:-y0;
168  }
169 
176  __fast_inline float osc_cosf(float x) {
177  return osc_sinf(x+0.25f);
178  }
179 
188 #define k_wt_saw_size_exp (7)
189 #define k_wt_saw_size (1U<<k_wt_saw_size_exp)
190 #define k_wt_saw_u32shift (24)
191 #define k_wt_saw_frrecip (5.96046447753906e-008f) // 1/(1<<24)
192 #define k_wt_saw_mask (k_wt_saw_size-1)
193 #define k_wt_saw_lut_size (k_wt_saw_size+1)
194 #define k_wt_saw_notes_cnt (7)
195 #define k_wt_saw_lut_tsize (k_wt_saw_notes_cnt * k_wt_saw_lut_size)
196 
197  extern const uint8_t wt_saw_notes[k_wt_saw_notes_cnt];
198  extern const float wt_saw_lut_f[k_wt_saw_lut_tsize];
199 
200  //TODO: add integer phase versions
201 
208  __fast_inline float osc_sawf(float x) {
209  const float p = x - (uint32_t)x;
210 
211  const float x0f = 2.f * p * k_wt_saw_size;
212  const uint32_t x0p = (uint32_t)x0f;
213 
214  uint32_t x0 = x0p, x1 = x0p+1;
215  float sign = 1.f;
216  if (x0p >= k_wt_saw_size) {
217  x0 = k_wt_saw_size - (x0p & k_wt_saw_mask);
218  x1 = x0 - 1;
219  sign = -1.f;
220  }
221 
222  const float y0 = linintf(x0f - x0p, wt_saw_lut_f[x0], wt_saw_lut_f[x1]);
223  return sign*y0;
224  }
225 
233  __fast_inline float osc_bl_sawf(float x, uint8_t idx) {
234  const float p = x - (uint32_t)x;
235 
236  const float x0f = 2.f * p * k_wt_saw_size;
237  const uint32_t x0p = (uint32_t)x0f;
238 
239  uint32_t x0 = x0p, x1 = x0p+1;
240  float sign = 1.f;
241  if (x0p >= k_wt_saw_size) {
242  x0 = k_wt_saw_size - (x0p & k_wt_saw_mask);
243  x1 = x0 - 1;
244  sign = -1.f;
245  }
246  const float *wt = &wt_saw_lut_f[idx*k_wt_saw_lut_size];
247  const float y0 = linintf(x0f - x0p, wt[x0], wt[x1]);
248  return sign*y0;
249  }
250 
258  __fast_inline float osc_bl2_sawf(float x, float idx) {
259  const float p = x - (uint32_t)x;
260 
261  const float x0f = 2.f * p * k_wt_saw_size;
262  const uint32_t x0p = (uint32_t)x0f;
263 
264  uint32_t x0 = x0p, x1 = x0p+1;
265  float sign = 1.f;
266  if (x0p >= k_wt_saw_size) {
267  x0 = k_wt_saw_size - (x0p & k_wt_saw_mask);
268  x1 = x0 - 1;
269  sign = -1.f;
270  }
271  const float *wt = &wt_saw_lut_f[(uint16_t)idx*k_wt_saw_lut_size];
272  const float fr = x0f - x0p;
273  const float y0 = sign * linintf(fr, wt[x0], wt[x1]);
274 
275  wt += k_wt_saw_lut_size;
276  const float y1 = sign * linintf(fr, wt[x0], wt[x1]);
277 
278  return linintf((idx - (uint8_t)idx), y0, y1);
279  }
280 
287  float _osc_bl_saw_idx(float note);
288 
289  __fast_inline float osc_bl_saw_idx(float note) {
290  return _osc_bl_saw_idx(note);
291  }
292 
293 
302 #define k_wt_sqr_size_exp 7
303 #define k_wt_sqr_size (1U<<k_wt_sqr_size_exp)
304 #define k_wt_sqr_u32shift (24)
305 #define k_wt_sqr_frrecip (5.96046447753906e-008f) // 1/(1<<24)
306 #define k_wt_sqr_mask (k_wt_sqr_size-1)
307 #define k_wt_sqr_lut_size (k_wt_sqr_size+1)
308 #define k_wt_sqr_notes_cnt 7
309 #define k_wt_sqr_lut_tsize (k_wt_sqr_notes_cnt * k_wt_sqr_lut_size)
310 
311  extern const uint8_t wt_sqr_notes[k_wt_sqr_notes_cnt];
312  extern const float wt_sqr_lut_f[k_wt_sqr_lut_tsize];
313 
321  __fast_inline float osc_sqrf(float x) {
322  const float p = x - (uint32_t)x;
323 
324  const float x0f = 2.f * p * k_wt_sqr_size;
325  const uint32_t x0p = (uint32_t)x0f;
326 
327  uint32_t x0 = x0p, x1 = x0p+1;
328  float sign = 1.f;
329  if (x0p >= k_wt_sqr_size) {
330  x0 = k_wt_sqr_size - (x0p & k_wt_sqr_mask);
331  x1 = x0 - 1;
332  sign = -1.f;
333  }
334 
335  const float y0 = linintf(x0f - x0p, wt_sqr_lut_f[x0], wt_sqr_lut_f[x1]);
336  return sign*y0;
337  }
338 
347  __fast_inline float osc_bl_sqrf(float x, uint8_t idx) {
348  const float p = x - (uint32_t)x;
349 
350  const float x0f = 2.f * p * k_wt_sqr_size;
351  const uint32_t x0p = (uint32_t)x0f;
352 
353  uint32_t x0 = x0p, x1 = x0p+1;
354  float sign = 1.f;
355  if (x0p >= k_wt_sqr_size) {
356  x0 = k_wt_sqr_size - (x0p & k_wt_sqr_mask);
357  x1 = x0 - 1;
358  sign = -1.f;
359  }
360  const float *wt = &wt_sqr_lut_f[idx*k_wt_sqr_lut_size];
361  const float y0 = linintf(x0f - x0p, wt[x0], wt[x1]);
362  return sign*y0;
363  }
364 
373  __fast_inline float osc_bl2_sqrf(float x, float idx) {
374  const float p = x - (uint32_t)x;
375 
376  const float x0f = 2.f * p * k_wt_sqr_size;
377  const uint32_t x0p = (uint32_t)x0f;
378 
379  uint32_t x0 = x0p, x1 = x0p+1;
380  float sign = 1.f;
381  if (x0p >= k_wt_sqr_size) {
382  x0 = k_wt_sqr_size - (x0p & k_wt_sqr_mask);
383  x1 = x0 - 1;
384  sign = -1.f;
385  }
386  const float *wt = &wt_sqr_lut_f[(uint16_t)idx*k_wt_sqr_lut_size];
387  const float fr = x0f - x0p;
388  const float y0 = sign * linintf(fr, wt[x0], wt[x1]);
389 
390  wt += k_wt_sqr_lut_size;
391  const float y1 = sign * linintf(fr, wt[x0], wt[x1]);
392 
393  return linintf((idx - (uint8_t)idx), y0, y1);
394  }
395 
402  float _osc_bl_sqr_idx(float note);
403 
404  __fast_inline float osc_bl_sqr_idx(float note) {
405  return _osc_bl_sqr_idx(note);
406  }
407 
417 #define k_wt_par_size_exp 7
418 #define k_wt_par_size (1U<<k_wt_par_size_exp)
419 #define k_wt_par_u32shift (24)
420 #define k_wt_par_frrecip (5.96046447753906e-008f) // 1/(1<<24)
421 #define k_wt_par_mask (k_wt_par_size-1)
422 #define k_wt_par_lut_size (k_wt_par_size+1)
423 #define k_wt_par_notes_cnt 7
424 #define k_wt_par_lut_tsize (k_wt_par_notes_cnt * k_wt_par_lut_size)
425 
426  extern const uint8_t wt_par_notes[k_wt_par_notes_cnt];
427  extern const float wt_par_lut_f[k_wt_par_lut_tsize];
428 
436  __fast_inline float osc_parf(float x) {
437  const float p = x - (uint32_t)x;
438 
439  const float x0f = 2.f * p * k_wt_par_size;
440  const uint32_t x0p = (uint32_t)x0f;
441 
442  const uint32_t x0 = (x0p<=k_wt_par_size) ? x0p : (k_wt_par_size - (x0p & k_wt_par_mask));
443  const uint32_t x1 = (x0p<(k_wt_par_size-1)) ? (x0 + 1) & k_wt_par_mask : (x0p >= k_wt_par_size) ? (x0 - 1) & k_wt_par_mask : (x0 + 1);
444  const float y0 = linintf(x0f - x0p, wt_par_lut_f[x0], wt_par_lut_f[x1]);
445  return y0;
446  }
447 
456  __fast_inline float osc_bl_parf(float x, uint8_t idx) {
457  const float p = x - (uint32_t)x;
458 
459  const float x0f = 2.f * p * k_wt_par_size;
460  const uint32_t x0p = (uint32_t)x0f;
461 
462  const uint32_t x0 = (x0p<=k_wt_par_size) ? x0p : (k_wt_par_size - (x0p & k_wt_par_mask));
463  const uint32_t x1 = (x0p<(k_wt_par_size-1)) ? (x0 + 1) & k_wt_par_mask : (x0p >= k_wt_par_size) ? (x0 - 1) & k_wt_par_mask : (x0 + 1);
464 
465  const float *wt = &wt_par_lut_f[idx*k_wt_par_lut_size];
466  const float y0 = linintf(x0f - x0p, wt[x0], wt[x1]);
467  return y0;
468  }
469 
478  __fast_inline float osc_bl2_parf(float x, float idx) {
479  const float p = x - (uint32_t)x;
480 
481  const float x0f = 2.f * p * k_wt_par_size;
482  const uint32_t x0p = (uint32_t)x0f;
483 
484  uint32_t x0 = (x0p<=k_wt_par_size) ? x0p : (k_wt_par_size - (x0p & k_wt_par_mask));
485  uint32_t x1 = (x0p<(k_wt_par_size-1)) ? (x0 + 1) & k_wt_par_mask : (x0p >= k_wt_par_size) ? (x0 - 1) & k_wt_par_mask : (x0 + 1);
486 
487  const float *wt = &wt_par_lut_f[(uint16_t)idx*k_wt_par_lut_size];
488  const float fr = x0f - x0p;
489  const float y0 = linintf(fr, wt[x0], wt[x1]);
490 
491  wt += k_wt_par_lut_size;
492 
493  const float y1 = linintf(fr, wt[x0], wt[x1]);
494 
495  return linintf((idx - (uint8_t)idx), y0, y1);
496  }
497 
504  float _osc_bl_par_idx(float note);
505 
506  __fast_inline float osc_bl_par_idx(float note) {
507  return _osc_bl_par_idx(note);
508  }
509 
512  /*===========================================================================*/
513  /* Waves */
514  /*===========================================================================*/
523 #define k_waves_size_exp (7)
524 #define k_waves_size (1U<<k_waves_size_exp)
525 #define k_waves_u32shift (24)
526 #define k_waves_frrecip (5.96046447753906e-008f) // 1/(1<<24)
527 #define k_waves_mask (k_waves_size-1)
528 #define k_waves_lut_size (k_waves_size+1)
529 
530 #define k_waves_a_cnt 16
531 
532  extern const float * const wavesA[k_waves_a_cnt];
533 
534 #define k_waves_b_cnt 16
535 
536  extern const float * const wavesB[k_waves_b_cnt];
537 
538 #define k_waves_c_cnt 14
539 
540  extern const float * const wavesC[k_waves_c_cnt];
541 
542 #define k_waves_d_cnt 13
543 
544  extern const float * const wavesD[k_waves_d_cnt];
545 
546 #define k_waves_e_cnt 15
547 
548  extern const float * const wavesE[k_waves_e_cnt];
549 
550 #define k_waves_f_cnt 16
551 
552  extern const float * const wavesF[k_waves_f_cnt];
553 
554  static inline __attribute__((always_inline, optimize("Ofast")))
555  float osc_wave_scanf(const float *w, float x) {
556  const float p = x - (uint32_t)x;
557  const float x0f = p * k_waves_size;
558  const uint32_t x0 = ((uint32_t)x0f) & k_waves_mask;
559  const uint32_t x1 = (x0 + 1) & k_waves_mask;
560  return linintf(x0f - (uint32_t)x0f, w[x0], w[x1]);
561  }
562 
563  static inline __attribute__((always_inline, optimize("Ofast")))
564  float osc_wave_scanuf(const float *w, uint32_t x) {
565  const uint32_t x0 = (x>>k_waves_u32shift);
566  const uint32_t x1 = (x0 + 1) & k_waves_mask;
567  const float fr = k_waves_frrecip * (float)(x & ((1U<<k_waves_u32shift)-1));
568  return linintf(fr, w[x0], w[x1]);
569  }
570 
573  /*===========================================================================*/
574  /* Various function lookups */
575  /*===========================================================================*/
576 
583 #define k_log_size_exp (8)
584 #define k_log_size (1U<<k_log_size_exp)
585 #define k_log_mask (k_log_size-1)
586 #define k_log_lut_size (k_log_size+1)
587 
588  extern const float log_lut_f[k_log_lut_size];
589 
597  __fast_inline float osc_logf(float x) {
598  const float idxf = x * k_log_size;
599  const uint32_t idx = (uint32_t)idxf;
600  const float y0 = log_lut_f[idx];
601  const float y1 = log_lut_f[idx+1];
602  return linintf(idxf - idx, y0, y1);
603  }
604 
605 #define k_tanpi_size_exp (8)
606 #define k_tanpi_size (1U<<k_tanpi_size_exp)
607 #define k_tanpi_mask (k_tanpi_size-1)
608 #define k_tanpi_range_recip (2.04081632653061f) // 1/0.49
609 #define k_tanpi_lut_size (k_tanpi_size+1)
610 
611  extern const float tanpi_lut_f[k_log_lut_size];
612 
620  __fast_inline float osc_tanpif(float x) {
621  const float idxf = x * k_tanpi_range_recip * k_tanpi_size;
622  const uint32_t idx = (uint32_t)idxf;
623  const float y0 = tanpi_lut_f[idx];
624  const float y1 = tanpi_lut_f[idx+1];
625  return linintf(idxf - idx, y0, y1);
626  }
627 
628 #define k_sqrtm2log_size_exp (8)
629 #define k_sqrtm2log_size (1U<<k_sqrtm2log_size_exp)
630 #define k_sqrtm2log_mask (k_sqrtm2log_size-1)
631 #define k_sqrtm2log_base (0.005f)
632 #define k_sqrtm2log_range_recip (1.00502512562814f) // 1/0.995
633 #define k_sqrtm2log_lut_size (k_sqrtm2log_size+1)
634 
635  extern const float sqrtm2log_lut_f[k_sqrtm2log_lut_size];
636 
644  __fast_inline float osc_sqrtm2logf(float x) {
645  const float idxf = (x-k_sqrtm2log_base) * k_sqrtm2log_range_recip * k_sqrtm2log_size;
646  const uint32_t idx = (uint32_t)idxf;
647  const float y0 = sqrtm2log_lut_f[idx];
648  const float y1 = sqrtm2log_lut_f[idx+1];
649  return linintf(idxf - idx, y0, y1);
650  }
651 
654  /*===========================================================================*/
655  /* Clipping and Saturation */
656  /*===========================================================================*/
671  __fast_inline float osc_softclipf(const float c, float x)
672  {
673  x = clip1m1f(x);
674  return x - c * (x*x*x);
675  }
676 
677 #define k_cubicsat_size_exp (7)
678 #define k_cubicsat_size (1U<<k_cubicsat_size_exp)
679 #define k_cubicsat_mask (k_cubicsat_size-1)
680 #define k_cubicsat_lut_size (k_cubicsat_size+1)
681 
682  extern const float cubicsat_lut_f[k_cubicsat_lut_size];
683 
690  __fast_inline float osc_sat_cubicf(float x) {
691  const float xf = si_fabsf(clip1f(x)) * k_cubicsat_size;
692  const uint32_t xi = (uint32_t)x;
693  const float y0 = cubicsat_lut_f[xi];
694  const float y1 = cubicsat_lut_f[xi+1];
695  return si_copysignf(linintf(xf - xi, y0, y1), x);
696  }
697 
698 #define k_schetzen_size_exp (7)
699 #define k_schetzen_size (1U<<k_schetzen_size_exp)
700 #define k_schetzen_mask (k_schetzen_size-1)
701 #define k_schetzen_lut_size (k_schetzen_size+1)
702 
703  extern const float schetzen_lut_f[k_schetzen_lut_size];
704 
711  __fast_inline float osc_sat_schetzenf(float x) {
712  const float xf = si_fabsf(clip1f(x)) * k_schetzen_size;
713  const uint32_t xi = (uint32_t)x;
714  const float y0 = schetzen_lut_f[xi];
715  const float y1 = schetzen_lut_f[xi+1];
716  return si_copysignf(linintf(xf - xi, y0, y1), x);
717  }
718 
727 #define k_bitres_size_exp (7)
728 #define k_bitres_size (1U<<k_bitres_size_exp)
729 #define k_bitres_mask (k_bitres_size-1)
730 #define k_bitres_lut_size (k_bitres_size+1)
731 
732  extern const float bitres_lut_f[k_bitres_lut_size];
733 
741  __fast_inline float osc_bitresf(float x) {
742  const float xf = x * k_bitres_size;
743  const uint32_t xi = (uint32_t)xf;
744  const float y0 = bitres_lut_f[xi];
745  const float y1 = bitres_lut_f[xi+1];
746  return linintf(xf - xi, y0, y1);
747  }
748 
751  /*===========================================================================*/
752  /* Noise source */
753  /*===========================================================================*/
754 
766  uint32_t _osc_rand(void);
767 
768  __fast_inline uint32_t osc_rand(void) {
769  return _osc_rand();
770  }
771 
777  float _osc_white(void);
778 
779  __fast_inline float osc_white(void) {
780  return _osc_white();
781  }
782 
787 #ifdef __cplusplus
788 }
789 #endif
790 
791 
792 #endif // __osc_api_h
793 
osc_bl2_sqrf
__fast_inline float osc_bl2_sqrf(float x, float idx)
Band-limited square wave lookup.
Definition: osc_api.h:373
clipmaxu32
static uint32_t clipmaxu32(const uint32_t x, const uint32_t m)
Clip upper bound of unsigned integer x to m (inclusive)
Definition: int_math.h:84
fixed_math.h
Fixed Point Math Utilities.
osc_bl_sawf
__fast_inline float osc_bl_sawf(float x, uint8_t idx)
Band-limited sawtooth wave lookup.
Definition: osc_api.h:233
osc_tanpif
__fast_inline float osc_tanpif(float x)
Lookup value of tan(pi*x) in [0.0001, 0.49] range.
Definition: osc_api.h:620
osc_sqrf
__fast_inline float osc_sqrf(float x)
Square wave lookup.
Definition: osc_api.h:321
osc_bl_parf
__fast_inline float osc_bl_parf(float x, uint8_t idx)
Band-limited parabolic wave lookup.
Definition: osc_api.h:456
osc_bitresf
__fast_inline float osc_bitresf(float x)
Bit depth scaling table.
Definition: osc_api.h:741
osc_w0f_for_note
__fast_inline float osc_w0f_for_note(uint8_t note, uint8_t mod)
Get floating point phase increment for given note and fine modulation.
Definition: osc_api.h:124
int_math.h
Integer Math Utilities.
_osc_rand
uint32_t _osc_rand(void)
Random integer.
float_math.h
Floating Point Math Utilities.
clipmaxf
static float clipmaxf(const float x, const float m)
Clip upper bound of x to m (inclusive)
Definition: float_math.h:389
_osc_bl_par_idx
float _osc_bl_par_idx(float note)
Get band-limited parabolic wave index for note.
osc_sawf
__fast_inline float osc_sawf(float x)
Sawtooth wave lookup.
Definition: osc_api.h:208
osc_bl2_sawf
__fast_inline float osc_bl2_sawf(float x, float idx)
Band-limited sawtooth wave lookup.
Definition: osc_api.h:258
si_copysignf
static float si_copysignf(const float x, const float y)
Return x with sign of y applied.
Definition: float_math.h:270
osc_sqrtm2logf
__fast_inline float osc_sqrtm2logf(float x)
Lookup value of sqrt(-2*log(x)) in [0.005, 1.0] range.
Definition: osc_api.h:644
_osc_white
float _osc_white(void)
Gaussian white noise.
osc_sat_schetzenf
__fast_inline float osc_sat_schetzenf(float x)
Schetzen saturation.
Definition: osc_api.h:711
osc_notehzf
__fast_inline float osc_notehzf(uint8_t note)
Get Hertz value for note.
Definition: osc_api.h:114
osc_bl_sqrf
__fast_inline float osc_bl_sqrf(float x, uint8_t idx)
Band-limited square wave lookup.
Definition: osc_api.h:347
_osc_mcu_hash
uint32_t _osc_mcu_hash(void)
Get MCU hash.
osc_softclipf
__fast_inline float osc_softclipf(const float c, float x)
Soft clip.
Definition: osc_api.h:671
osc_bl2_parf
__fast_inline float osc_bl2_parf(float x, float idx)
Band-limited parabolic wave lookup.
Definition: osc_api.h:478
osc_parf
__fast_inline float osc_parf(float x)
Parabolic wave lookup.
Definition: osc_api.h:436
osc_logf
__fast_inline float osc_logf(float x)
Lookup value of log(x) in [0.00001, 1.0] range.
Definition: osc_api.h:597
osc_sat_cubicf
__fast_inline float osc_sat_cubicf(float x)
Cubic saturation.
Definition: osc_api.h:690
k_osc_api_platform
const uint32_t k_osc_api_platform
Current platform.
osc_sinf
__fast_inline float osc_sinf(float x)
Lookup value of sin(2*pi*x).
Definition: osc_api.h:156
_osc_bl_saw_idx
float _osc_bl_saw_idx(float note)
Get band-limited sawtooth wave index for note.
_osc_bl_sqr_idx
float _osc_bl_sqr_idx(float note)
Get band-limited square wave index for note.
clip1f
static float clip1f(const float x)
Clip upper bound of x to 1.f (inclusive)
Definition: float_math.h:413
clip1m1f
static float clip1m1f(const float x)
Clip x to [-1.f, 1.f] (inclusive)
Definition: float_math.h:431
osc_cosf
__fast_inline float osc_cosf(float x)
Lookup value of cos(2*pi*x) in [0, 1.0] range.
Definition: osc_api.h:176
linintf
static float linintf(const float fr, const float x0, const float x1)
Linear interpolation.
Definition: float_math.h:824
si_fabsf
static float si_fabsf(float x)
Absolute value.
Definition: float_math.h:284
k_osc_api_version
const uint32_t k_osc_api_version
Current API version.