コード例 #1
0
ファイル: sptk.go プロジェクト: adityanatraj/gossp
func IGNorm(normalizedCeps []float64, gamma float64) []float64 {
	ceps := make([]float64, len(normalizedCeps))

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

	return ceps
}
コード例 #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
}