Skip to content

Commit 1851165

Browse files
committed
Added MFSKConstants
1 parent 8462e9d commit 1851165

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

AudioCoder/src/main/java/org/operatorfoundation/audiocoder/mfsk/MFSKConfiguration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.operatorfoundation.audiocoder.mfsk
1919
data class MFSKConfiguration(
2020
val mode: MFSKMode,
2121
val baseFrequencyHz: Double,
22-
val sampleRate: Int = 12_000,
23-
val amplitude: Double = 0.5,
24-
val timeoutMs: Long = 60_000L
22+
val sampleRate: Int = MFSKConstants.MFSK_RECOMMENDED_SAMPLE_RATE,
23+
val amplitude: Double = MFSKConstants.MFSK_DEFAULT_AMPLITUDE,
24+
val timeoutMs: Long = MFSKConstants.MFSK_DEFAULT_TIMEOUT_MS
2525
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.operatorfoundation.audiocoder.mfsk
2+
3+
object MFSKConstants
4+
{
5+
/**
6+
* Recommended audio pipeline sample rate in Hz.
7+
*
8+
* Divides cleanly into all standard MFSK baud rates with no rounding error.
9+
*/
10+
const val MFSK_RECOMMENDED_SAMPLE_RATE = 12_000
11+
12+
/** Default transmit output level as a fraction of full scale, in [0.0, 1.0].
13+
* Leaves headroom for signal processing while maintaining adequate output level. */
14+
const val MFSK_DEFAULT_AMPLITUDE = 0.5
15+
16+
/** Default receive timeout in milliseconds.
17+
* At MFSK-16's ~1.95 bytes/second, a 40-byte payload transmits in ~21 seconds.
18+
* 60 seconds provides approximately 2.5× margin for timing and signal variation. */
19+
const val MFSK_DEFAULT_TIMEOUT_MS = 60_000L
20+
}

0 commit comments

Comments
 (0)