@e04/ft8ts 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ft4/encode.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  import { encode174_91 } from "../ft8/encode.js";
2
2
  import { pack77 } from "../util/pack_jt77.js";
3
3
  import { generateFT4Waveform, type WaveformOptions } from "../util/waveform.js";
4
- import { COSTAS_A, COSTAS_B, COSTAS_C, COSTAS_D, GRAYMAP } from "./constants.js";
4
+ import { GRAYMAP } from "./constants.js";
5
5
  import { xorWithScrambler } from "./scramble.js";
6
6
 
7
+ const COSTAS_A = [0, 1, 3, 2] as const;
8
+ const COSTAS_B = [1, 0, 2, 3] as const;
9
+ const COSTAS_C = [2, 3, 1, 0] as const;
10
+ const COSTAS_D = [3, 2, 0, 1] as const;
11
+
7
12
  /**
8
13
  * Convert FT4 LDPC codeword bits into 103 channel tones.
9
14
  * Port of lib/ft4/genft4.f90.
@@ -1,4 +1,9 @@
1
- import { RVEC } from "./constants.js";
1
+ // Message scrambling vector (rvec) from WSJT-X.
2
+ const RVEC = [
3
+ 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1,
4
+ 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,
5
+ 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1,
6
+ ] as const;
2
7
 
3
8
  export function xorWithScrambler(bits77: readonly number[]): number[] {
4
9
  const out = new Array<number>(77);
@@ -1,16 +1,5 @@
1
1
  /** FT8-specific constants (lib/ft8/ft8_params.f90). */
2
2
 
3
- export const NSPS = 1920;
4
- export const NFFT1 = 2 * NSPS; // 3840
5
- export const NH1 = NFFT1 / 2; // 1920
6
- export const NSTEP = NSPS / 4; // 480
7
- export const NMAX = 15 * 12_000; // 180000
8
- export const NHSYM = Math.floor(NMAX / NSTEP) - 3; // 372
9
- export const NDOWN = 60;
10
- export const NN = 79;
11
- export const NS = 21;
12
- export const ND = 58;
13
-
14
3
  /** 7-symbol Costas array for sync. */
15
4
  export const COSTAS = [3, 1, 4, 0, 6, 5, 2] as const;
16
5