func Synthesis(f0 []float64, spectrogram, aperiodicity [][]float64, framePeriod float64, fs, length int) []float64 { FFTSize := C.size_t(C.GetFFTSizeForCheapTrick(C.int(fs))) spectrogramUsedInC := make2DCArrayAlternative(spectrogram) aperiodicityUsedInC := make2DCArrayAlternative(aperiodicity) synthesized := make([]float64, length) C.Synthesis((*C.double)(&f0[0]), C.int(len(f0)), (**C.double)(&spectrogramUsedInC[0]), (**C.double)(&aperiodicityUsedInC[0]), C.int(FFTSize), C.double(framePeriod), C.int(fs), C.int(len(synthesized)), (*C.double)(&synthesized[0])) return synthesized }
func CheapTrick(x []float64, fs int, timeAxis, f0 []float64) [][]float64 { FFTSize := C.size_t(C.GetFFTSizeForCheapTrick(C.int(fs))) numFreqBins := C.size_t(FFTSize/2 + 1) spectrogram := make([][]float64, len(f0)) for i := range spectrogram { spectrogram[i] = make([]float64, numFreqBins) } spectrogramUsedInC := make2DCArrayAlternative(spectrogram) C.CheapTrick((*C.double)(&x[0]), C.int(len(x)), C.int(fs), (*C.double)(&timeAxis[0]), (*C.double)(&f0[0]), C.int(len(f0)), (**C.double)(&spectrogramUsedInC[0])) return spectrogram }
func D4C(x []float64, fs int, timeAxis, f0 []float64) [][]float64 { FFTSize := C.size_t(C.GetFFTSizeForCheapTrick(C.int(fs))) numBins := C.size_t(FFTSize/2 + 1) aperiodicity := make([][]float64, len(f0)) for i := range aperiodicity { aperiodicity[i] = make([]float64, numBins) } aperiodicityUsedInC := make2DCArrayAlternative(aperiodicity) C.D4C((*C.double)(&x[0]), C.int(len(x)), C.int(fs), (*C.double)(&timeAxis[0]), (*C.double)(&f0[0]), C.int(len(f0)), C.int(FFTSize), (**C.double)(&aperiodicityUsedInC[0])) return aperiodicity }
func GetFFTSizeForCheapTrick(fs int) int { return int(C.GetFFTSizeForCheapTrick(C.int(fs))) }