wsjtx-lib 1.0.4 → 1.1.0

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/dist/index.d.cts DELETED
@@ -1,192 +0,0 @@
1
- import { WSJTXConfig, WSJTXMode, AudioData, DecodeResult, EncodeResult, IQData, WSPRDecodeOptions, WSPRResult, WSJTXMessage, ModeCapabilities } from './types.cjs';
2
- export { VersionInfo, WSJTXError } from './types.cjs';
3
-
4
- /**
5
- * WSJTX Digital Radio Protocol Library for Node.js
6
- *
7
- * High-level TypeScript wrapper around the native C++ WSJTX library bindings.
8
- * Provides async/await support, input validation, and convenient utilities
9
- * for working with digital amateur radio protocols.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { WSJTXLib, WSJTXMode } from 'wsjtx-lib';
14
- *
15
- * const lib = new WSJTXLib();
16
- *
17
- * // Decode FT8 audio data
18
- * const audioData = new Float32Array(48000 * 13); // 13 seconds at 48kHz
19
- * const result = await lib.decode(WSJTXMode.FT8, audioData, 1500);
20
- *
21
- * // Get decoded messages
22
- * const messages = lib.pullMessages();
23
- * console.log('Decoded messages:', messages);
24
- * ```
25
- */
26
-
27
- /**
28
- * Main WSJTX library class providing digital radio protocol processing
29
- *
30
- * This class wraps the native C++ implementation and provides a convenient
31
- * TypeScript/JavaScript interface with proper error handling, validation,
32
- * and async/await support.
33
- */
34
- declare class WSJTXLib {
35
- private native;
36
- private config;
37
- /**
38
- * Create a new WSJTX library instance
39
- *
40
- * @param config Optional configuration options
41
- * @throws {WSJTXError} If the native library fails to initialize
42
- */
43
- constructor(config?: WSJTXConfig);
44
- /**
45
- * Decode digital radio signals from audio data
46
- *
47
- * This method processes audio samples and attempts to decode digital
48
- * messages using the specified protocol mode. The operation is performed
49
- * asynchronously to avoid blocking the Node.js event loop.
50
- *
51
- * @param mode The digital mode to use for decoding
52
- * @param audioData Audio samples (Float32Array or Int16Array)
53
- * @param frequency Center frequency in Hz
54
- * @param threads Number of threads to use (1-16, default: 4)
55
- * @returns Promise that resolves when decoding is complete
56
- *
57
- * @throws {WSJTXError} If parameters are invalid or decoding fails
58
- *
59
- * @example
60
- * ```typescript
61
- * const audioData = new Float32Array(48000 * 13); // 13 seconds
62
- * await lib.decode(WSJTXMode.FT8, audioData, 1500);
63
- * const messages = lib.pullMessages();
64
- * ```
65
- */
66
- decode(mode: WSJTXMode, audioData: AudioData, frequency: number, threads?: number): Promise<DecodeResult>;
67
- /**
68
- * Encode a message into audio waveform for transmission
69
- *
70
- * Generates the audio waveform that represents the specified message
71
- * using the given digital mode. The resulting audio can be fed to
72
- * a radio transmitter or audio interface.
73
- *
74
- * @param mode The digital mode to use for encoding
75
- * @param message The message text to encode (mode-specific format)
76
- * @param frequency Center frequency in Hz
77
- * @param threads Number of threads to use (1-16, default: 4)
78
- * @returns Promise that resolves with encoded audio data and actual message sent
79
- *
80
- * @throws {WSJTXError} If parameters are invalid or encoding fails
81
- *
82
- * @example
83
- * ```typescript
84
- * const result = await lib.encode(WSJTXMode.FT8, 'CQ DX K1ABC FN20', 1500);
85
- * console.log('Generated audio samples:', result.audioData.length);
86
- * console.log('Actual message sent:', result.messageSent);
87
- * ```
88
- */
89
- encode(mode: WSJTXMode, message: string, frequency: number, threads?: number): Promise<EncodeResult>;
90
- /**
91
- * Decode WSPR signals from IQ data
92
- *
93
- * WSPR (Weak Signal Propagation Reporter) is a specialized protocol
94
- * for studying radio propagation. This method takes IQ (complex)
95
- * samples and attempts to decode WSPR transmissions.
96
- *
97
- * @param iqData Interleaved I,Q samples as Float32Array
98
- * @param options Decoder options (frequency, callsign, etc.)
99
- * @returns Promise that resolves with array of decoded WSPR results
100
- *
101
- * @throws {WSJTXError} If parameters are invalid or decoding fails
102
- *
103
- * @example
104
- * ```typescript
105
- * const iqData = new Float32Array(2 * 12000 * 111); // 2 minutes of IQ data
106
- * const options = {
107
- * dialFrequency: 14095600, // 20m WSPR frequency
108
- * callsign: 'K1ABC',
109
- * locator: 'FN20'
110
- * };
111
- * const results = await lib.decodeWSPR(iqData, options);
112
- * ```
113
- */
114
- decodeWSPR(iqData: IQData, options?: WSPRDecodeOptions): Promise<WSPRResult[]>;
115
- /**
116
- * Retrieve decoded messages from the internal queue
117
- *
118
- * Messages are added to an internal queue as they are decoded.
119
- * This method retrieves and removes all pending messages from the queue.
120
- *
121
- * @returns Array of decoded messages
122
- *
123
- * @example
124
- * ```typescript
125
- * const messages = lib.pullMessages();
126
- * messages.forEach(msg => {
127
- * console.log(`${msg.text} (SNR: ${msg.snr} dB, ΔT: ${msg.deltaTime}s)`);
128
- * });
129
- * ```
130
- */
131
- pullMessages(): WSJTXMessage[];
132
- /**
133
- * Check if encoding is supported for a specific mode
134
- *
135
- * @param mode The mode to check
136
- * @returns True if encoding is supported
137
- */
138
- isEncodingSupported(mode: WSJTXMode): boolean;
139
- /**
140
- * Check if decoding is supported for a specific mode
141
- *
142
- * @param mode The mode to check
143
- * @returns True if decoding is supported
144
- */
145
- isDecodingSupported(mode: WSJTXMode): boolean;
146
- /**
147
- * Get the required sample rate for a specific mode
148
- *
149
- * @param mode The mode to query
150
- * @returns Sample rate in Hz
151
- */
152
- getSampleRate(mode: WSJTXMode): number;
153
- /**
154
- * Get the transmission duration for a specific mode
155
- *
156
- * @param mode The mode to query
157
- * @returns Duration in seconds
158
- */
159
- getTransmissionDuration(mode: WSJTXMode): number;
160
- /**
161
- * Get capabilities for all supported modes
162
- *
163
- * @returns Array of mode capability information
164
- */
165
- getAllModeCapabilities(): ModeCapabilities[];
166
- /**
167
- * Convert audio format between Float32Array and Int16Array
168
- *
169
- * @param audioData Input audio data
170
- * @param targetFormat Target format ('float32' or 'int16')
171
- * @returns Converted audio data
172
- */
173
- static convertAudioFormat(audioData: AudioData, targetFormat: 'float32' | 'int16'): AudioData;
174
- /**
175
- * Static convenience helper for async audio format conversion.
176
- */
177
- static convertAudioFormatAsync(audioData: AudioData, targetFormat: 'float32' | 'int16'): Promise<AudioData>;
178
- /**
179
- * Asynchronously convert audio data format without blocking the event loop
180
- *
181
- * Uses native thread pool to offload conversion.
182
- */
183
- convertAudioFormatAsync(audioData: AudioData, targetFormat: 'float32' | 'int16'): Promise<AudioData>;
184
- private validateMode;
185
- private validateFrequency;
186
- private validateThreads;
187
- private validateMessage;
188
- private validateAudioData;
189
- private validateIQData;
190
- }
191
-
192
- export { AudioData, DecodeResult, EncodeResult, IQData, ModeCapabilities, WSJTXConfig, WSJTXLib, WSJTXMessage, WSJTXMode, WSPRDecodeOptions, WSPRResult };
package/dist/index.d.ts DELETED
@@ -1,192 +0,0 @@
1
- import { WSJTXConfig, WSJTXMode, AudioData, DecodeResult, EncodeResult, IQData, WSPRDecodeOptions, WSPRResult, WSJTXMessage, ModeCapabilities } from './types.js';
2
- export { VersionInfo, WSJTXError } from './types.js';
3
-
4
- /**
5
- * WSJTX Digital Radio Protocol Library for Node.js
6
- *
7
- * High-level TypeScript wrapper around the native C++ WSJTX library bindings.
8
- * Provides async/await support, input validation, and convenient utilities
9
- * for working with digital amateur radio protocols.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { WSJTXLib, WSJTXMode } from 'wsjtx-lib';
14
- *
15
- * const lib = new WSJTXLib();
16
- *
17
- * // Decode FT8 audio data
18
- * const audioData = new Float32Array(48000 * 13); // 13 seconds at 48kHz
19
- * const result = await lib.decode(WSJTXMode.FT8, audioData, 1500);
20
- *
21
- * // Get decoded messages
22
- * const messages = lib.pullMessages();
23
- * console.log('Decoded messages:', messages);
24
- * ```
25
- */
26
-
27
- /**
28
- * Main WSJTX library class providing digital radio protocol processing
29
- *
30
- * This class wraps the native C++ implementation and provides a convenient
31
- * TypeScript/JavaScript interface with proper error handling, validation,
32
- * and async/await support.
33
- */
34
- declare class WSJTXLib {
35
- private native;
36
- private config;
37
- /**
38
- * Create a new WSJTX library instance
39
- *
40
- * @param config Optional configuration options
41
- * @throws {WSJTXError} If the native library fails to initialize
42
- */
43
- constructor(config?: WSJTXConfig);
44
- /**
45
- * Decode digital radio signals from audio data
46
- *
47
- * This method processes audio samples and attempts to decode digital
48
- * messages using the specified protocol mode. The operation is performed
49
- * asynchronously to avoid blocking the Node.js event loop.
50
- *
51
- * @param mode The digital mode to use for decoding
52
- * @param audioData Audio samples (Float32Array or Int16Array)
53
- * @param frequency Center frequency in Hz
54
- * @param threads Number of threads to use (1-16, default: 4)
55
- * @returns Promise that resolves when decoding is complete
56
- *
57
- * @throws {WSJTXError} If parameters are invalid or decoding fails
58
- *
59
- * @example
60
- * ```typescript
61
- * const audioData = new Float32Array(48000 * 13); // 13 seconds
62
- * await lib.decode(WSJTXMode.FT8, audioData, 1500);
63
- * const messages = lib.pullMessages();
64
- * ```
65
- */
66
- decode(mode: WSJTXMode, audioData: AudioData, frequency: number, threads?: number): Promise<DecodeResult>;
67
- /**
68
- * Encode a message into audio waveform for transmission
69
- *
70
- * Generates the audio waveform that represents the specified message
71
- * using the given digital mode. The resulting audio can be fed to
72
- * a radio transmitter or audio interface.
73
- *
74
- * @param mode The digital mode to use for encoding
75
- * @param message The message text to encode (mode-specific format)
76
- * @param frequency Center frequency in Hz
77
- * @param threads Number of threads to use (1-16, default: 4)
78
- * @returns Promise that resolves with encoded audio data and actual message sent
79
- *
80
- * @throws {WSJTXError} If parameters are invalid or encoding fails
81
- *
82
- * @example
83
- * ```typescript
84
- * const result = await lib.encode(WSJTXMode.FT8, 'CQ DX K1ABC FN20', 1500);
85
- * console.log('Generated audio samples:', result.audioData.length);
86
- * console.log('Actual message sent:', result.messageSent);
87
- * ```
88
- */
89
- encode(mode: WSJTXMode, message: string, frequency: number, threads?: number): Promise<EncodeResult>;
90
- /**
91
- * Decode WSPR signals from IQ data
92
- *
93
- * WSPR (Weak Signal Propagation Reporter) is a specialized protocol
94
- * for studying radio propagation. This method takes IQ (complex)
95
- * samples and attempts to decode WSPR transmissions.
96
- *
97
- * @param iqData Interleaved I,Q samples as Float32Array
98
- * @param options Decoder options (frequency, callsign, etc.)
99
- * @returns Promise that resolves with array of decoded WSPR results
100
- *
101
- * @throws {WSJTXError} If parameters are invalid or decoding fails
102
- *
103
- * @example
104
- * ```typescript
105
- * const iqData = new Float32Array(2 * 12000 * 111); // 2 minutes of IQ data
106
- * const options = {
107
- * dialFrequency: 14095600, // 20m WSPR frequency
108
- * callsign: 'K1ABC',
109
- * locator: 'FN20'
110
- * };
111
- * const results = await lib.decodeWSPR(iqData, options);
112
- * ```
113
- */
114
- decodeWSPR(iqData: IQData, options?: WSPRDecodeOptions): Promise<WSPRResult[]>;
115
- /**
116
- * Retrieve decoded messages from the internal queue
117
- *
118
- * Messages are added to an internal queue as they are decoded.
119
- * This method retrieves and removes all pending messages from the queue.
120
- *
121
- * @returns Array of decoded messages
122
- *
123
- * @example
124
- * ```typescript
125
- * const messages = lib.pullMessages();
126
- * messages.forEach(msg => {
127
- * console.log(`${msg.text} (SNR: ${msg.snr} dB, ΔT: ${msg.deltaTime}s)`);
128
- * });
129
- * ```
130
- */
131
- pullMessages(): WSJTXMessage[];
132
- /**
133
- * Check if encoding is supported for a specific mode
134
- *
135
- * @param mode The mode to check
136
- * @returns True if encoding is supported
137
- */
138
- isEncodingSupported(mode: WSJTXMode): boolean;
139
- /**
140
- * Check if decoding is supported for a specific mode
141
- *
142
- * @param mode The mode to check
143
- * @returns True if decoding is supported
144
- */
145
- isDecodingSupported(mode: WSJTXMode): boolean;
146
- /**
147
- * Get the required sample rate for a specific mode
148
- *
149
- * @param mode The mode to query
150
- * @returns Sample rate in Hz
151
- */
152
- getSampleRate(mode: WSJTXMode): number;
153
- /**
154
- * Get the transmission duration for a specific mode
155
- *
156
- * @param mode The mode to query
157
- * @returns Duration in seconds
158
- */
159
- getTransmissionDuration(mode: WSJTXMode): number;
160
- /**
161
- * Get capabilities for all supported modes
162
- *
163
- * @returns Array of mode capability information
164
- */
165
- getAllModeCapabilities(): ModeCapabilities[];
166
- /**
167
- * Convert audio format between Float32Array and Int16Array
168
- *
169
- * @param audioData Input audio data
170
- * @param targetFormat Target format ('float32' or 'int16')
171
- * @returns Converted audio data
172
- */
173
- static convertAudioFormat(audioData: AudioData, targetFormat: 'float32' | 'int16'): AudioData;
174
- /**
175
- * Static convenience helper for async audio format conversion.
176
- */
177
- static convertAudioFormatAsync(audioData: AudioData, targetFormat: 'float32' | 'int16'): Promise<AudioData>;
178
- /**
179
- * Asynchronously convert audio data format without blocking the event loop
180
- *
181
- * Uses native thread pool to offload conversion.
182
- */
183
- convertAudioFormatAsync(audioData: AudioData, targetFormat: 'float32' | 'int16'): Promise<AudioData>;
184
- private validateMode;
185
- private validateFrequency;
186
- private validateThreads;
187
- private validateMessage;
188
- private validateAudioData;
189
- private validateIQData;
190
- }
191
-
192
- export { AudioData, DecodeResult, EncodeResult, IQData, ModeCapabilities, WSJTXConfig, WSJTXLib, WSJTXMessage, WSJTXMode, WSPRDecodeOptions, WSPRResult };