func ReconstructSpectrum(amp, phase []float64) []complex128 {
	spec := make([]complex128, len(amp))
	for i := range amp {
		spec[i] = complex(amp[i], 0.0) * cmplx.Exp(complex(0.0, phase[i]))
	}
	return spec
}
ReconstructSpectrum returns complex spectrum from amplitude
and phase spectrum.
angle(X(k)) and |X(k)| -> X(k)
package gossp
import (
	"math"
	"math/cmplx"
)
func DivideFrames(input []float64, frameLen, frameShift int) [][]float64 {
	numFrames := int(float64(len(input)-frameLen)/float64(frameShift)) + 1
	frames := make([][]float64, numFrames)
	for i := 0; i < numFrames; i++ {
		frames[i] = input[i*frameShift : i*frameShift+frameLen]
	}
	return frames
}
func SplitSpectrum(spec []complex128) ([]float64, []float64) {
	amp := make([]float64, len(spec))
	phase := make([]float64, len(spec))
	for i, val := range spec {
		amp[i] = cmplx.Abs(val)
		phase[i] = math.Atan2(imag(val), real(val))
	}
	return amp, phase
}
func SplitSpectrogram(spectrogram [][]complex128) ([][]float64, [][]float64) {
	numFrames, numFreqBins := len(spectrogram), len(spectrogram[0])
	amp := create2DSlice(numFrames, numFreqBins)
	phase := create2DSlice(numFrames, numFreqBins)
	for i := 0; i < numFrames; i++ {
		amp[i], phase[i] = SplitSpectrum(spectrogram[i])
	}
	return amp, phase
}
func create2DSlice(rows, cols int) [][]float64 {
	s := make([][]float64, rows)
	for i := range s {
		s[i] = make([]float64, cols)
	}
	return s
}