예제 #1
0
파일: sptk.go 프로젝트: adityanatraj/gossp
func GNorm(ceps []float64, gamma float64) []float64 {
	normalizedCeps := make([]float64, len(ceps))

	m := len(ceps) - 1
	C.gnorm(
		(*C.double)(&ceps[0]),
		(*C.double)(&normalizedCeps[0]),
		C.int(m),
		C.double(gamma))

	return normalizedCeps
}
예제 #2
0
파일: sptk.go 프로젝트: adityanatraj/gossp
func MGCep(audioBuffer []float64, flng, m int, a, g float64, n, itr1, itr2 int,
	dd float64, etype int, e, f float64, itype, otype int) []float64 {
	resultBuffer := make([]float64, m+1)

	C.mgcep(
		(*C.double)(&audioBuffer[0]),
		C.int(flng),
		(*C.double)(&resultBuffer[0]),
		C.int(m),
		C.double(a),
		C.double(g),
		C.int(n),
		C.int(itr1),
		C.int(itr2),
		C.double(dd),
		C.int(etype),
		C.double(e),
		C.double(f),
		C.int(itype))

	if otype == 0 || otype == 1 || otype == 2 || otype == 4 {
		C.ignorm((*C.double)(&resultBuffer[0]),
			(*C.double)(&resultBuffer[0]),
			C.int(m),
			C.double(g))
	}

	if otype == 0 || otype == 2 || otype == 4 {
		C.b2mc((*C.double)(&resultBuffer[0]),
			(*C.double)(&resultBuffer[0]),
			C.int(m),
			C.double(a))
	}

	if otype == 2 || otype == 4 {
		C.gnorm((*C.double)(&resultBuffer[0]),
			(*C.double)(&resultBuffer[0]),
			C.int(m),
			C.double(g))
	}

	if otype == 4 || otype == 5 {
		for i := int(m); i >= 1; i-- {
			resultBuffer[i] *= float64(g)
		}
	}

	return resultBuffer
}