mixer to properly show signals larger than 1.0

This commit is contained in:
minjaesong
2023-11-25 20:00:39 +09:00
parent faf5e367be
commit 451ffe0307
2 changed files with 39 additions and 21 deletions

View File

@@ -392,7 +392,15 @@ class Convolv(ir: File, val gain: Float = decibelsToFullscale(-12.0).toFloat()):
private fun multiply(X: Array<Complex>, H: Array<Complex>): Array<Complex> {
if (X.size != H.size) throw IllegalArgumentException()
return Array(X.size) {
X[it].multiply(H[it])
//X[it].multiply(H[it])
// following is a snippet of the code from org.apache.commons.math3.complex.multiply,
// to remove the non-necessary sanity checks
val a = X[it]
val b = H[it]
val re = a.real * b.real - a.imaginary * b.imaginary
val im = a.real * b.imaginary + a.imaginary * b.real
Complex(re, im)
}
}