aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Burk <[email protected]>2015-11-02 18:59:55 -0800
committerPhil Burk <[email protected]>2015-11-02 18:59:55 -0800
commitd705eac3210391f32764166fdbb6ef9f96623134 (patch)
tree611ce656a996d3e60ac32216280ad4b4c428f3e1 /src
parentb19ff3c002edec62070cb6c6e8d5c2e321ff0354 (diff)
fix scaling in FFT
Diffstat (limited to 'src')
-rw-r--r--src/com/jsyn/JSyn.java4
-rw-r--r--src/com/softsynth/math/FourierMath.java8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/com/jsyn/JSyn.java b/src/com/jsyn/JSyn.java
index c6e35b2..bc6f813 100644
--- a/src/com/jsyn/JSyn.java
+++ b/src/com/jsyn/JSyn.java
@@ -54,8 +54,8 @@ public class JSyn {
// Update these for every release.
private final static int VERSION_MAJOR = 16;
private final static int VERSION_MINOR = 7;
- private final static int VERSION_REVISION = 4;
- public final static int BUILD_NUMBER = 457;
+ private final static int VERSION_REVISION = 5;
+ public final static int BUILD_NUMBER = 458;
private final static long BUILD_TIME = new GregorianCalendar(2014, GregorianCalendar.DECEMBER,
25).getTime().getTime();
diff --git a/src/com/softsynth/math/FourierMath.java b/src/com/softsynth/math/FourierMath.java
index 82d4ec9..d133d7f 100644
--- a/src/com/softsynth/math/FourierMath.java
+++ b/src/com/softsynth/math/FourierMath.java
@@ -123,7 +123,7 @@ public class FourierMath {
}
public static void transform(int sign, int n, double ar[], double ai[]) {
- double scale = Math.sqrt(1.0 / n);
+ double scale = (sign > 0) ? (2.0 / n) : (0.5);
int numBits = FourierMath.numBits(n);
int[] reverseTable = getReverseTable(numBits);
@@ -150,7 +150,7 @@ public class FourierMath {
int phase = 0;
int phaseIncrement = numerator / (2 * mmax);
for (int m = 0; m < mmax; ++m) {
- double wr = sineTable[(phase + cosineOffset) & mask];
+ double wr = sineTable[(phase + cosineOffset) & mask]; // cosine
double wi = sineTable[phase];
for (i = m; i < n; i += stride) {
@@ -170,7 +170,7 @@ public class FourierMath {
}
public static void transform(int sign, int n, float ar[], float ai[]) {
- float scale = (float) Math.sqrt(1.0 / n);
+ float scale = (sign > 0) ? (2.0f / n) : (0.5f);
int numBits = FourierMath.numBits(n);
int[] reverseTable = getReverseTable(numBits);
@@ -197,7 +197,7 @@ public class FourierMath {
int phase = 0;
int phaseIncrement = numerator / (2 * mmax);
for (int m = 0; m < mmax; ++m) {
- float wr = sineTable[(phase + cosineOffset) & mask];
+ float wr = sineTable[(phase + cosineOffset) & mask]; // cosine
float wi = sineTable[phase];
for (i = m; i < n; i += stride) {