@e04/ft8ts 0.0.6 → 0.0.9

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/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  [![Tests](https://github.com/e04/ft8ts/actions/workflows/test.yml/badge.svg)](https://github.com/e04/ft8ts/actions/workflows/test.yml)
4
4
 
5
- FT8 encoder and decoder in TypeScript. A port of the Fortran implementation from [WSJT-X](https://wsjt.sourceforge.io/wsjtx.html) v2.7.0.
5
+ FT8 and FT4 encoder and decoder in pure TypeScript. A port of the Fortran implementation from [WSJT-X](https://wsjt.sourceforge.io/wsjtx.html) v2.7.0.
6
6
 
7
7
  ## Overview
8
8
 
9
- FT8 is a digital amateur radio mode designed for weak-signal communication, developed by Joe Taylor (K1JT) and Steve Franke (K9AN).
9
+ FT8 and FT4 are digital amateur radio modes designed for weak-signal communication, developed by Joe Taylor (K1JT) and Steve Franke (K9AN).
10
10
 
11
- This library provides pure TypeScript implementations of both encoding and decoding, suitable for use in Node.js or the browser.
11
+ This library provides pure TypeScript implementations of both encoding and decoding for FT8 and FT4, suitable for use in Node.js or the browser.
12
12
 
13
13
  ## Demo
14
14
 
@@ -18,16 +18,12 @@ https://e04.github.io/ft8ts/example/browser/index.html
18
18
 
19
19
  ### CLI
20
20
 
21
- #### Encode
22
-
23
21
  ```bash
24
- npx tsx example/generate-ft8-wav.ts "CQ JK1IFA PM95" [--out output.wav] [--df 1000]
25
- ```
26
-
27
- #### Decode
22
+ # Decode WAV file (FT8 or FT4)
23
+ npx @e04/ft8ts decode foo.wav [--mode ft8|ft4] [--low 200] [--high 3000] [--depth 2]
28
24
 
29
- ```bash
30
- npx tsx example/decode-ft8-wav.ts ./src/__test__/190227_155815.wav [--low 200] [--high 3000] [--depth 2]
25
+ # Encode message to WAV file
26
+ npx @e04/ft8ts encode "CQ JK1IFA PM95" [--out output.wav] [--df 1000]
31
27
  ```
32
28
 
33
29
  ## Benchmark
@@ -67,7 +63,7 @@ At its maximum depth mode (Depth 3), it successfully decodes 14 messages, outper
67
63
  ### API
68
64
 
69
65
  ```typescript
70
- import { encodeFT8, decodeFT8, HashCallBook } from "@e04/ft8ts";
66
+ import { encodeFT8, decodeFT8, encodeFT4, decodeFT4, HashCallBook } from "@e04/ft8ts";
71
67
 
72
68
  // Encode a message to audio samples (Float32Array)
73
69
  const samples = encodeFT8("CQ JK1IFA PM95", {
@@ -81,7 +77,8 @@ const samples = encodeFT8("CQ JK1IFA PM95", {
81
77
  const book = new HashCallBook();
82
78
 
83
79
  // Decode audio samples to messages
84
- const decoded = decodeFT8(samples, 12000, {
80
+ const decoded = decodeFT8(samples, {
81
+ sampleRate: 12000,
85
82
  freqLow: 200,
86
83
  freqHigh: 3000,
87
84
  depth: 2,
@@ -93,21 +90,40 @@ for (const d of decoded) {
93
90
  }
94
91
  ```
95
92
 
93
+ ### FT4
94
+
95
+ ```typescript
96
+ import { encodeFT4, decodeFT4, HashCallBook } from "@e04/ft8ts";
97
+
98
+ // Encode FT4 message
99
+ const samples = encodeFT4("CQ JK1IFA PM95", {
100
+ sampleRate: 12000,
101
+ baseFrequency: 1000,
102
+ });
103
+
104
+ // Decode FT4
105
+ const book = new HashCallBook();
106
+ const decoded = decodeFT4(samples, {
107
+ sampleRate: 12000,
108
+ freqLow: 200,
109
+ freqHigh: 3000,
110
+ depth: 2,
111
+ hashCallBook: book,
112
+ });
113
+ ```
114
+
96
115
  ### Decode Options
97
116
 
98
117
  | Option | Default | Description |
99
118
  |--------|---------|-------------|
119
+ | `sampleRate` | 12000 | Input audio sample rate (Hz) |
100
120
  | `freqLow` | 200 | Lower frequency bound (Hz) |
101
121
  | `freqHigh` | 3000 | Upper frequency bound (Hz) |
102
122
  | `syncMin` | 1.2 | Minimum sync threshold |
103
123
  | `depth` | 2 | Decoding depth: 1=fast BP only, 2=BP+OSD, 3=deep |
104
- | `maxCandidates` | 300 | Maximum candidates to process |
124
+ | `maxCandidates` | 300 (FT8) / 100 (FT4) | Maximum candidates to process |
105
125
  | `hashCallBook` | — | `HashCallBook` instance for resolving hashed callsigns |
106
126
 
107
- ## ToDo
108
-
109
- - [ ] FT4 Support
110
-
111
127
  ## Build
112
128
 
113
129
  ```bash