TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::MFSKConfig Struct Reference

Configuration of the multi-tone FSK modem (MFSKEncoder, MFSKDecoder). Each symbol is one of tones tones and carries log2(tones) bits. The tones are base_freq + i * tone_spacing. More...

#include <MFSKConfig.h>

Inheritance diagram for tinymodem::MFSKConfig:
Collaboration diagram for tinymodem::MFSKConfig:

Public Member Functions

 MFSKConfig ()
bool setMode (const char *mode)
int bitsPerSymbol () const
 bits per symbol: log2(tones)
float spacing () const
 distance between the tones in Hz
float toneFrequency (int idx) const
 frequency of the tone with the indicated index
int syncLength () const
 number of sync symbols after the preamble: they carry at least 8 bits
int syncSymbol (int idx) const
 tone of the sync symbol with the indicated index
float bitRate () const
 data bits per second
float samplesPerSymbol () const
 number of samples per symbol
bool isValid () const
 Checks the configuration: returns false (and logs the reason) if invalid.

Static Public Member Functions

static bool isMode (const char *mode)
 true if the mode name is a MFSK mode

Public Attributes

int tones = 16
 number of tones: 4, 8, 16, 32 or 64
float symbol_rate = 125.0f
 symbols per second
float base_freq = 1000.0f
 frequency of the lowest tone in Hz
float tone_spacing = 0.0f
 distance between the tones in Hz (0 = symbol_rate)
float volume = 1.0f
 transmit amplitude (0.0 - 1.0)
int preamble_symbols = 8
 number of preamble symbols (alternating lowest and highest tone)
float min_amplitude = 0.005f
 receiver: minimum amplitude of a tone (1.0 = full scale)
bool rx_one = false
 receiver: stop after the first carrier was lost
uint8_t channel = 0
 receiver: input channel which is used for the decoding
float rx_noise = 0.0f
 receiver: (testing only) amplitude of added uniform noise

Detailed Description

Configuration of the multi-tone FSK modem (MFSKEncoder, MFSKDecoder). Each symbol is one of tones tones and carries log2(tones) bits. The tones are base_freq + i * tone_spacing.

Use setMode() to select a predefined mode: "mfsk4", "mfsk8", "mfsk16", "mfsk32" or "mfsk64". All of them use tones between 1000 and 3000 Hz, so they work with speakers, microphones and telephone lines. More tones are slower but more robust against noise.

Constructor & Destructor Documentation

◆ MFSKConfig()

tinymodem::MFSKConfig::MFSKConfig ( )
inline

Member Function Documentation

◆ bitRate()

float tinymodem::MFSKConfig::bitRate ( ) const
inline

data bits per second

◆ bitsPerSymbol()

int tinymodem::MFSKConfig::bitsPerSymbol ( ) const
inline

bits per symbol: log2(tones)

◆ isMode()

bool tinymodem::MFSKConfig::isMode ( const char * mode)
inlinestatic

true if the mode name is a MFSK mode

◆ isValid()

bool tinymodem::MFSKConfig::isValid ( ) const
inline

Checks the configuration: returns false (and logs the reason) if invalid.

◆ samplesPerSymbol()

float tinymodem::MFSKConfig::samplesPerSymbol ( ) const
inline

number of samples per symbol

◆ setMode()

bool tinymodem::MFSKConfig::setMode ( const char * mode)
inline

Selects a predefined mode ("mfsk4" to "mfsk64"): returns false if invalid. The audio format and the receiver settings are kept.

◆ spacing()

float tinymodem::MFSKConfig::spacing ( ) const
inline

distance between the tones in Hz

◆ syncLength()

int tinymodem::MFSKConfig::syncLength ( ) const
inline

number of sync symbols after the preamble: they carry at least 8 bits

◆ syncSymbol()

int tinymodem::MFSKConfig::syncSymbol ( int idx) const
inline

tone of the sync symbol with the indicated index

◆ toneFrequency()

float tinymodem::MFSKConfig::toneFrequency ( int idx) const
inline

frequency of the tone with the indicated index

Member Data Documentation

◆ base_freq

float tinymodem::MFSKConfig::base_freq = 1000.0f

frequency of the lowest tone in Hz

◆ channel

uint8_t tinymodem::MFSKConfig::channel = 0

receiver: input channel which is used for the decoding

◆ min_amplitude

float tinymodem::MFSKConfig::min_amplitude = 0.005f

receiver: minimum amplitude of a tone (1.0 = full scale)

◆ preamble_symbols

int tinymodem::MFSKConfig::preamble_symbols = 8

number of preamble symbols (alternating lowest and highest tone)

◆ rx_noise

float tinymodem::MFSKConfig::rx_noise = 0.0f

receiver: (testing only) amplitude of added uniform noise

◆ rx_one

bool tinymodem::MFSKConfig::rx_one = false

receiver: stop after the first carrier was lost

◆ symbol_rate

float tinymodem::MFSKConfig::symbol_rate = 125.0f

symbols per second

◆ tone_spacing

float tinymodem::MFSKConfig::tone_spacing = 0.0f

distance between the tones in Hz (0 = symbol_rate)

◆ tones

int tinymodem::MFSKConfig::tones = 16

number of tones: 4, 8, 16, 32 or 64

◆ volume

float tinymodem::MFSKConfig::volume = 1.0f

transmit amplitude (0.0 - 1.0)


The documentation for this struct was generated from the following file: