minilogue xd 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  /*===========================================================================*/
522 #define k_waves_size_exp (7)
523 #define k_waves_size (1U<<k_waves_size_exp)
524 #define k_waves_u32shift (24)
525 #define k_waves_frrecip (5.96046447753906e-008f) // 1/(1<<24)
526 #define k_waves_mask (k_waves_size-1)
527 #define k_waves_lut_size (k_waves_size+1)
528 
529  //TODO: add or remove waves to uniformize banks
530 
531 #define k_waves_a_cnt 16
532 
533  extern const float * const wavesA[k_waves_a_cnt];
534 
535 #define k_waves_b_cnt 16
536 
537  extern const float * const wavesB[k_waves_b_cnt];
538 
539 #define k_waves_c_cnt 14
540 
541  extern const float * const wavesC[k_waves_c_cnt];
542 
543 #define k_waves_d_cnt 13
544 
545  extern const float * const wavesD[k_waves_d_cnt];
546 
547 #define k_waves_e_cnt 15
548 
549  extern const float * const wavesE[k_waves_e_cnt];
550 
551 #define k_waves_f_cnt 16
552 
553  extern const float * const wavesF[k_waves_f_cnt];
554 
555  static inline __attribute__((always_inline, optimize("Ofast")))
556  float osc_wave_scanf(const float *w, float x) {
557  const float p = x - (uint32_t)x;
558  const float x0f = p * k_waves_size;
559  const uint32_t x0 = ((uint32_t)x0f) & k_waves_mask;
560  const uint32_t x1 = (x0 + 1) & k_waves_mask;
561  return linintf(x0f - (uint32_t)x0f, w[x0], w[x1]);
562  }
563 
564  static inline __attribute__((always_inline, optimize("Ofast")))
565  float osc_wave_scanuf(const float *w, uint32_t x) {
566  const uint32_t x0 = (x>>k_waves_u32shift);
567  const uint32_t x1 = (x0 + 1) & k_waves_mask;
568  const float fr = k_waves_frrecip * (float)(x & ((1U<<k_waves_u32shift)-1));
569  return linintf(fr, w[x0], w[x1]);
570  }
571 
574  /*===========================================================================*/
575  /* Various function lookups */
576  /*===========================================================================*/
577 
584 #define k_log_size_exp (8)
585 #define k_log_size (1U<<k_log_size_exp)
586 #define k_log_mask (k_log_size-1)
587 #define k_log_lut_size (k_log_size+1)
588 
589  extern const float log_lut_f[k_log_lut_size];
590 
598  __fast_inline float osc_logf(float x) {
599  const float idxf = x * k_log_size;
600  const uint32_t idx = (uint32_t)idxf;
601  const float y0 = log_lut_f[idx];
602  const float y1 = log_lut_f[idx+1];
603  return linintf(idxf - idx, y0, y1);
604  }
605 
606 #define k_tanpi_size_exp (8)
607 #define k_tanpi_size (1U<<k_tanpi_size_exp)
608 #define k_tanpi_mask (k_tanpi_size-1)
609 #define k_tanpi_range_recip (2.04081632653061f) // 1/0.49
610 #define k_tanpi_lut_size (k_tanpi_size+1)
611 
612  extern const float tanpi_lut_f[k_log_lut_size];
613 
621  __fast_inline float osc_tanpif(float x) {
622  const float idxf = x * k_tanpi_range_recip * k_tanpi_size;
623  const uint32_t idx = (uint32_t)idxf;
624  const float y0 = tanpi_lut_f[idx];
625  const float y1 = tanpi_lut_f[idx+1];
626  return linintf(idxf - idx, y0, y1);
627  }
628 
629 #define k_sqrtm2log_size_exp (8)
630 #define k_sqrtm2log_size (1U<<k_sqrtm2log_size_exp)
631 #define k_sqrtm2log_mask (k_sqrtm2log_size-1)
632 #define k_sqrtm2log_base (0.005f)
633 #define k_sqrtm2log_range_recip (1.00502512562814f) // 1/0.995
634 #define k_sqrtm2log_lut_size (k_sqrtm2log_size+1)
635 
636  extern const float sqrtm2log_lut_f[k_sqrtm2log_lut_size];
637 
645  __fast_inline float osc_sqrtm2logf(float x) {
646  const float idxf = (x-k_sqrtm2log_base) * k_sqrtm2log_range_recip * k_sqrtm2log_size;
647  const uint32_t idx = (uint32_t)idxf;
648  const float y0 = sqrtm2log_lut_f[idx];
649  const float y1 = sqrtm2log_lut_f[idx+1];
650  return linintf(idxf - idx, y0, y1);
651  }
652 
655  /*===========================================================================*/
656  /* Clipping and Saturation */
657  /*===========================================================================*/
672  __fast_inline float osc_softclipf(const float c, float x)
673  {
674  x = clip1m1f(x);
675  return x - c * (x*x*x);
676  }
677 
678 #define k_cubicsat_size_exp (7)
679 #define k_cubicsat_size (1U<<k_cubicsat_size_exp)
680 #define k_cubicsat_mask (k_cubicsat_size-1)
681 #define k_cubicsat_lut_size (k_cubicsat_size+1)
682 
683  extern const float cubicsat_lut_f[k_cubicsat_lut_size];
684 
691  __fast_inline float osc_sat_cubicf(float x) {
692  const float xf = si_fabsf(clip1f(x)) * k_cubicsat_size;
693  const uint32_t xi = (uint32_t)x;
694  const float y0 = cubicsat_lut_f[xi];
695  const float y1 = cubicsat_lut_f[xi+1];
696  return si_copysignf(linintf(xf - xi, y0, y1), x);
697  }
698 
699 #define k_schetzen_size_exp (7)
700 #define k_schetzen_size (1U<<k_schetzen_size_exp)
701 #define k_schetzen_mask (k_schetzen_size-1)
702 #define k_schetzen_lut_size (k_schetzen_size+1)
703 
704  extern const float schetzen_lut_f[k_schetzen_lut_size];
705 
712  __fast_inline float osc_sat_schetzenf(float x) {
713  const float xf = si_fabsf(clip1f(x)) * k_schetzen_size;
714  const uint32_t xi = (uint32_t)x;
715  const float y0 = schetzen_lut_f[xi];
716  const float y1 = schetzen_lut_f[xi+1];
717  return si_copysignf(linintf(xf - xi, y0, y1), x);
718  }
719 
728 #define k_bitres_size_exp (7)
729 #define k_bitres_size (1U<<k_bitres_size_exp)
730 #define k_bitres_mask (k_bitres_size-1)
731 #define k_bitres_lut_size (k_bitres_size+1)
732 
733  extern const float bitres_lut_f[k_bitres_lut_size];
734 
742  __fast_inline float osc_bitresf(float x) {
743  const float xf = x * k_bitres_size;
744  const uint32_t xi = (uint32_t)xf;
745  const float y0 = bitres_lut_f[xi];
746  const float y1 = bitres_lut_f[xi+1];
747  return linintf(xf - xi, y0, y1);
748  }
749 
752  /*===========================================================================*/
753  /* Noise source */
754  /*===========================================================================*/
755 
767  uint32_t _osc_rand(void);
768 
769  __fast_inline uint32_t osc_rand(void) {
770  return _osc_rand();
771  }
772 
778  float _osc_white(void);
779 
780  __fast_inline float osc_white(void) {
781  return _osc_white();
782  }
783 
788 #ifdef __cplusplus
789 }
790 #endif
791 
792 
793 #endif // __osc_api_h
794 
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:621
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:742
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:645
_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:712
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:672
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:598
osc_sat_cubicf
__fast_inline float osc_sat_cubicf(float x)
Cubic saturation.
Definition: osc_api.h:691
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.