Cython: oscs.pyx

Generated by Cython 0.28.4

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: oscs.c

    +001: # cython: language_level=3

      __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     002:

    +003: import numbers

      __pyx_t_1 = __Pyx_Import(__pyx_n_s_numbers, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_numbers, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +004: import numpy as np

      __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     005: from .soundbuffer cimport SoundBuffer

    +006: from . import wavetables

      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_wavetables);
      __Pyx_GIVEREF(__pyx_n_s_wavetables);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_wavetables);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s__35, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_wavetables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_wavetables, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     007: from . cimport wavetables

     008: from . cimport interpolation

     009:

     010: cimport cython

     011: from cpython.array cimport array, clone

     012:

    +013: cdef inline int DEFAULT_SAMPLERATE = 44100

      __pyx_v_5pippi_4oscs_DEFAULT_SAMPLERATE = 0xAC44;

    +014: cdef inline int DEFAULT_CHANNELS = 2

      __pyx_v_5pippi_4oscs_DEFAULT_CHANNELS = 2;

    +015: cdef inline double MIN_PULSEWIDTH = 0.0001

      __pyx_v_5pippi_4oscs_MIN_PULSEWIDTH = 0.0001;

     016:

    +017: cdef class Osc:

    struct __pyx_vtabstruct_5pippi_4oscs_Osc {
      PyObject *(*_play)(struct __pyx_obj_5pippi_4oscs_Osc *, int);
      PyObject *(*_play2d)(struct __pyx_obj_5pippi_4oscs_Osc *, int);
    };
    static struct __pyx_vtabstruct_5pippi_4oscs_Osc *__pyx_vtabptr_5pippi_4oscs_Osc;

     018:     """ 1d or 2d wavetable osc

     019:     """

    +020:     def __cinit__(

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_3Osc_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_5pippi_4oscs_3Osc_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_wavetable = 0;
      PyObject *__pyx_v_stack = 0;
      double __pyx_v_freq;
      double __pyx_v_amp;
      double __pyx_v_pulsewidth;
      double __pyx_v_phase;
      PyObject *__pyx_v_window = 0;
      double __pyx_v_win_phase;
      PyObject *__pyx_v_mod = 0;
      double __pyx_v_mod_freq;
      double __pyx_v_mod_range;
      double __pyx_v_mod_phase;
      PyObject *__pyx_v_lfo = 0;
      double __pyx_v_lfo_freq;
      int __pyx_v_wtsize;
      int __pyx_v_channels;
      int __pyx_v_samplerate;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavetable,&__pyx_n_s_stack,&__pyx_n_s_freq,&__pyx_n_s_amp,&__pyx_n_s_pulsewidth,&__pyx_n_s_phase,&__pyx_n_s_window,&__pyx_n_s_win_phase,&__pyx_n_s_mod,&__pyx_n_s_mod_freq,&__pyx_n_s_mod_range,&__pyx_n_s_mod_phase,&__pyx_n_s_lfo,&__pyx_n_s_lfo_freq,&__pyx_n_s_wtsize,&__pyx_n_s_channels,&__pyx_n_s_samplerate,0};
        PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_3Osc___cinit__(struct __pyx_obj_5pippi_4oscs_Osc *__pyx_v_self, PyObject *__pyx_v_wavetable, PyObject *__pyx_v_stack, double __pyx_v_freq, double __pyx_v_amp, double __pyx_v_pulsewidth, double __pyx_v_phase, PyObject *__pyx_v_window, double __pyx_v_win_phase, PyObject *__pyx_v_mod, double __pyx_v_mod_freq, double __pyx_v_mod_range, double __pyx_v_mod_phase, PyObject *__pyx_v_lfo, double __pyx_v_lfo_freq, int __pyx_v_wtsize, int __pyx_v_channels, int __pyx_v_samplerate) {
      CYTHON_UNUSED Py_ssize_t __pyx_v_i;
      PyObject *__pyx_v_wt = NULL;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__cinit__", 0);
      __Pyx_INCREF(__pyx_v_wavetable);
      __Pyx_INCREF(__pyx_v_window);
      __Pyx_INCREF(__pyx_v_mod);
      __Pyx_INCREF(__pyx_v_lfo);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_AddTraceback("pippi.oscs.Osc.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_wt);
      __Pyx_XDECREF(__pyx_v_wavetable);
      __Pyx_XDECREF(__pyx_v_window);
      __Pyx_XDECREF(__pyx_v_mod);
      __Pyx_XDECREF(__pyx_v_lfo);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     021:             self,

    +022:             object wavetable=None,

        values[0] = ((PyObject *)Py_None);

    +023:               list stack=None,

        values[1] = ((PyObject*)Py_None);

     024:             double freq=440,

     025:             double amp=1,

     026:             double pulsewidth=1,

     027:             double phase=0,

     028:

    +029:             object window=None,

        values[6] = ((PyObject *)Py_None);

     030:             double win_phase=0,

     031:

    +032:             object mod=None,

        values[8] = ((PyObject *)Py_None);

     033:             double mod_freq=0.2,

     034:             double mod_range=0,

     035:             double mod_phase=0,

     036:

    +037:             object lfo=None,

        values[12] = ((PyObject *)Py_None);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavetable);
              if (value) { values[0] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stack);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amp);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pulsewidth);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_phase);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window);
              if (value) { values[6] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_win_phase);
              if (value) { values[7] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod);
              if (value) { values[8] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod_freq);
              if (value) { values[9] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 10:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod_range);
              if (value) { values[10] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 11:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod_phase);
              if (value) { values[11] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 12:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lfo);
              if (value) { values[12] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 13:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lfo_freq);
              if (value) { values[13] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 14:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wtsize);
              if (value) { values[14] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 15:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_channels);
              if (value) { values[15] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 16:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplerate);
              if (value) { values[16] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 20, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_wavetable = values[0];
        __pyx_v_stack = ((PyObject*)values[1]);
        if (values[2]) {
          __pyx_v_freq = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error)
        } else {
          __pyx_v_freq = ((double)440.0);
        }
        if (values[3]) {
          __pyx_v_amp = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_amp == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error)
        } else {
          __pyx_v_amp = ((double)1.0);
        }
        if (values[4]) {
          __pyx_v_pulsewidth = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_pulsewidth == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error)
        } else {
          __pyx_v_pulsewidth = ((double)1.0);
        }
        if (values[5]) {
          __pyx_v_phase = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L3_error)
        } else {
          __pyx_v_phase = ((double)0.0);
        }
        __pyx_v_window = values[6];
        if (values[7]) {
          __pyx_v_win_phase = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_win_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error)
        } else {
          __pyx_v_win_phase = ((double)0.0);
        }
        __pyx_v_mod = values[8];
        if (values[9]) {
          __pyx_v_mod_freq = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_mod_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error)
        } else {
          __pyx_v_mod_freq = ((double)0.2);
        }
        if (values[10]) {
          __pyx_v_mod_range = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_mod_range == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L3_error)
        } else {
          __pyx_v_mod_range = ((double)0.0);
        }
        if (values[11]) {
          __pyx_v_mod_phase = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_mod_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L3_error)
        } else {
          __pyx_v_mod_phase = ((double)0.0);
        }
        __pyx_v_lfo = values[12];
        if (values[13]) {
          __pyx_v_lfo_freq = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_lfo_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error)
        } else {
          __pyx_v_lfo_freq = ((double)0.2);
        }
        if (values[14]) {
          __pyx_v_wtsize = __Pyx_PyInt_As_int(values[14]); if (unlikely((__pyx_v_wtsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error)
        } else {
          __pyx_v_wtsize = ((int)0x1000);
        }
        if (values[15]) {
          __pyx_v_channels = __Pyx_PyInt_As_int(values[15]); if (unlikely((__pyx_v_channels == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
        } else {
          __pyx_v_channels = __pyx_k_;
        }
        if (values[16]) {
          __pyx_v_samplerate = __Pyx_PyInt_As_int(values[16]); if (unlikely((__pyx_v_samplerate == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
        } else {
          __pyx_v_samplerate = __pyx_k__2;
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("pippi.oscs.Osc.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stack), (&PyList_Type), 1, "stack", 1))) __PYX_ERR(0, 23, __pyx_L1_error)
      __pyx_r = __pyx_pf_5pippi_4oscs_3Osc___cinit__(((struct __pyx_obj_5pippi_4oscs_Osc *)__pyx_v_self), __pyx_v_wavetable, __pyx_v_stack, __pyx_v_freq, __pyx_v_amp, __pyx_v_pulsewidth, __pyx_v_phase, __pyx_v_window, __pyx_v_win_phase, __pyx_v_mod, __pyx_v_mod_freq, __pyx_v_mod_range, __pyx_v_mod_phase, __pyx_v_lfo, __pyx_v_lfo_freq, __pyx_v_wtsize, __pyx_v_channels, __pyx_v_samplerate);

     038:             double lfo_freq=0.2,

     039:

     040:             int wtsize=4096,

    +041:             int channels=DEFAULT_CHANNELS,

      __pyx_k_ = __pyx_v_5pippi_4oscs_DEFAULT_CHANNELS;

    +042:             int samplerate=DEFAULT_SAMPLERATE,

      __pyx_k__2 = __pyx_v_5pippi_4oscs_DEFAULT_SAMPLERATE;

     043:         ):

     044:

    +045:         self.freq = freq

      __pyx_v_self->freq = __pyx_v_freq;

    +046:         self.amp = amp

      __pyx_v_self->amp = __pyx_v_amp;

    +047:         self.phase = phase

      __pyx_v_self->phase = __pyx_v_phase;

     048:

    +049:         self.channels = channels

      __pyx_v_self->channels = __pyx_v_channels;

    +050:         self.samplerate = samplerate

      __pyx_v_self->samplerate = __pyx_v_samplerate;

    +051:         self.wtsize = wtsize

      __pyx_v_self->wtsize = __pyx_v_wtsize;

     052:

    +053:         self.pulsewidth = pulsewidth if pulsewidth >= MIN_PULSEWIDTH else MIN_PULSEWIDTH

      if (((__pyx_v_pulsewidth >= __pyx_v_5pippi_4oscs_MIN_PULSEWIDTH) != 0)) {
        __pyx_t_1 = __pyx_v_pulsewidth;
      } else {
        __pyx_t_1 = __pyx_v_5pippi_4oscs_MIN_PULSEWIDTH;
      }
      __pyx_v_self->pulsewidth = __pyx_t_1;

     054:

    +055:         if isinstance(wavetable, int):

      __pyx_t_2 = PyInt_Check(__pyx_v_wavetable);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L3;
      }

     056:             # Create wavetable type if wavetable is an integer flag

    +057:             self.wavetable = wavetables._wavetable(wavetable, self.wtsize)

        __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_wavetable); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L1_error)
        __pyx_t_5 = __pyx_f_5pippi_10wavetables__wavetable(__pyx_t_4, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 57, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
        __pyx_v_self->wavetable = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

     058:

    +059:         elif isinstance(wavetable, wavetables.Wavetable):

      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_wavetable, __pyx_ptype_5pippi_10wavetables_Wavetable);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L3;
      }

    +060:             self.wavetable = wavetable.data

        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_wavetable, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 60, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
        __pyx_v_self->wavetable = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

     061:

    +062:         elif isinstance(wavetable, SoundBuffer):

      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_wavetable, __pyx_ptype_5pippi_11soundbuffer_SoundBuffer);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L3;
      }

    +063:             if wavetable.channels > 1:

        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_wavetable, __pyx_n_s_channels); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_3) {
    /* … */
        }

    +064:                 wavetable = wavetable.remix(1)

          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_wavetable, __pyx_n_s_remix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 64, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF_SET(__pyx_v_wavetable, __pyx_t_6);
          __pyx_t_6 = 0;
    /* … */
      __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__3);
      __Pyx_GIVEREF(__pyx_tuple__3);

    +065:             self.wavetable = wavetable.frames.base.flatten()

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_wavetable, __pyx_n_s_frames); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_base); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flatten); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (__pyx_t_8) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
        __pyx_v_self->wavetable = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

     066:

    +067:         elif wavetable is not None:

      __pyx_t_3 = (__pyx_v_wavetable != Py_None);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
      }
      __pyx_L3:;

    +068:             self.wavetable = array('d', wavetable)

        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_n_u_d);
        __Pyx_GIVEREF(__pyx_n_u_d);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_d);
        __Pyx_INCREF(__pyx_v_wavetable);
        __Pyx_GIVEREF(__pyx_v_wavetable);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_wavetable);
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
        __pyx_v_self->wavetable = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

     069:

    +070:         if stack is not None:

      __pyx_t_2 = (__pyx_v_stack != ((PyObject*)Py_None));
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
      }

    +071:             self.wavetables = []

        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->wavetables);
        __Pyx_DECREF(__pyx_v_self->wavetables);
        __pyx_v_self->wavetables = ((PyObject*)__pyx_t_7);
        __pyx_t_7 = 0;

    +072:             for i, wt in enumerate(stack):

        __pyx_t_9 = 0;
        __pyx_t_7 = __pyx_v_stack; __Pyx_INCREF(__pyx_t_7); __pyx_t_10 = 0;
        for (;;) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_wt, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_v_i = __pyx_t_9;
          __pyx_t_9 = (__pyx_t_9 + 1);
    /* … */
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    +073:                 if isinstance(wt, int):

          __pyx_t_3 = PyInt_Check(__pyx_v_wt);
          __pyx_t_2 = (__pyx_t_3 != 0);
          if (__pyx_t_2) {
    /* … */
            goto __pyx_L8;
          }

    +074:                     self.wavetables += [ wavetables._wavetable(wt, self.wtsize) ]

            __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_wt); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error)
            __pyx_t_5 = __pyx_f_5pippi_10wavetables__wavetable(__pyx_t_4, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 74, __pyx_L1_error)
            __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_5, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
            __pyx_t_5.memview = NULL;
            __pyx_t_5.data = NULL;
            __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 74, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_6);
            PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_self->wavetables, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_GOTREF(__pyx_v_self->wavetables);
            __Pyx_DECREF(__pyx_v_self->wavetables);
            __pyx_v_self->wavetables = ((PyObject*)__pyx_t_6);
            __pyx_t_6 = 0;

    +075:                 elif isinstance(wt, wavetables.Wavetable):

          __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_wt, __pyx_ptype_5pippi_10wavetables_Wavetable);
          __pyx_t_3 = (__pyx_t_2 != 0);
          if (__pyx_t_3) {
    /* … */
            goto __pyx_L8;
          }

    +076:                     self.wavetables += [ interpolation._linear(wt.data, self.wtsize) ]

            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_wt, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 76, __pyx_L1_error)
            __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
            __pyx_t_5.memview = NULL;
            __pyx_t_5.data = NULL;
            __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
            __pyx_t_11.memview = NULL;
            __pyx_t_11.data = NULL;
            __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_6);
            PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_self->wavetables, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_GOTREF(__pyx_v_self->wavetables);
            __Pyx_DECREF(__pyx_v_self->wavetables);
            __pyx_v_self->wavetables = ((PyObject*)__pyx_t_6);
            __pyx_t_6 = 0;

    +077:                 elif isinstance(wt, SoundBuffer):

          __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_wt, __pyx_ptype_5pippi_11soundbuffer_SoundBuffer);
          __pyx_t_2 = (__pyx_t_3 != 0);
          if (__pyx_t_2) {
    /* … */
            goto __pyx_L8;
          }

    +078:                     if wt.channels > 1:

            __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_wt, __pyx_n_s_channels); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (__pyx_t_2) {
    /* … */
            }

    +079:                         wt = wt.remix(1)

              __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_wt, __pyx_n_s_remix); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF_SET(__pyx_v_wt, __pyx_t_6);
              __pyx_t_6 = 0;
    /* … */
      __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 79, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__4);
      __Pyx_GIVEREF(__pyx_tuple__4);

    +080:                     self.wavetables += [ interpolation._linear(wt.frames.base.flatten(), self.wtsize) ]

            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_wt, __pyx_n_s_frames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_base); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_flatten); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_8, function);
              }
            }
            if (__pyx_t_12) {
              __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            } else {
              __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
            }
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 80, __pyx_L1_error)
            __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
            __pyx_t_11.memview = NULL;
            __pyx_t_11.data = NULL;
            __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_5, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
            __pyx_t_5.memview = NULL;
            __pyx_t_5.data = NULL;
            __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_6);
            PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_self->wavetables, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GIVEREF(__pyx_t_6);
            __Pyx_GOTREF(__pyx_v_self->wavetables);
            __Pyx_DECREF(__pyx_v_self->wavetables);
            __pyx_v_self->wavetables = ((PyObject*)__pyx_t_6);
            __pyx_t_6 = 0;

     081:                 else:

    +082:                     self.wavetables += [ interpolation._linear(array('d', wt), self.wtsize) ]

          /*else*/ {
            __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_n_u_d);
            __Pyx_GIVEREF(__pyx_n_u_d);
            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_u_d);
            __Pyx_INCREF(__pyx_v_wt);
            __Pyx_GIVEREF(__pyx_v_wt);
            PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_wt);
            __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 82, __pyx_L1_error)
            __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
            __pyx_t_5.memview = NULL;
            __pyx_t_5.data = NULL;
            __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
            __pyx_t_11.memview = NULL;
            __pyx_t_11.data = NULL;
            __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_8);
            PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
            __pyx_t_8 = 0;
            __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_self->wavetables, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GIVEREF(__pyx_t_8);
            __Pyx_GOTREF(__pyx_v_self->wavetables);
            __Pyx_DECREF(__pyx_v_self->wavetables);
            __pyx_v_self->wavetables = ((PyObject*)__pyx_t_8);
            __pyx_t_8 = 0;
          }
          __pyx_L8:;

     083:

    +084:         self.win_phase = win_phase

      __pyx_v_self->win_phase = __pyx_v_win_phase;

    +085:         if isinstance(window, int):

      __pyx_t_2 = PyInt_Check(__pyx_v_window);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L10;
      }

    +086:             self.window = wavetables._window(window, self.wtsize)

        __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_window); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
        __pyx_t_11 = __pyx_f_5pippi_10wavetables__window(__pyx_t_4, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 86, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->window, 0);
        __pyx_v_self->window = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;

    +087:         elif isinstance(window, wavetables.Wavetable):

      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_5pippi_10wavetables_Wavetable);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L10;
      }

    +088:             self.window = interpolation._linear(window.data, self.wtsize)

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 88, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 88, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->window, 0);
        __pyx_v_self->window = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

    +089:         elif isinstance(window, SoundBuffer):

      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_window, __pyx_ptype_5pippi_11soundbuffer_SoundBuffer);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L10;
      }

    +090:             if window.channels > 1:

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_channels); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_3) {
    /* … */
        }

    +091:                 window = window.remix(1)

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_remix); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_7);
          __pyx_t_7 = 0;
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);

    +092:             self.window = interpolation._linear(window.frames.base.flatten(), self.wtsize)

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_window, __pyx_n_s_frames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_flatten); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 92, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 92, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->window, 0);
        __pyx_v_self->window = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;

    +093:         elif window is not None:

      __pyx_t_3 = (__pyx_v_window != Py_None);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L10;
      }

    +094:             self.window = interpolation._linear(array('d', window), self.wtsize)

        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_n_u_d);
        __Pyx_GIVEREF(__pyx_n_u_d);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_d);
        __Pyx_INCREF(__pyx_v_window);
        __Pyx_GIVEREF(__pyx_v_window);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_window);
        __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 94, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 94, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 94, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->window, 0);
        __pyx_v_self->window = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

     095:         else:

    +096:             self.window = None

      /*else*/ {
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 96, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->window, 0);
        __pyx_v_self->window = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
      }
      __pyx_L10:;

     097:

    +098:         self.mod_range = mod_range

      __pyx_v_self->mod_range = __pyx_v_mod_range;

    +099:         self.mod_phase = mod_phase

      __pyx_v_self->mod_phase = __pyx_v_mod_phase;

    +100:         self.mod_freq = mod_freq

      __pyx_v_self->mod_freq = __pyx_v_mod_freq;

    +101:         if isinstance(mod, int):

      __pyx_t_2 = PyInt_Check(__pyx_v_mod);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L12;
      }

    +102:             self.mod = wavetables._window(mod, self.wtsize)

        __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_mod); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error)
        __pyx_t_5 = __pyx_f_5pippi_10wavetables__window(__pyx_t_4, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 102, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

    +103:         elif isinstance(mod, wavetables.Wavetable):

      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_mod, __pyx_ptype_5pippi_10wavetables_Wavetable);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L12;
      }

    +104:             self.mod = interpolation._linear(mod.data, self.wtsize)

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 104, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 104, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;

    +105:         elif isinstance(mod, SoundBuffer):

      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_mod, __pyx_ptype_5pippi_11soundbuffer_SoundBuffer);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L12;
      }

    +106:             if mod.channels > 1:

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_channels); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_3) {
    /* … */
        }

    +107:                 mod = mod.remix(1)

          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_remix); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF_SET(__pyx_v_mod, __pyx_t_8);
          __pyx_t_8 = 0;
    /* … */
      __pyx_tuple__6 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__6);
      __Pyx_GIVEREF(__pyx_tuple__6);

    +108:             self.mod = interpolation._linear(mod.frames.base.flatten(), self.wtsize)

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_frames); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_flatten); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 108, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 108, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 108, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_5;
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;

    +109:         elif isinstance(mod, list):

      __pyx_t_3 = PyList_Check(__pyx_v_mod);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L12;
      }

    +110:             self.mod = interpolation._linear(array('d', mod), self.wtsize)

        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_n_u_d);
        __Pyx_GIVEREF(__pyx_n_u_d);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_d);
        __Pyx_INCREF(__pyx_v_mod);
        __Pyx_GIVEREF(__pyx_v_mod);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_mod);
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 110, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;

    +111:         elif mod is not None:

      __pyx_t_2 = (__pyx_v_mod != Py_None);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L12;
      }

    +112:             self.mod = mod

        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_mod, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 112, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;

     113:         else:

    +114:             self.mod = None

      /*else*/ {
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 114, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_v_self->mod, 0);
        __pyx_v_self->mod = __pyx_t_11;
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
      }
      __pyx_L12:;

     115:

    +116:         self.lfo_freq = lfo_freq

      __pyx_v_self->lfo_freq = __pyx_v_lfo_freq;

    +117:         if isinstance(lfo, int):

      __pyx_t_3 = PyInt_Check(__pyx_v_lfo);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L14;
      }

    +118:             self.lfo = wavetables._window(lfo, self.wtsize)

        __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_lfo); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error)
        __pyx_t_11 = __pyx_f_5pippi_10wavetables__window(__pyx_t_4, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 118, __pyx_L1_error)
        __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = __pyx_t_7;
        __pyx_t_7 = 0;

    +119:         elif isinstance(lfo, wavetables.Wavetable):

      __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_lfo, __pyx_ptype_5pippi_10wavetables_Wavetable);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L14;
      }

    +120:             self.lfo = interpolation._linear(lfo.data, self.wtsize)

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_lfo, __pyx_n_s_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_5, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = __pyx_t_7;
        __pyx_t_7 = 0;

    +121:         elif isinstance(lfo, SoundBuffer):

      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_lfo, __pyx_ptype_5pippi_11soundbuffer_SoundBuffer);
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {
    /* … */
        goto __pyx_L14;
      }

    +122:             if lfo.channels > 1:

        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_lfo, __pyx_n_s_channels); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 122, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_2) {
    /* … */
        }

    +123:                 lfo = lfo.remix(1)

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_lfo, __pyx_n_s_remix); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 123, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF_SET(__pyx_v_lfo, __pyx_t_7);
          __pyx_t_7 = 0;
    /* … */
      __pyx_tuple__7 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__7);
      __Pyx_GIVEREF(__pyx_tuple__7);

    +124:             self.lfo = interpolation._linear(lfo.frames.base.flatten(), self.wtsize)

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_lfo, __pyx_n_s_frames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_flatten); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_5, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 124, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = __pyx_t_7;
        __pyx_t_7 = 0;

    +125:         elif isinstance(lfo, list):

      __pyx_t_2 = PyList_Check(__pyx_v_lfo);
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L14;
      }

    +126:             self.lfo = interpolation._linear(array('d', lfo), self.wtsize)

        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_n_u_d);
        __Pyx_GIVEREF(__pyx_n_u_d);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_d);
        __Pyx_INCREF(__pyx_v_lfo);
        __Pyx_GIVEREF(__pyx_v_lfo);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lfo);
        __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 126, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __pyx_f_5pippi_13interpolation__linear(__pyx_t_11, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 126, __pyx_L1_error)
        __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
        __pyx_t_11.memview = NULL;
        __pyx_t_11.data = NULL;
        __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_5, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = __pyx_t_8;
        __pyx_t_8 = 0;

     127:         else:

    +128:             self.lfo = None

      /*else*/ {
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = Py_None;
      }
      __pyx_L14:;

     129:

    +130:         if stack is not None and self.lfo is None:

      __pyx_t_2 = (__pyx_v_stack != ((PyObject*)Py_None));
      __pyx_t_13 = (__pyx_t_2 != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_3 = __pyx_t_13;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_13 = (__pyx_v_self->lfo == Py_None);
      __pyx_t_2 = (__pyx_t_13 != 0);
      __pyx_t_3 = __pyx_t_2;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_3) {
    /* … */
      }

    +131:             self.lfo = wavetables._wavetable(wavetables.RSAW, self.wtsize)

        __pyx_t_5 = __pyx_f_5pippi_10wavetables__wavetable(__pyx_v_5pippi_10wavetables_RSAW, __pyx_v_self->wtsize); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 131, __pyx_L1_error)
        __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_5, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
        __pyx_t_5.memview = NULL;
        __pyx_t_5.data = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_v_self->lfo);
        __Pyx_DECREF(__pyx_v_self->lfo);
        __pyx_v_self->lfo = __pyx_t_8;
        __pyx_t_8 = 0;

     132:

    +133:     def play(self,

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_3Osc_3play(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_3Osc_3play(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_length = 0;
      PyObject *__pyx_v_freq = 0;
      PyObject *__pyx_v_amp = 0;
      PyObject *__pyx_v_pulsewidth = 0;
      PyObject *__pyx_v_mod_freq = 0;
      PyObject *__pyx_v_mod_range = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("play (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_length,&__pyx_n_s_freq,&__pyx_n_s_amp,&__pyx_n_s_pulsewidth,&__pyx_n_s_mod_freq,&__pyx_n_s_mod_range,0};
        PyObject* values[6] = {0,0,0,0,0,0};
        values[1] = ((PyObject *)__pyx_int_neg_1);
        values[2] = ((PyObject *)__pyx_int_neg_1);
        values[3] = ((PyObject *)__pyx_int_neg_1);
        values[4] = ((PyObject *)__pyx_int_neg_1);
        values[5] = ((PyObject *)__pyx_int_neg_1);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amp);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pulsewidth);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod_freq);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mod_range);
              if (value) { values[5] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "play") < 0)) __PYX_ERR(0, 133, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_length = values[0];
        __pyx_v_freq = values[1];
        __pyx_v_amp = values[2];
        __pyx_v_pulsewidth = values[3];
        __pyx_v_mod_freq = values[4];
        __pyx_v_mod_range = values[5];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("play", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("pippi.oscs.Osc.play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_5pippi_4oscs_3Osc_2play(((struct __pyx_obj_5pippi_4oscs_Osc *)__pyx_v_self), __pyx_v_length, __pyx_v_freq, __pyx_v_amp, __pyx_v_pulsewidth, __pyx_v_mod_freq, __pyx_v_mod_range);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_3Osc_2play(struct __pyx_obj_5pippi_4oscs_Osc *__pyx_v_self, PyObject *__pyx_v_length, PyObject *__pyx_v_freq, PyObject *__pyx_v_amp, PyObject *__pyx_v_pulsewidth, PyObject *__pyx_v_mod_freq, PyObject *__pyx_v_mod_range) {
      int __pyx_v_framelength;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("play", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("pippi.oscs.Osc.play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     134:              length,

     135:              freq=-1,

     136:              amp=-1,

     137:              pulsewidth=-1,

     138:              mod_freq=-1,

     139:              mod_range=-1,

     140:         ):

     141:

    +142:         framelength = <int>(length * self.samplerate)

      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->samplerate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_length, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_framelength = ((int)__pyx_t_3);

     143:

    +144:         if freq > 0:

      __pyx_t_2 = PyObject_RichCompare(__pyx_v_freq, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {
    /* … */
      }

    +145:             self.freq = freq

        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_freq); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
        __pyx_v_self->freq = __pyx_t_5;

     146:

    +147:         if amp >= 0:

      __pyx_t_2 = PyObject_RichCompare(__pyx_v_amp, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 147, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {
    /* … */
      }

    +148:             self.amp = amp

        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_amp); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
        __pyx_v_self->amp = __pyx_t_5;

     149:

    +150:         if pulsewidth > 0:

      __pyx_t_2 = PyObject_RichCompare(__pyx_v_pulsewidth, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {
    /* … */
      }

    +151:             self.pulsewidth = pulsewidth

        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_pulsewidth); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
        __pyx_v_self->pulsewidth = __pyx_t_5;

     152:

    +153:         if mod_freq > 0:

      __pyx_t_2 = PyObject_RichCompare(__pyx_v_mod_freq, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 153, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {
    /* … */
      }

    +154:             self.mod_freq = mod_freq

        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_mod_freq); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error)
        __pyx_v_self->mod_freq = __pyx_t_5;

     155:

    +156:         if mod_range >= 0:

      __pyx_t_2 = PyObject_RichCompare(__pyx_v_mod_range, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {
    /* … */
      }

    +157:             self.mod_range = mod_range

        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_mod_range); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
        __pyx_v_self->mod_range = __pyx_t_5;

     158:

    +159:         if self.wavetables is not None:

      __pyx_t_4 = (__pyx_v_self->wavetables != ((PyObject*)Py_None));
      __pyx_t_6 = (__pyx_t_4 != 0);
      if (__pyx_t_6) {
    /* … */
      }

    +160:             return self._play2d(framelength)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = ((struct __pyx_vtabstruct_5pippi_4oscs_Osc *)__pyx_v_self->__pyx_vtab)->_play2d(__pyx_v_self, __pyx_v_framelength); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;

     161:         else:

    +162:             return self._play(framelength)

      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = ((struct __pyx_vtabstruct_5pippi_4oscs_Osc *)__pyx_v_self->__pyx_vtab)->_play(__pyx_v_self, __pyx_v_framelength); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

     163:

    +164:     cdef object _play(self, int length):

    static PyObject *__pyx_f_5pippi_4oscs_3Osc__play(struct __pyx_obj_5pippi_4oscs_Osc *__pyx_v_self, int __pyx_v_length) {
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_wtindex;
      int __pyx_v_modindex;
      int __pyx_v_wtlength;
      int __pyx_v_wtboundry;
      int __pyx_v_modlength;
      int __pyx_v_modboundry;
      double __pyx_v_val;
      double __pyx_v_val_mod;
      double __pyx_v_nextval;
      double __pyx_v_nextval_mod;
      double __pyx_v_frac;
      double __pyx_v_frac_mod;
      int __pyx_v_silence_length;
      __Pyx_memviewslice __pyx_v_wavetable = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_window = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int __pyx_v_j;
      double __pyx_v_isamplerate;
      int __pyx_v_channel;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_play", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_XDECREF(__pyx_t_15);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_AddTraceback("pippi.oscs.Osc._play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_wavetable, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_window, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +165:         cdef double[:,:] out = np.zeros((length, self.channels), dtype='d')

      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_u_d) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     166:

    +167:         cdef int i = 0

      __pyx_v_i = 0;

    +168:         cdef int wtindex = 0

      __pyx_v_wtindex = 0;

    +169:         cdef int modindex = 0

      __pyx_v_modindex = 0;

    +170:         cdef int wtlength = len(self.wavetable)

      if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 170, __pyx_L1_error)}
      __pyx_t_6 = __Pyx_MemoryView_Len(__pyx_v_self->wavetable);
      __pyx_v_wtlength = __pyx_t_6;

    +171:         cdef int wtboundry = wtlength - 1

      __pyx_v_wtboundry = (__pyx_v_wtlength - 1);

    +172:         cdef int modlength = 1 if self.mod is None else len(self.mod)

      if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 172, __pyx_L1_error)}
      if (((((PyObject *) __pyx_v_self->mod.memview) == Py_None) != 0)) {
        __pyx_t_7 = 1;
      } else {
        if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 172, __pyx_L1_error)}
        __pyx_t_6 = __Pyx_MemoryView_Len(__pyx_v_self->mod);
        __pyx_t_7 = __pyx_t_6;
      }
      __pyx_v_modlength = __pyx_t_7;

    +173:         cdef int modboundry = modlength - 1

      __pyx_v_modboundry = (__pyx_v_modlength - 1);

     174:         cdef double val, val_mod, nextval, nextval_mod, frac, frac_mod

     175:         cdef int silence_length

     176:

    +177:         cdef double[:] wavetable = self.wavetable

      if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 177, __pyx_L1_error)}
      __pyx_t_8 = __pyx_v_self->wavetable;
      __PYX_INC_MEMVIEW(&__pyx_t_8, 1);
      __pyx_v_wavetable = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     178:         cdef double[:] window

     179:

    +180:         cdef unsigned int j = 0

      __pyx_v_j = 0;

     181:

    +182:         if self.window is not None:

      if (unlikely(!__pyx_v_self->window.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 182, __pyx_L1_error)}
      __pyx_t_9 = ((((PyObject *) __pyx_v_self->window.memview) != Py_None) != 0);
      if (__pyx_t_9) {
    /* … */
      }

    +183:             window = interpolation._linear(self.window, wtlength)

        if (unlikely(!__pyx_v_self->window.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 183, __pyx_L1_error)}
        __pyx_t_8 = __pyx_f_5pippi_13interpolation__linear(__pyx_v_self->window, __pyx_v_wtlength); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 183, __pyx_L1_error)
        __pyx_v_window = __pyx_t_8;
        __pyx_t_8.memview = NULL;
        __pyx_t_8.data = NULL;

    +184:             for j in range(wtlength):

        __pyx_t_10 = __pyx_v_wtlength;
        __pyx_t_11 = __pyx_t_10;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_j = __pyx_t_12;

    +185:                 wavetable[j] *= window[j]

          __pyx_t_6 = __pyx_v_j;
          __pyx_t_13 = -1;
          if (unlikely(__pyx_t_6 >= (size_t)__pyx_v_window.shape[0])) __pyx_t_13 = 0;
          if (unlikely(__pyx_t_13 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_13);
            __PYX_ERR(0, 185, __pyx_L1_error)
          }
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_13 = -1;
          if (unlikely(__pyx_t_14 >= (size_t)__pyx_v_wavetable.shape[0])) __pyx_t_13 = 0;
          if (unlikely(__pyx_t_13 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_13);
            __PYX_ERR(0, 185, __pyx_L1_error)
          }
          *((double *) ( /* dim=0 */ (__pyx_v_wavetable.data + __pyx_t_14 * __pyx_v_wavetable.strides[0]) )) *= (*((double *) ( /* dim=0 */ (__pyx_v_window.data + __pyx_t_6 * __pyx_v_window.strides[0]) )));
        }

     186:

    +187:         if self.pulsewidth < 1:

      __pyx_t_9 = ((__pyx_v_self->pulsewidth < 1.0) != 0);
      if (__pyx_t_9) {
    /* … */
      }

    +188:             silence_length = <int>((wtlength / self.pulsewidth) - wtlength)

        if (unlikely(__pyx_v_self->pulsewidth == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          __PYX_ERR(0, 188, __pyx_L1_error)
        }
        __pyx_v_silence_length = ((int)((((double)__pyx_v_wtlength) / __pyx_v_self->pulsewidth) - __pyx_v_wtlength));

    +189:             wavetable = np.concatenate((wavetable, np.zeros(silence_length, dtype='d')))

        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_wavetable, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_silence_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_u_d) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
        __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_17);
        __pyx_t_4 = 0;
        __pyx_t_17 = 0;
        __pyx_t_17 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (!__pyx_t_17) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_2};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_2};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          {
            __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_17); __pyx_t_17 = NULL;
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_wavetable, 1);
        __pyx_v_wavetable = __pyx_t_8;
        __pyx_t_8.memview = NULL;
        __pyx_t_8.data = NULL;

     190:

    +191:         cdef double isamplerate = 1.0 / self.samplerate

      if (unlikely(__pyx_v_self->samplerate == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 191, __pyx_L1_error)
      }
      __pyx_v_isamplerate = (1.0 / ((double)__pyx_v_self->samplerate));

     192:

    +193:         for i in range(length):

      __pyx_t_10 = __pyx_v_length;
      __pyx_t_11 = __pyx_t_10;
      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_11; __pyx_t_13+=1) {
        __pyx_v_i = __pyx_t_13;

    +194:             wtindex = <int>self.phase % wtlength

        if (unlikely(__pyx_v_wtlength == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 194, __pyx_L1_error)
        }
        __pyx_v_wtindex = __Pyx_mod_int(((int)__pyx_v_self->phase), __pyx_v_wtlength);

    +195:             modindex = <int>self.mod_phase % modlength

        if (unlikely(__pyx_v_modlength == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 195, __pyx_L1_error)
        }
        __pyx_v_modindex = __Pyx_mod_int(((int)__pyx_v_self->mod_phase), __pyx_v_modlength);

     196:

    +197:             val = wavetable[wtindex]

        __pyx_t_18 = __pyx_v_wtindex;
        __pyx_t_19 = -1;
        if (__pyx_t_18 < 0) {
          __pyx_t_18 += __pyx_v_wavetable.shape[0];
          if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 0;
        } else if (unlikely(__pyx_t_18 >= __pyx_v_wavetable.shape[0])) __pyx_t_19 = 0;
        if (unlikely(__pyx_t_19 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_19);
          __PYX_ERR(0, 197, __pyx_L1_error)
        }
        __pyx_v_val = (*((double *) ( /* dim=0 */ (__pyx_v_wavetable.data + __pyx_t_18 * __pyx_v_wavetable.strides[0]) )));

    +198:             val_mod = 1

        __pyx_v_val_mod = 1.0;

     199:

    +200:             if wtindex < wtboundry:

        __pyx_t_9 = ((__pyx_v_wtindex < __pyx_v_wtboundry) != 0);
        if (__pyx_t_9) {
    /* … */
          goto __pyx_L9;
        }

    +201:                 nextval = wavetable[wtindex + 1]

          __pyx_t_20 = (__pyx_v_wtindex + 1);
          __pyx_t_19 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_v_wavetable.shape[0];
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_v_wavetable.shape[0])) __pyx_t_19 = 0;
          if (unlikely(__pyx_t_19 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_19);
            __PYX_ERR(0, 201, __pyx_L1_error)
          }
          __pyx_v_nextval = (*((double *) ( /* dim=0 */ (__pyx_v_wavetable.data + __pyx_t_20 * __pyx_v_wavetable.strides[0]) )));

     202:             else:

    +203:                 nextval = wavetable[0]

        /*else*/ {
          __pyx_t_21 = 0;
          __pyx_t_19 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_v_wavetable.shape[0];
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_v_wavetable.shape[0])) __pyx_t_19 = 0;
          if (unlikely(__pyx_t_19 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_19);
            __PYX_ERR(0, 203, __pyx_L1_error)
          }
          __pyx_v_nextval = (*((double *) ( /* dim=0 */ (__pyx_v_wavetable.data + __pyx_t_21 * __pyx_v_wavetable.strides[0]) )));
        }
        __pyx_L9:;

     204:

    +205:             if self.mod is not None:

        if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 205, __pyx_L1_error)}
        __pyx_t_9 = ((((PyObject *) __pyx_v_self->mod.memview) != Py_None) != 0);
        if (__pyx_t_9) {
    /* … */
        }

    +206:                 if modindex < modboundry:

          __pyx_t_9 = ((__pyx_v_modindex < __pyx_v_modboundry) != 0);
          if (__pyx_t_9) {
    /* … */
            goto __pyx_L11;
          }

    +207:                     nextval_mod = self.mod[modindex + 1]

            if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 207, __pyx_L1_error)}
            __pyx_t_22 = (__pyx_v_modindex + 1);
            __pyx_t_19 = -1;
            if (__pyx_t_22 < 0) {
              __pyx_t_22 += __pyx_v_self->mod.shape[0];
              if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 0;
            } else if (unlikely(__pyx_t_22 >= __pyx_v_self->mod.shape[0])) __pyx_t_19 = 0;
            if (unlikely(__pyx_t_19 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_19);
              __PYX_ERR(0, 207, __pyx_L1_error)
            }
            __pyx_v_nextval_mod = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_22 * __pyx_v_self->mod.strides[0]) )));

     208:                 else:

    +209:                     nextval_mod = self.mod[0]

          /*else*/ {
            if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 209, __pyx_L1_error)}
            __pyx_t_23 = 0;
            __pyx_t_19 = -1;
            if (__pyx_t_23 < 0) {
              __pyx_t_23 += __pyx_v_self->mod.shape[0];
              if (unlikely(__pyx_t_23 < 0)) __pyx_t_19 = 0;
            } else if (unlikely(__pyx_t_23 >= __pyx_v_self->mod.shape[0])) __pyx_t_19 = 0;
            if (unlikely(__pyx_t_19 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_19);
              __PYX_ERR(0, 209, __pyx_L1_error)
            }
            __pyx_v_nextval_mod = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_23 * __pyx_v_self->mod.strides[0]) )));
          }
          __pyx_L11:;

     210:

    +211:                 frac_mod = self.mod_phase - <int>self.mod_phase

          __pyx_v_frac_mod = (__pyx_v_self->mod_phase - ((int)__pyx_v_self->mod_phase));

    +212:                 val_mod = self.mod[modindex]

          if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 212, __pyx_L1_error)}
          __pyx_t_24 = __pyx_v_modindex;
          __pyx_t_19 = -1;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_v_self->mod.shape[0];
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_19 = 0;
          } else if (unlikely(__pyx_t_24 >= __pyx_v_self->mod.shape[0])) __pyx_t_19 = 0;
          if (unlikely(__pyx_t_19 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_19);
            __PYX_ERR(0, 212, __pyx_L1_error)
          }
          __pyx_v_val_mod = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_24 * __pyx_v_self->mod.strides[0]) )));

    +213:                 val_mod = (1.0 - frac_mod) * val_mod + frac_mod * nextval_mod

          __pyx_v_val_mod = (((1.0 - __pyx_v_frac_mod) * __pyx_v_val_mod) + (__pyx_v_frac_mod * __pyx_v_nextval_mod));

    +214:                 val_mod = 1.0 + (val_mod * self.mod_range)

          __pyx_v_val_mod = (1.0 + (__pyx_v_val_mod * __pyx_v_self->mod_range));

    +215:                 self.mod_phase += self.mod_freq * modlength * isamplerate

          __pyx_v_self->mod_phase = (__pyx_v_self->mod_phase + ((__pyx_v_self->mod_freq * __pyx_v_modlength) * __pyx_v_isamplerate));

     216:

    +217:             frac = self.phase - <int>self.phase

        __pyx_v_frac = (__pyx_v_self->phase - ((int)__pyx_v_self->phase));

    +218:             val = ((1.0 - frac) * val + frac * nextval) * self.amp

        __pyx_v_val = ((((1.0 - __pyx_v_frac) * __pyx_v_val) + (__pyx_v_frac * __pyx_v_nextval)) * __pyx_v_self->amp);

    +219:             self.phase += self.freq * val_mod * wtlength * isamplerate

        __pyx_v_self->phase = (__pyx_v_self->phase + (((__pyx_v_self->freq * __pyx_v_val_mod) * __pyx_v_wtlength) * __pyx_v_isamplerate));

     220:

    +221:             for channel in range(self.channels):

        __pyx_t_19 = __pyx_v_self->channels;
        __pyx_t_25 = __pyx_t_19;
        for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
          __pyx_v_channel = __pyx_t_26;

    +222:                 out[i][channel] = val

          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_channel;
          __pyx_t_29 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_v_out.shape[0];
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_29 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_v_out.shape[0])) __pyx_t_29 = 0;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_v_out.shape[1];
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_29 = 1;
          } else if (unlikely(__pyx_t_28 >= __pyx_v_out.shape[1])) __pyx_t_29 = 1;
          if (unlikely(__pyx_t_29 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_29);
            __PYX_ERR(0, 222, __pyx_L1_error)
          }
          *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_27 * __pyx_v_out.strides[0]) ) + __pyx_t_28 * __pyx_v_out.strides[1]) )) = __pyx_v_val;
        }
      }

     223:

    +224:         return SoundBuffer(out, channels=self.channels, samplerate=self.samplerate)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_out, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_channels, __pyx_t_4) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->samplerate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_samplerate, __pyx_t_4) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pippi_11soundbuffer_SoundBuffer), __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

     225:

    +226:     cdef object _play2d(self, int length):

    static PyObject *__pyx_f_5pippi_4oscs_3Osc__play2d(struct __pyx_obj_5pippi_4oscs_Osc *__pyx_v_self, int __pyx_v_length) {
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      CYTHON_UNUSED __Pyx_memviewslice __pyx_v_stack = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_stack_depth;
      double __pyx_v_isamplerate;
      double __pyx_v_wt_lfo_phase_inc;
      CYTHON_UNUSED double __pyx_v_phase_inc;
      double __pyx_v_wt_phase_inc;
      double __pyx_v_wt_lfo_phase;
      double __pyx_v_wt_lfo_frac;
      double __pyx_v_wt_lfo_y0;
      double __pyx_v_wt_lfo_y1;
      double __pyx_v_wt_lfo_pos;
      double __pyx_v_stack_frac;
      double __pyx_v_stack_phase;
      double __pyx_v_y0;
      double __pyx_v_y1;
      double __pyx_v_val;
      double __pyx_v_wt_mod_val;
      CYTHON_UNUSED double __pyx_v_wt_mod_phase;
      double __pyx_v_wt_mod_frac;
      double __pyx_v_wt_mod_next;
      int __pyx_v_i;
      int __pyx_v_wt_lfo_x;
      int __pyx_v_stack_x;
      int __pyx_v_channel;
      int __pyx_v_wt_mod_i;
      int __pyx_v_wt_mod_length;
      int __pyx_v_wt_mod_boundry;
      double __pyx_v_wt_phase;
      double __pyx_v_wt_mod_phase_inc;
      PyObject *__pyx_v_wt_x = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_play2d", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_AddTraceback("pippi.oscs.Osc._play2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_stack, 1);
      __Pyx_XDECREF(__pyx_v_wt_x);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +227:         cdef double[:,:] out = np.zeros((length, self.channels), dtype='d')

      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_u_d) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

    +228:         cdef double[:,:] stack = np.column_stack(self.wavetables)

      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_column_stack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->wavetables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_self->wavetables};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_self->wavetables};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_INCREF(__pyx_v_self->wavetables);
          __Pyx_GIVEREF(__pyx_v_self->wavetables);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_self->wavetables);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_stack = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

    +229:         cdef int stack_depth = len(self.wavetables)

      __pyx_t_1 = __pyx_v_self->wavetables;
      __Pyx_INCREF(__pyx_t_1);
      if (unlikely(__pyx_t_1 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 229, __pyx_L1_error)
      }
      __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 229, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_stack_depth = __pyx_t_6;

    +230:         cdef double isamplerate = (1.0 / self.samplerate)

      if (unlikely(__pyx_v_self->samplerate == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 230, __pyx_L1_error)
      }
      __pyx_v_isamplerate = (1.0 / ((double)__pyx_v_self->samplerate));

    +231:         cdef double wt_lfo_phase_inc = len(self.lfo) * (1.0 / length)

      __pyx_t_1 = __pyx_v_self->lfo;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 231, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_length == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 231, __pyx_L1_error)
      }
      __pyx_v_wt_lfo_phase_inc = (__pyx_t_6 * (1.0 / ((double)__pyx_v_length)));

    +232:         cdef double phase_inc = self.freq * self.wtsize * isamplerate

      __pyx_v_phase_inc = ((__pyx_v_self->freq * __pyx_v_self->wtsize) * __pyx_v_isamplerate);

    +233:         cdef double wt_phase_inc = self.freq * self.wtsize * isamplerate

      __pyx_v_wt_phase_inc = ((__pyx_v_self->freq * __pyx_v_self->wtsize) * __pyx_v_isamplerate);

     234:

     235:         cdef double wt_lfo_phase, wt_lfo_frac, wt_lfo_y0, wt_lfo_y1, wt_lfo_pos

     236:         cdef double stack_frac, stack_phase

     237:         cdef double phase, frac, y0, y1, val

    +238:         cdef double wt_mod_val = 1

      __pyx_v_wt_mod_val = 1.0;

    +239:         cdef double wt_mod_phase = 0

      __pyx_v_wt_mod_phase = 0.0;

    +240:         cdef double wt_mod_frac = 0

      __pyx_v_wt_mod_frac = 0.0;

    +241:         cdef double wt_mod_next = 0

      __pyx_v_wt_mod_next = 0.0;

     242:

     243:         cdef int i, wt_lfo_x, stack_x, channel, wt_mod_i

    +244:         cdef int wt_mod_length = 1 if self.mod is None else len(self.mod)

      if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 244, __pyx_L1_error)}
      if (((((PyObject *) __pyx_v_self->mod.memview) == Py_None) != 0)) {
        __pyx_t_6 = 1;
      } else {
        if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 244, __pyx_L1_error)}
        __pyx_t_7 = __Pyx_MemoryView_Len(__pyx_v_self->mod);
        __pyx_t_6 = __pyx_t_7;
      }
      __pyx_v_wt_mod_length = __pyx_t_6;

    +245:         cdef int wt_mod_boundry = wt_mod_length - 1

      __pyx_v_wt_mod_boundry = (__pyx_v_wt_mod_length - 1);

    +246:         cdef double wt_phase = 0

      __pyx_v_wt_phase = 0.0;

    +247:         cdef double wt_mod_phase_inc = self.mod_freq * (1.0 / length) * wt_mod_length

      if (unlikely(__pyx_v_length == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 247, __pyx_L1_error)
      }
      __pyx_v_wt_mod_phase_inc = ((__pyx_v_self->mod_freq * (1.0 / ((double)__pyx_v_length))) * __pyx_v_wt_mod_length);

     248:

    +249:         for i in range(length):

      __pyx_t_8 = __pyx_v_length;
      __pyx_t_9 = __pyx_t_8;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_v_i = __pyx_t_10;

    +250:             if self.mod is not None:

        if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 250, __pyx_L1_error)}
        __pyx_t_11 = ((((PyObject *) __pyx_v_self->mod.memview) != Py_None) != 0);
        if (__pyx_t_11) {
    /* … */
        }

    +251:                 wt_mod_i = <int>self.mod_phase % wt_mod_length

          if (unlikely(__pyx_v_wt_mod_length == 0)) {
            PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
            __PYX_ERR(0, 251, __pyx_L1_error)
          }
          __pyx_v_wt_mod_i = __Pyx_mod_int(((int)__pyx_v_self->mod_phase), __pyx_v_wt_mod_length);

    +252:                 if wt_mod_i < wt_mod_boundry:

          __pyx_t_11 = ((__pyx_v_wt_mod_i < __pyx_v_wt_mod_boundry) != 0);
          if (__pyx_t_11) {
    /* … */
            goto __pyx_L6;
          }

    +253:                     wt_mod_next = self.mod[wt_mod_i + 1]

            if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 253, __pyx_L1_error)}
            __pyx_t_12 = (__pyx_v_wt_mod_i + 1);
            __pyx_t_13 = -1;
            if (__pyx_t_12 < 0) {
              __pyx_t_12 += __pyx_v_self->mod.shape[0];
              if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
            } else if (unlikely(__pyx_t_12 >= __pyx_v_self->mod.shape[0])) __pyx_t_13 = 0;
            if (unlikely(__pyx_t_13 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_13);
              __PYX_ERR(0, 253, __pyx_L1_error)
            }
            __pyx_v_wt_mod_next = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_12 * __pyx_v_self->mod.strides[0]) )));

     254:                 else:

    +255:                     wt_mod_next = self.mod[0]

          /*else*/ {
            if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 255, __pyx_L1_error)}
            __pyx_t_14 = 0;
            __pyx_t_13 = -1;
            if (__pyx_t_14 < 0) {
              __pyx_t_14 += __pyx_v_self->mod.shape[0];
              if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
            } else if (unlikely(__pyx_t_14 >= __pyx_v_self->mod.shape[0])) __pyx_t_13 = 0;
            if (unlikely(__pyx_t_13 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_13);
              __PYX_ERR(0, 255, __pyx_L1_error)
            }
            __pyx_v_wt_mod_next = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_14 * __pyx_v_self->mod.strides[0]) )));
          }
          __pyx_L6:;

     256:

    +257:                 wt_mod_frac = self.mod_phase - <int>self.mod_phase

          __pyx_v_wt_mod_frac = (__pyx_v_self->mod_phase - ((int)__pyx_v_self->mod_phase));

    +258:                 wt_mod_val = self.mod[wt_mod_i]

          if (unlikely(!__pyx_v_self->mod.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 258, __pyx_L1_error)}
          __pyx_t_15 = __pyx_v_wt_mod_i;
          __pyx_t_13 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_v_self->mod.shape[0];
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_v_self->mod.shape[0])) __pyx_t_13 = 0;
          if (unlikely(__pyx_t_13 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_13);
            __PYX_ERR(0, 258, __pyx_L1_error)
          }
          __pyx_v_wt_mod_val = (*((double *) ( /* dim=0 */ (__pyx_v_self->mod.data + __pyx_t_15 * __pyx_v_self->mod.strides[0]) )));

    +259:                 wt_mod_val = (1.0 - wt_mod_frac) * wt_mod_val + (wt_mod_frac * wt_mod_next)

          __pyx_v_wt_mod_val = (((1.0 - __pyx_v_wt_mod_frac) * __pyx_v_wt_mod_val) + (__pyx_v_wt_mod_frac * __pyx_v_wt_mod_next));

    +260:                 wt_mod_val = 1.0 + (wt_mod_val * self.mod_range)

          __pyx_v_wt_mod_val = (1.0 + (__pyx_v_wt_mod_val * __pyx_v_self->mod_range));

    +261:                 self.mod_phase += wt_mod_phase_inc

          __pyx_v_self->mod_phase = (__pyx_v_self->mod_phase + __pyx_v_wt_mod_phase_inc);

     262:

     263:             # Calculate stack LFO position

    +264:             wt_lfo_phase = i * wt_lfo_phase_inc

        __pyx_v_wt_lfo_phase = (__pyx_v_i * __pyx_v_wt_lfo_phase_inc);

    +265:             wt_lfo_x = <int>wt_lfo_phase

        __pyx_v_wt_lfo_x = ((int)__pyx_v_wt_lfo_phase);

    +266:             wt_lfo_frac = wt_lfo_phase - wt_lfo_x

        __pyx_v_wt_lfo_frac = (__pyx_v_wt_lfo_phase - __pyx_v_wt_lfo_x);

    +267:             wt_lfo_y0 = self.lfo[wt_lfo_x % len(self.lfo)]

        __pyx_t_1 = __pyx_v_self->lfo;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__pyx_t_6 == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 267, __pyx_L1_error)
        }
        __pyx_t_16 = __Pyx_mod_Py_ssize_t(__pyx_v_wt_lfo_x, __pyx_t_6);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->lfo, __pyx_t_16, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_wt_lfo_y0 = __pyx_t_17;

    +268:             wt_lfo_y1 = self.lfo[(wt_lfo_x + 1) % len(self.lfo)]

        __pyx_t_18 = (__pyx_v_wt_lfo_x + 1);
        __pyx_t_1 = __pyx_v_self->lfo;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_16 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__pyx_t_16 == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 268, __pyx_L1_error)
        }
        __pyx_t_6 = __Pyx_mod_Py_ssize_t(__pyx_t_18, __pyx_t_16);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->lfo, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_wt_lfo_y1 = __pyx_t_17;

    +269:             wt_lfo_pos = (1.0 - wt_lfo_frac) * wt_lfo_y0 + (wt_lfo_frac * wt_lfo_y1)

        __pyx_v_wt_lfo_pos = (((1.0 - __pyx_v_wt_lfo_frac) * __pyx_v_wt_lfo_y0) + (__pyx_v_wt_lfo_frac * __pyx_v_wt_lfo_y1));

     270:

     271:             # Calculate wavetable value based on LFO position

    +272:             stack_phase = wt_lfo_pos * stack_depth

        __pyx_v_stack_phase = (__pyx_v_wt_lfo_pos * __pyx_v_stack_depth);

    +273:             stack_x = <int>stack_phase

        __pyx_v_stack_x = ((int)__pyx_v_stack_phase);

    +274:             wt_phase += (wt_phase_inc * wt_mod_val)

        __pyx_v_wt_phase = (__pyx_v_wt_phase + (__pyx_v_wt_phase_inc * __pyx_v_wt_mod_val));

    +275:             wt_x = <int>wt_phase

        __pyx_t_1 = __Pyx_PyInt_From_int(((int)__pyx_v_wt_phase)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_wt_x, __pyx_t_1);
        __pyx_t_1 = 0;

    +276:             stack_frac = stack_phase - stack_x

        __pyx_v_stack_frac = (__pyx_v_stack_phase - __pyx_v_stack_x);

    +277:             y0 = self.wavetables[stack_x % stack_depth][wt_x % self.wtsize]

        if (unlikely(__pyx_v_self->wavetables == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 277, __pyx_L1_error)
        }
        if (unlikely(__pyx_v_stack_depth == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 277, __pyx_L1_error)
        }
        __pyx_t_13 = __Pyx_mod_int(__pyx_v_stack_x, __pyx_v_stack_depth);
        __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->wavetables, __pyx_t_13, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->wtsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyNumber_Remainder(__pyx_v_wt_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_y0 = __pyx_t_17;

    +278:             y1 = self.wavetables[(stack_x + 1) % stack_depth][wt_x % self.wtsize]

        if (unlikely(__pyx_v_self->wavetables == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 278, __pyx_L1_error)
        }
        __pyx_t_18 = (__pyx_v_stack_x + 1);
        if (unlikely(__pyx_v_stack_depth == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 278, __pyx_L1_error)
        }
        __pyx_t_19 = __Pyx_mod_long(__pyx_t_18, __pyx_v_stack_depth);
        __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_self->wavetables, __pyx_t_19, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->wtsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyNumber_Remainder(__pyx_v_wt_x, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_y1 = __pyx_t_17;

    +279:             val = (1.0 - stack_frac) * y0 + (stack_frac * y1)

        __pyx_v_val = (((1.0 - __pyx_v_stack_frac) * __pyx_v_y0) + (__pyx_v_stack_frac * __pyx_v_y1));

     280:

    +281:             for channel in range(self.channels):

        __pyx_t_13 = __pyx_v_self->channels;
        __pyx_t_20 = __pyx_t_13;
        for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
          __pyx_v_channel = __pyx_t_21;

    +282:                 out[i][channel] = val * self.amp

          __pyx_t_22 = __pyx_v_i;
          __pyx_t_23 = __pyx_v_channel;
          __pyx_t_24 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_v_out.shape[0];
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_24 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_v_out.shape[0])) __pyx_t_24 = 0;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_v_out.shape[1];
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_24 = 1;
          } else if (unlikely(__pyx_t_23 >= __pyx_v_out.shape[1])) __pyx_t_24 = 1;
          if (unlikely(__pyx_t_24 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_24);
            __PYX_ERR(0, 282, __pyx_L1_error)
          }
          *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_22 * __pyx_v_out.strides[0]) ) + __pyx_t_23 * __pyx_v_out.strides[1]) )) = (__pyx_v_val * __pyx_v_self->amp);
        }
      }

     283:

    +284:         return SoundBuffer(out, channels=self.channels, samplerate=self.samplerate)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_out, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_channels, __pyx_t_3) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->samplerate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_samplerate, __pyx_t_3) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pippi_11soundbuffer_SoundBuffer), __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     285:

     286:

    +287: cdef class Fold:

    struct __pyx_obj_5pippi_4oscs_Fold {
      PyObject_HEAD
      struct __pyx_vtabstruct_5pippi_4oscs_Fold *__pyx_vtab;
      __Pyx_memviewslice wavetable;
      __Pyx_memviewslice factors;
      double factFreq;
      double freq;
      double amp;
      int channels;
      int samplerate;
      int wtsize;
    };
    /* … */
    struct __pyx_vtabstruct_5pippi_4oscs_Fold {
      struct __pyx_obj_5pippi_11soundbuffer_SoundBuffer *(*_play)(struct __pyx_obj_5pippi_4oscs_Fold *, double);
    };
    static struct __pyx_vtabstruct_5pippi_4oscs_Fold *__pyx_vtabptr_5pippi_4oscs_Fold;

     288:     """ Folding wavetable oscilator

     289:     """

    +290:     cdef public double[:] wavetable

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_9wavetable_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_9wavetable_1__get__(PyObject *__pyx_v_self) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_9wavetable___get__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_9wavetable___get__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 290, __pyx_L1_error)}
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_self->wavetable, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.wavetable.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_9wavetable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_9wavetable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_9wavetable_2__set__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((PyObject *)__pyx_v_value));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold_9wavetable_2__set__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__", 0);
      __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_value, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 290, __pyx_L1_error)
      __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
      __pyx_v_self->wavetable = __pyx_t_1;
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;

      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __Pyx_AddTraceback("pippi.oscs.Fold.wavetable.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +291:     cdef public double[:] factors

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_7factors_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_7factors_1__get__(PyObject *__pyx_v_self) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_7factors___get__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_7factors___get__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_self->factors.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 291, __pyx_L1_error)}
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_self->factors, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.factors.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_7factors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_7factors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_7factors_2__set__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((PyObject *)__pyx_v_value));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold_7factors_2__set__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__", 0);
      __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_value, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 291, __pyx_L1_error)
      __PYX_XDEC_MEMVIEW(&__pyx_v_self->factors, 0);
      __pyx_v_self->factors = __pyx_t_1;
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;

      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __Pyx_AddTraceback("pippi.oscs.Fold.factors.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +292:     cdef public double factFreq

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_8factFreq_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_8factFreq_1__get__(PyObject *__pyx_v_self) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_8factFreq___get__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_8factFreq___get__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->factFreq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.factFreq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_8factFreq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_8factFreq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_8factFreq_2__set__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((PyObject *)__pyx_v_value));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold_8factFreq_2__set__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__", 0);
      __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
      __pyx_v_self->factFreq = __pyx_t_1;

      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_AddTraceback("pippi.oscs.Fold.factFreq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +293:     cdef public double freq

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_4freq_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_4freq_1__get__(PyObject *__pyx_v_self) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_4freq___get__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_4freq___get__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->freq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.freq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_4freq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_4freq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_4freq_2__set__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((PyObject *)__pyx_v_value));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold_4freq_2__set__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__", 0);
      __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error)
      __pyx_v_self->freq = __pyx_t_1;

      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_AddTraceback("pippi.oscs.Fold.freq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +294:     cdef public double amp

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_3amp_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_3amp_1__get__(PyObject *__pyx_v_self) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_3amp___get__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_3amp___get__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->amp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.amp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_3amp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_3amp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_3amp_2__set__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((PyObject *)__pyx_v_value));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold_3amp_2__set__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, PyObject *__pyx_v_value) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__", 0);
      __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
      __pyx_v_self->amp = __pyx_t_1;

      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_AddTraceback("pippi.oscs.Fold.amp.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     295:     cdef int channels

     296:     cdef int samplerate

     297:     cdef int wtsize

     298:

     299:

    +300:     def __init__(

    /* Python wrapper */
    static int __pyx_pw_5pippi_4oscs_4Fold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_5pippi_4oscs_4Fold_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      __Pyx_memviewslice __pyx_v_wavetable = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_factors = { 0, 0, { 0 }, { 0 }, { 0 } };
      double __pyx_v_freq;
      double __pyx_v_factFreq;
      double __pyx_v_amp;
      int __pyx_v_wtsize;
      int __pyx_v_channels;
      int __pyx_v_samplerate;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavetable,&__pyx_n_s_factors,&__pyx_n_s_freq,&__pyx_n_s_factFreq,&__pyx_n_s_amp,&__pyx_n_s_wtsize,&__pyx_n_s_channels,&__pyx_n_s_samplerate,0};
        PyObject* values[8] = {0,0,0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavetable);
              if (value) { values[0] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factors);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factFreq);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amp);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wtsize);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_channels);
              if (value) { values[6] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplerate);
              if (value) { values[7] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 300, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        if (values[0]) {
          __pyx_v_wavetable = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_wavetable.memview)) __PYX_ERR(0, 302, __pyx_L3_error)
        } else {
          __pyx_v_wavetable = __pyx_k__10;
          __PYX_INC_MEMVIEW(&__pyx_v_wavetable, 1);
        }
        if (values[1]) {
          __pyx_v_factors = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_factors.memview)) __PYX_ERR(0, 303, __pyx_L3_error)
        } else {
          __pyx_v_factors = __pyx_k__11;
          __PYX_INC_MEMVIEW(&__pyx_v_factors, 1);
        }
        if (values[2]) {
          __pyx_v_freq = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L3_error)
        } else {
          __pyx_v_freq = ((double)440.0);
        }
        if (values[3]) {
          __pyx_v_factFreq = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_factFreq == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L3_error)
        } else {
          __pyx_v_factFreq = ((double)1.0);
        }
        if (values[4]) {
          __pyx_v_amp = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_amp == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error)
        } else {
          __pyx_v_amp = ((double)1.0);
        }
        if (values[5]) {
          __pyx_v_wtsize = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_wtsize == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
        } else {
          __pyx_v_wtsize = ((int)0x1000);
        }
        if (values[6]) {
          __pyx_v_channels = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_channels == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
        } else {
          __pyx_v_channels = __pyx_k__12;
        }
        if (values[7]) {
          __pyx_v_samplerate = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_samplerate == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
        } else {
          __pyx_v_samplerate = __pyx_k__13;
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 300, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("pippi.oscs.Fold.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold___init__(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), __pyx_v_wavetable, __pyx_v_factors, __pyx_v_freq, __pyx_v_factFreq, __pyx_v_amp, __pyx_v_wtsize, __pyx_v_channels, __pyx_v_samplerate);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_5pippi_4oscs_4Fold___init__(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, __Pyx_memviewslice __pyx_v_wavetable, __Pyx_memviewslice __pyx_v_factors, double __pyx_v_freq, double __pyx_v_factFreq, double __pyx_v_amp, int __pyx_v_wtsize, int __pyx_v_channels, int __pyx_v_samplerate) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_wavetable, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_factors, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     301:             self,

    +302:             double[:] wavetable=None,

      __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 302, __pyx_L1_error)
      __pyx_k__10 = __pyx_t_3;
      __pyx_t_3.memview = NULL;
      __pyx_t_3.data = NULL;

    +303:             double[:] factors=None,

      __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 303, __pyx_L1_error)
      __pyx_k__11 = __pyx_t_3;
      __pyx_t_3.memview = NULL;
      __pyx_t_3.data = NULL;

     304:             double freq=440,

     305:             double factFreq=1,

     306:             double amp=1,

     307:             int wtsize=4096,

    +308:             int channels=DEFAULT_CHANNELS,

      __pyx_k__12 = __pyx_v_5pippi_4oscs_DEFAULT_CHANNELS;

    +309:             int samplerate=DEFAULT_SAMPLERATE,

      __pyx_k__13 = __pyx_v_5pippi_4oscs_DEFAULT_SAMPLERATE;

     310:         ):

     311:

    +312:         self.freq = freq

      __pyx_v_self->freq = __pyx_v_freq;

    +313:         self.factFreq = factFreq

      __pyx_v_self->factFreq = __pyx_v_factFreq;

    +314:         self.amp = amp

      __pyx_v_self->amp = __pyx_v_amp;

     315:

    +316:         self.channels = channels

      __pyx_v_self->channels = __pyx_v_channels;

    +317:         self.samplerate = samplerate

      __pyx_v_self->samplerate = __pyx_v_samplerate;

    +318:         self.wtsize = wtsize

      __pyx_v_self->wtsize = __pyx_v_wtsize;

     319:

    +320:         self.wavetable = wavetable

      __PYX_XDEC_MEMVIEW(&__pyx_v_self->wavetable, 0);
      __PYX_INC_MEMVIEW(&__pyx_v_wavetable, 0);
      __pyx_v_self->wavetable = __pyx_v_wavetable;

    +321:         self.factors = factors

      __PYX_XDEC_MEMVIEW(&__pyx_v_self->factors, 0);
      __PYX_INC_MEMVIEW(&__pyx_v_factors, 0);
      __pyx_v_self->factors = __pyx_v_factors;

     322:

    +323:     def play(self, double length):

    /* Python wrapper */
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_3play(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/
    static PyObject *__pyx_pw_5pippi_4oscs_4Fold_3play(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) {
      double __pyx_v_length;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("play (wrapper)", 0);
      assert(__pyx_arg_length); {
        __pyx_v_length = __pyx_PyFloat_AsDouble(__pyx_arg_length); if (unlikely((__pyx_v_length == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      __Pyx_AddTraceback("pippi.oscs.Fold.play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_5pippi_4oscs_4Fold_2play(((struct __pyx_obj_5pippi_4oscs_Fold *)__pyx_v_self), ((double)__pyx_v_length));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5pippi_4oscs_4Fold_2play(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, double __pyx_v_length) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("play", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("pippi.oscs.Fold.play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +324:         return self._play(length)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5pippi_4oscs_Fold *)__pyx_v_self->__pyx_vtab)->_play(__pyx_v_self, __pyx_v_length)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     325:

    +326:     cdef SoundBuffer _play(self, double length):

    static struct __pyx_obj_5pippi_11soundbuffer_SoundBuffer *__pyx_f_5pippi_4oscs_4Fold__play(struct __pyx_obj_5pippi_4oscs_Fold *__pyx_v_self, double __pyx_v_length) {
      int __pyx_v_framelength;
      int __pyx_v_i;
      int __pyx_v_channel;
      double __pyx_v_valWaveform;
      double __pyx_v_valNextWaveform;
      int __pyx_v_cIndexWaveform;
      double __pyx_v_fracWaveform;
      double __pyx_v_valFactors;
      double __pyx_v_valNextFactors;
      int __pyx_v_cIndexFactors;
      double __pyx_v_fracFactors;
      double __pyx_v_indexWaveform;
      double __pyx_v_indexFactors;
      int __pyx_v_lenWaveform;
      int __pyx_v_lenFactors;
      double __pyx_v_fold_out;
      double __pyx_v_last_value;
      int __pyx_v_pos_thresh;
      int __pyx_v_neg_thresh;
      int __pyx_v_state;
      double __pyx_v_difference;
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      struct __pyx_obj_5pippi_11soundbuffer_SoundBuffer *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_play", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
      __Pyx_AddTraceback("pippi.oscs.Fold._play", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_XGIVEREF((PyObject *)__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +327:         cdef int framelength = <int>(length * self.samplerate)

      __pyx_v_framelength = ((int)(__pyx_v_length * __pyx_v_self->samplerate));

     328:         cdef int i

    +329:         cdef int channel = 0

      __pyx_v_channel = 0;

     330:

     331:         cdef double valWaveform, valNextWaveform, freq, factFreq

    +332:         cdef int cIndexWaveform = 0

      __pyx_v_cIndexWaveform = 0;

    +333:         cdef double fracWaveform = 0

      __pyx_v_fracWaveform = 0.0;

     334:

     335:         cdef double valFactors, valNextFactors

    +336:         cdef int cIndexFactors = 0

      __pyx_v_cIndexFactors = 0;

    +337:         cdef double fracFactors = 0

      __pyx_v_fracFactors = 0.0;

     338:

    +339:         cdef double indexWaveform = 0

      __pyx_v_indexWaveform = 0.0;

    +340:         cdef double indexFactors = 0

      __pyx_v_indexFactors = 0.0;

     341:

    +342:         cdef int lenWaveform = len(self.wavetable)

      if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 342, __pyx_L1_error)}
      __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_self->wavetable);
      __pyx_v_lenWaveform = __pyx_t_1;

    +343:         cdef int lenFactors = len(self.factors)

      if (unlikely(!__pyx_v_self->factors.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 343, __pyx_L1_error)}
      __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_self->factors);
      __pyx_v_lenFactors = __pyx_t_1;

     344:

    +345:         cdef double fold_out = 0

      __pyx_v_fold_out = 0.0;

    +346:         cdef double last_value = 0

      __pyx_v_last_value = 0.0;

    +347:         cdef int pos_thresh = 1

      __pyx_v_pos_thresh = 1;

    +348:         cdef int neg_thresh = -1

      __pyx_v_neg_thresh = -1;

    +349:         cdef int state = 1

      __pyx_v_state = 1;

    +350:         cdef double difference = 0

      __pyx_v_difference = 0.0;

     351:

    +352:         cdef double[:,:] out = np.zeros((framelength, self.channels), dtype='d')

      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_framelength); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_u_d) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 352, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_out = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;

     353:

    +354:         for i in range(framelength):

      __pyx_t_7 = __pyx_v_framelength;
      __pyx_t_8 = __pyx_t_7;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
        __pyx_v_i = __pyx_t_9;

     355:             # Interp waveform wavetable

    +356:             cIndexWaveform = <int>indexWaveform % (lenWaveform - 1)

        __pyx_t_10 = (__pyx_v_lenWaveform - 1);
        if (unlikely(__pyx_t_10 == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 356, __pyx_L1_error)
        }
        __pyx_v_cIndexWaveform = __Pyx_mod_long(((int)__pyx_v_indexWaveform), __pyx_t_10);

    +357:             valWaveform = self.wavetable[cIndexWaveform]

        if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 357, __pyx_L1_error)}
        __pyx_t_11 = __pyx_v_cIndexWaveform;
        __pyx_t_12 = -1;
        if (__pyx_t_11 < 0) {
          __pyx_t_11 += __pyx_v_self->wavetable.shape[0];
          if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_11 >= __pyx_v_self->wavetable.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          __PYX_ERR(0, 357, __pyx_L1_error)
        }
        __pyx_v_valWaveform = (*((double *) ( /* dim=0 */ (__pyx_v_self->wavetable.data + __pyx_t_11 * __pyx_v_self->wavetable.strides[0]) )));

    +358:             valNextWaveform = self.wavetable[cIndexWaveform + 1]

        if (unlikely(!__pyx_v_self->wavetable.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 358, __pyx_L1_error)}
        __pyx_t_13 = (__pyx_v_cIndexWaveform + 1);
        __pyx_t_12 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_v_self->wavetable.shape[0];
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_v_self->wavetable.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          __PYX_ERR(0, 358, __pyx_L1_error)
        }
        __pyx_v_valNextWaveform = (*((double *) ( /* dim=0 */ (__pyx_v_self->wavetable.data + __pyx_t_13 * __pyx_v_self->wavetable.strides[0]) )));

    +359:             fracWaveform = indexWaveform - <int>indexWaveform

        __pyx_v_fracWaveform = (__pyx_v_indexWaveform - ((int)__pyx_v_indexWaveform));

    +360:             valWaveform = (1.0 - fracWaveform) * valWaveform + fracWaveform * valNextWaveform

        __pyx_v_valWaveform = (((1.0 - __pyx_v_fracWaveform) * __pyx_v_valWaveform) + (__pyx_v_fracWaveform * __pyx_v_valNextWaveform));

     361:

     362:             # Interp factors wavetable

    +363:             cIndexFactors = <int>indexFactors % (lenFactors - 1)

        __pyx_t_10 = (__pyx_v_lenFactors - 1);
        if (unlikely(__pyx_t_10 == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(0, 363, __pyx_L1_error)
        }
        __pyx_v_cIndexFactors = __Pyx_mod_long(((int)__pyx_v_indexFactors), __pyx_t_10);

    +364:             valFactors = self.factors[cIndexFactors]

        if (unlikely(!__pyx_v_self->factors.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 364, __pyx_L1_error)}
        __pyx_t_14 = __pyx_v_cIndexFactors;
        __pyx_t_12 = -1;
        if (__pyx_t_14 < 0) {
          __pyx_t_14 += __pyx_v_self->factors.shape[0];
          if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_14 >= __pyx_v_self->factors.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          __PYX_ERR(0, 364, __pyx_L1_error)
        }
        __pyx_v_valFactors = (*((double *) ( /* dim=0 */ (__pyx_v_self->factors.data + __pyx_t_14 * __pyx_v_self->factors.strides[0]) )));

    +365:             valNextFactors = self.factors[cIndexFactors + 1]

        if (unlikely(!__pyx_v_self->factors.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 365, __pyx_L1_error)}
        __pyx_t_15 = (__pyx_v_cIndexFactors + 1);
        __pyx_t_12 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_v_self->factors.shape[0];
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_v_self->factors.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          __PYX_ERR(0, 365, __pyx_L1_error)
        }
        __pyx_v_valNextFactors = (*((double *) ( /* dim=0 */ (__pyx_v_self->factors.data + __pyx_t_15 * __pyx_v_self->factors.strides[0]) )));

    +366:             fracFactors = indexFactors - <int>indexFactors

        __pyx_v_fracFactors = (__pyx_v_indexFactors - ((int)__pyx_v_indexFactors));

    +367:             valFactors = (1.0 - fracFactors) * valFactors + fracFactors * valNextFactors

        __pyx_v_valFactors = (((1.0 - __pyx_v_fracFactors) * __pyx_v_valFactors) + (__pyx_v_fracFactors * __pyx_v_valNextFactors));

    +368:             valWaveform *= valFactors

        __pyx_v_valWaveform = (__pyx_v_valWaveform * __pyx_v_valFactors);

     369:

     370:             # Do the folding

     371:             # the magic is ripped from guest's posts on muffwiggler:

     372:             # http://www.muffwiggler.com/forum/viewtopic.php?p=1586526#1586526

    +373:             difference = valWaveform - last_value

        __pyx_v_difference = (__pyx_v_valWaveform - __pyx_v_last_value);

    +374:             last_value = valWaveform

        __pyx_v_last_value = __pyx_v_valWaveform;

    +375:             if state == 1:

        __pyx_t_16 = ((__pyx_v_state == 1) != 0);
        if (__pyx_t_16) {
    /* … */
          goto __pyx_L5;
        }

    +376:                 fold_out -= difference

          __pyx_v_fold_out = (__pyx_v_fold_out - __pyx_v_difference);

     377:             else:

    +378:                 fold_out += difference

        /*else*/ {
          __pyx_v_fold_out = (__pyx_v_fold_out + __pyx_v_difference);
        }
        __pyx_L5:;

     379:

    +380:             if fold_out >= pos_thresh:

        __pyx_t_16 = ((__pyx_v_fold_out >= __pyx_v_pos_thresh) != 0);
        if (__pyx_t_16) {
    /* … */
          goto __pyx_L6;
        }

    +381:                 state ^= 1

          __pyx_v_state = (__pyx_v_state ^ 1);

    +382:                 fold_out = pos_thresh - (fold_out - pos_thresh)

          __pyx_v_fold_out = (__pyx_v_pos_thresh - (__pyx_v_fold_out - __pyx_v_pos_thresh));

    +383:             elif fold_out <= neg_thresh:

        __pyx_t_16 = ((__pyx_v_fold_out <= __pyx_v_neg_thresh) != 0);
        if (__pyx_t_16) {
    /* … */
        }
        __pyx_L6:;

    +384:                 state ^= 1

          __pyx_v_state = (__pyx_v_state ^ 1);

    +385:                 fold_out = neg_thresh - (fold_out - neg_thresh)

          __pyx_v_fold_out = (__pyx_v_neg_thresh - (__pyx_v_fold_out - __pyx_v_neg_thresh));

     386:

    +387:             for channel in range(self.channels):

        __pyx_t_12 = __pyx_v_self->channels;
        __pyx_t_17 = __pyx_t_12;
        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
          __pyx_v_channel = __pyx_t_18;

    +388:                 out[i][channel] = self.amp * fold_out

          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_channel;
          __pyx_t_21 = -1;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_v_out.shape[0];
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 0;
          } else if (unlikely(__pyx_t_19 >= __pyx_v_out.shape[0])) __pyx_t_21 = 0;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_v_out.shape[1];
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 1;
          } else if (unlikely(__pyx_t_20 >= __pyx_v_out.shape[1])) __pyx_t_21 = 1;
          if (unlikely(__pyx_t_21 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_21);
            __PYX_ERR(0, 388, __pyx_L1_error)
          }
          *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_19 * __pyx_v_out.strides[0]) ) + __pyx_t_20 * __pyx_v_out.strides[1]) )) = (__pyx_v_self->amp * __pyx_v_fold_out);
        }

     389:

    +390:             indexWaveform += self.freq * lenWaveform * (1.0 / self.samplerate)

        if (unlikely(__pyx_v_self->samplerate == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          __PYX_ERR(0, 390, __pyx_L1_error)
        }
        __pyx_v_indexWaveform = (__pyx_v_indexWaveform + ((__pyx_v_self->freq * __pyx_v_lenWaveform) * (1.0 / ((double)__pyx_v_self->samplerate))));

    +391:             indexFactors += self.factFreq * lenFactors * (1.0 / self.samplerate)

        if (unlikely(__pyx_v_self->samplerate == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          __PYX_ERR(0, 391, __pyx_L1_error)
        }
        __pyx_v_indexFactors = (__pyx_v_indexFactors + ((__pyx_v_self->factFreq * __pyx_v_lenFactors) * (1.0 / ((double)__pyx_v_self->samplerate))));
      }

     392:

    +393:         return SoundBuffer(out, channels=self.channels, samplerate=self.samplerate)

      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_out, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_channels, __pyx_t_4) < 0) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->samplerate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_samplerate, __pyx_t_4) < 0) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pippi_11soundbuffer_SoundBuffer), __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((struct __pyx_obj_5pippi_11soundbuffer_SoundBuffer *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;

     394: