id     x_osc_fm3p
name   "x fm3p osc"
author bsp
cat    osc

oversample_factor 16

param p_color_1 0.5
param p_color_2 0.5
param p_color_3 0.5
param p_phase_rand
param p_ratio_2 0.5
param p_voicebus 0.1
param p_level_2 0
param p_level_3 0

mod m_color_1
mod m_color_2
mod m_color_3
mod m_phase_2
mod m_ratio_2
mod m_voicebus
mod m_level_2
mod m_level_3

var v_phrand_1
var v_phrand_2

<init:
  fsr seed=$4489 cycle=0 reset=0
  * $p_phase_rand
  sto v_phrand_1

  fsr seed=$dcb9 cycle=0 reset=0
  * $p_phase_rand
  sto v_phrand_2

<out:
  sin
    phase:
      sin
        phase:
          $v_phrand_2
          + $m_phase_2
        freq:
          $m_ratio_2
          fma 2 -1
          bts 4096 4
          pow 3
          qua 100
        phase:
      lle
        c:
          $m_color_2
          fma 2 -1
      * $m_level_2
        * 2
        pow 2
      + $v_phrand_1
      + bus nr=$m_voicebus
        lle
          c:
            $m_color_3
            fma 2 -1
        * $m_level_3
          * 2
          pow 2
  lle
    c:
      $m_color_1
      fma 2 -1

#  bus nr=$m_voicebus
