diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2025-03-07 15:29:01 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2025-03-07 15:29:01 -0300 |
commit | c97871470f0f3f224a95177ec84b3156b66f3ac4 (patch) | |
tree | 3760e4216eaf9c9964ed92a13cd0402d026e3191 | |
parent | 31a76d788d7b2cc4af095d6623cf78228e949b63 (diff) |
Tweak mod/demod slightly
-rw-r--r-- | src/main/kotlin/space/autistic/radio/fmsim/FmFullDemodulator.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/space/autistic/radio/fmsim/FmFullModulator.kt | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/kotlin/space/autistic/radio/fmsim/FmFullDemodulator.kt b/src/main/kotlin/space/autistic/radio/fmsim/FmFullDemodulator.kt index ce32c77..de44e69 100644 --- a/src/main/kotlin/space/autistic/radio/fmsim/FmFullDemodulator.kt +++ b/src/main/kotlin/space/autistic/radio/fmsim/FmFullDemodulator.kt @@ -65,7 +65,7 @@ class FmFullDemodulator { for (i in 0 until fft48kBuf.capacity()) { fft48kBuf.put(i, 0f) } - for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K and 1.inv()) step 2) { + for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K - 2 and 1.inv()) step 2) { z.x = fft300kBuf.get(i) z.y = fft300kBuf.get(i + 1) w.x = fir48kLpf.get(i) @@ -104,7 +104,7 @@ class FmFullDemodulator { val base = FmFullConstants.FREQUENCY_MIXING_BINS_38K * 2 val sz = Vector2f() val sw = Vector2f() - for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K and 1.inv()) step 2) { + for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K - 2 and 1.inv()) step 2) { sz.x = fft300kBuf.get(base + i) sz.y = fft300kBuf.get(base + i + 1) sw.x = fft300kBuf.get(base - i) diff --git a/src/main/kotlin/space/autistic/radio/fmsim/FmFullModulator.kt b/src/main/kotlin/space/autistic/radio/fmsim/FmFullModulator.kt index 7334c37..1f3849e 100644 --- a/src/main/kotlin/space/autistic/radio/fmsim/FmFullModulator.kt +++ b/src/main/kotlin/space/autistic/radio/fmsim/FmFullModulator.kt @@ -68,7 +68,7 @@ class FmFullModulator { } val z = Vector2f() val w = Vector2f() - for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K and 1.inv()) step 2) { + for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K - 2 and 1.inv()) step 2) { z.x = fft48kBuffer.get(i) z.y = fft48kBuffer.get(i + 1) w.x = fir48kLpf.get(i) @@ -88,7 +88,7 @@ class FmFullModulator { ) } val base = FmFullConstants.FREQUENCY_MIXING_BINS_38K * 2 - for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K and 1.inv()) step 2) { + for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K - 2 and 1.inv()) step 2) { z.x = fft48kBuffer.get(i) z.y = fft48kBuffer.get(i + 1) w.x = fir48kLpf.get(i) @@ -103,7 +103,7 @@ class FmFullModulator { // TODO check if this is mathematically sound val cycle = cycle19k.cmul(cycle19k, Vector2f()).cmul(I) // bandwidth we care about is about half of 38k, so just, well, half it - for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K and 1.inv()) step 2) { + for (i in 2 until (FmFullConstants.FREQUENCY_MIXING_BINS_38K - 2 and 1.inv()) step 2) { z.x = mixingBuffer.get(base + i) z.y = mixingBuffer.get(base + i + 1) // we also need the conjugate |