示例#1
0
func B2MC(b []float64, alpha float64) []float64 {
	mcep := make([]float64, len(b))

	m := len(b) - 1

	C.b2mc(
		(*C.double)(&b[0]),
		(*C.double)(&mcep[0]),
		C.int(m),
		C.double(alpha))

	return mcep
}
示例#2
0
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
}