func Append(in []float64, sig ...[]float64) []float64 {
	totalLen := len(in)
	for _, signal := range sig {
		totalLen += len(signal)
	}
	out := make([]float64, totalLen)
	currIdx := 0
	copy(out[:len(in)], in)
	currIdx += len(in)
	for _, signal := range sig {
		copy(out[currIdx:currIdx+len(signal)], signal)
		currIdx += len(signal)
	}
	return out
}
Append adds a series of signals to the input signal extending the length
package siggen
import (
	"math"
	"math/rand"
)
func Sin(amp, freq, phase, offset, sampleRate, durationSec float64) []float64 {
	nsamp := int(sampleRate * durationSec)
	out := make([]float64, nsamp)
	for i := 0; i < nsamp; i++ {
		out[i] = amp*math.Sin(2*math.Pi*freq*float64(i)/sampleRate+phase) + offset
	}
	return out
}
func Sawtooth(amp, freq, phase, offset, sampleRate, durationSec float64) []float64 {
	nsamp := int(sampleRate * durationSec)
	out := make([]float64, nsamp)
	for i := 0; i < nsamp; i++ {
		out[i] = -2*amp/math.Pi*math.Atan(1.0/math.Tan(float64(i)/sampleRate*math.Pi*freq)) + offset
	}
	return out
}
func Square(amp, freq, phase, offset, sampleRate, durationSec float64) []float64 {
	nsamp := int(sampleRate * durationSec)
	out := make([]float64, nsamp)
	var val float64
	for i := 0; i < nsamp; i++ {
		val = math.Sin(2*math.Pi*freq*float64(i)/sampleRate + phase)
		switch {
		case val > 0:
			out[i] = amp + offset
		case val < 0:
			out[i] = -amp + offset
		default:
			out[i] = offset
		}
	}
	return out
}
func Rect(amp, offset, width, sampleRate, durationSec float64) []float64 {
	nsamp := int(sampleRate * durationSec)
	out := make([]float64, nsamp)
	start := int((offset - width/2.0) / sampleRate)
	end := int((offset + width/2.0) / sampleRate)
	if start < 0 {
		start = 0
	}
	if start > nsamp-1 {
		start = nsamp - 1
	}
	if end < 0 {
		end = 0
	}
	if end > nsamp-1 {
		end = nsamp - 1
	}
	for i := start; i < end; i++ {
		out[i] = amp
	}
	return out
}
func Line(slope, offset float64, n int) []float64 {
	out := make([]float64, n)
	for i := 0; i < n; i++ {
		out[i] = slope*float64(i) + offset
	}
	return out
}
func Noise(amp float64, n int) []float64 {
	out := make([]float64, n)
	for i := 0; i < n; i++ {
		out[i] = amp * (rand.Float64() - 0.5)
	}
	return out
}
func Add(sig ...[]float64) []float64 {
	var maxLen int
	for _, signal := range sig {
		if len(signal) > maxLen {
			maxLen = len(signal)
		}
	}
	out := make([]float64, maxLen)
	for _, signal := range sig {
		for i, val := range signal {
			out[i] += val
		}
	}
	return out
}