code: func (o *Osc) Sample() (output float64) {
  	if o == nil {
  		return
  	}
  	o.currentSample++
  	if o.CurrentPhaseAngle < -math.Pi {
  		o.CurrentPhaseAngle += TwoPi
  	} else if o.CurrentPhaseAngle > math.Pi {
  		o.CurrentPhaseAngle -= TwoPi
  	}
  
  	var amp float64
  	if o.attackInSamples > o.currentSample {
  		// linear fade in
  		amp = float64(o.currentSample) * (o.Amplitude / float64(o.attackInSamples))
  	} else {
  		amp = o.Amplitude
  	}
  
  	switch o.Shape {
  	case WaveSine:
  		output = amp*Sine(o.CurrentPhaseAngle) + o.DcOffset
  	case WaveTriangle:
  		output = amp*Triangle(o.CurrentPhaseAngle) + o.DcOffset
  	case WaveSaw:
  		output = amp*Sawtooth(o.CurrentPhaseAngle) + o.DcOffset
  	case WaveSqr:
  		fmt.Println(o.CurrentPhaseAngle)
  		output = amp*Square(o.CurrentPhaseAngle) + o.DcOffset
  	}
  
  	o.CurrentPhaseAngle += o.phaseAngleIncr
  	return output
  }
docs: // Sample returns the next sample generated by the oscillator