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

Configuration of the ggwave compatible modem (GGWaveEncoder, GGWaveDecoder). Each message (up to 140 bytes) starts and ends with a marker and is protected by Reed-Solomon codes. Each byte is sent as 2 of 16 tones which are transmitted at the same time. More...

#include <GGWave.h>

Inheritance diagram for tinymodem::GGWaveConfig:
Collaboration diagram for tinymodem::GGWaveConfig:

Public Member Functions

 GGWaveConfig ()
bool setMode (const char *mode)
 Selects the protocol by mode name: returns false if invalid.
const GGWaveProtocol & protocolInfo () const
 Provides the selected protocol.
int frameSize () const
 Samples per frame: the tones are multiples of sample_rate / frameSize().
float binFrequency (int bin) const
 Frequency of the indicated FFT bin in Hz.
int dataSymbols (int len) const
 Number of data symbols of a message with len bytes.
size_t messageSamples (int len) const
 Number of samples of a message with len bytes.
float symbolRate () const
 Data symbols per second.
float bitRate () const
 Payload bits per second (without markers and error correction).
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 is a ggwave mode
static int protocolCount ()
 Number of supported protocols.
static const GGWaveProtocol * protocols ()
 Provides the supported protocols.
static const GGWaveProtocol * findProtocol (int id)
 Provides the protocol with the indicated id (or nullptr).
static int eccBytes (int len)
 Number of Reed-Solomon parity bytes for a payload of len bytes.
static int encodedBytes (int len)
 Total number of encoded bytes of a message (length, payload, parity).
static uint8_t dssMagic (int i)
 Value of the ggwave DSS sequence for the indicated payload byte.

Public Attributes

GGWaveProtocolId protocol = GGWAVE_AUDIBLE_FAST
 ggwave protocol (see setMode())
float volume = 1.0f
 transmit amplitude (0.0 - 1.0)
bool dss = false
 XOR the payload with the ggwave DSS sequence (ggwave option -d).
bool rx_any_speed = true
 receiver: accept the normal, fast and fastest variant of the protocol
float marker_threshold = 3.0f
bool rx_one = false
 receiver: stop after the first message
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

Static Public Attributes

static constexpr int BASE_FRAME = 1024
 samples per frame (DFT size) at 48000 Hz
static constexpr int BASE_RATE = 48000
static constexpr int MAX_PAYLOAD = 140
 max payload of a message (variable length format)
static constexpr int MARKER_FRAMES = 16
 number of frames of the start and end marker
static constexpr int MARKER_TONES = 16
 number of tones of a marker
static constexpr int LENGTH_BYTES = 3
 bytes of the Reed-Solomon coded length at the start of a message

Static Protected Member Functions

static const GGWaveProtocol * findMode (const char *mode)
static bool equals (const char *a, const char *b)

Detailed Description

Configuration of the ggwave compatible modem (GGWaveEncoder, GGWaveDecoder). Each message (up to 140 bytes) starts and ends with a marker and is protected by Reed-Solomon codes. Each byte is sent as 2 of 16 tones which are transmitted at the same time.

setMode() selects the protocol: "ggwave-normal", "ggwave-fast", "ggwave-fastest" (audible, 1875 - 6375 Hz), "ggwave-u-normal", "ggwave-u-fast", "ggwave-u-fastest" (ultrasound, 15000 - 19500 Hz), "ggwave-dt-normal", "ggwave-dt-fast" and "ggwave-dt-fastest" (dual tone, 1125 - 2625 Hz). "ggwave" is "ggwave-fast", the default of the ggwave tools. The variable length format is used, which is the default of ggwave. The mono-tone (MT) protocols and the fixed length format are not supported.

The sample rate must be a multiple of 46.875 Hz * 4, e.g. 48000 or 24000 Hz (44100 Hz is not supported), and high enough for the highest tone.

Constructor & Destructor Documentation

◆ GGWaveConfig()

tinymodem::GGWaveConfig::GGWaveConfig ( )
inline

Member Function Documentation

◆ binFrequency()

float tinymodem::GGWaveConfig::binFrequency ( int bin) const
inline

Frequency of the indicated FFT bin in Hz.

◆ bitRate()

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

Payload bits per second (without markers and error correction).

◆ dataSymbols()

int tinymodem::GGWaveConfig::dataSymbols ( int len) const
inline

Number of data symbols of a message with len bytes.

◆ dssMagic()

uint8_t tinymodem::GGWaveConfig::dssMagic ( int i)
inlinestatic

Value of the ggwave DSS sequence for the indicated payload byte.

◆ eccBytes()

int tinymodem::GGWaveConfig::eccBytes ( int len)
inlinestatic

Number of Reed-Solomon parity bytes for a payload of len bytes.

◆ encodedBytes()

int tinymodem::GGWaveConfig::encodedBytes ( int len)
inlinestatic

Total number of encoded bytes of a message (length, payload, parity).

◆ equals()

bool tinymodem::GGWaveConfig::equals ( const char * a,
const char * b )
inlinestaticprotected

◆ findMode()

const GGWaveProtocol * tinymodem::GGWaveConfig::findMode ( const char * mode)
inlinestaticprotected

◆ findProtocol()

const GGWaveProtocol * tinymodem::GGWaveConfig::findProtocol ( int id)
inlinestatic

Provides the protocol with the indicated id (or nullptr).

◆ frameSize()

int tinymodem::GGWaveConfig::frameSize ( ) const
inline

Samples per frame: the tones are multiples of sample_rate / frameSize().

◆ isMode()

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

true if the mode is a ggwave mode

◆ isValid()

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

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

◆ messageSamples()

size_t tinymodem::GGWaveConfig::messageSamples ( int len) const
inline

Number of samples of a message with len bytes.

◆ protocolCount()

int tinymodem::GGWaveConfig::protocolCount ( )
inlinestatic

Number of supported protocols.

◆ protocolInfo()

const GGWaveProtocol & tinymodem::GGWaveConfig::protocolInfo ( ) const
inline

Provides the selected protocol.

◆ protocols()

const GGWaveProtocol * tinymodem::GGWaveConfig::protocols ( )
inlinestatic

Provides the supported protocols.

◆ setMode()

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

Selects the protocol by mode name: returns false if invalid.

◆ symbolRate()

float tinymodem::GGWaveConfig::symbolRate ( ) const
inline

Data symbols per second.

Member Data Documentation

◆ BASE_FRAME

int tinymodem::GGWaveConfig::BASE_FRAME = 1024
staticconstexpr

samples per frame (DFT size) at 48000 Hz

◆ BASE_RATE

int tinymodem::GGWaveConfig::BASE_RATE = 48000
staticconstexpr

◆ channel

uint8_t tinymodem::GGWaveConfig::channel = 0

receiver: input channel which is used for the decoding

◆ dss

bool tinymodem::GGWaveConfig::dss = false

XOR the payload with the ggwave DSS sequence (ggwave option -d).

◆ LENGTH_BYTES

int tinymodem::GGWaveConfig::LENGTH_BYTES = 3
staticconstexpr

bytes of the Reed-Solomon coded length at the start of a message

◆ MARKER_FRAMES

int tinymodem::GGWaveConfig::MARKER_FRAMES = 16
staticconstexpr

number of frames of the start and end marker

◆ marker_threshold

float tinymodem::GGWaveConfig::marker_threshold = 3.0f

receiver: a marker tone must be this much stronger than its neighbor (in power)

◆ MARKER_TONES

int tinymodem::GGWaveConfig::MARKER_TONES = 16
staticconstexpr

number of tones of a marker

◆ MAX_PAYLOAD

int tinymodem::GGWaveConfig::MAX_PAYLOAD = 140
staticconstexpr

max payload of a message (variable length format)

◆ protocol

GGWaveProtocolId tinymodem::GGWaveConfig::protocol = GGWAVE_AUDIBLE_FAST

ggwave protocol (see setMode())

◆ rx_any_speed

bool tinymodem::GGWaveConfig::rx_any_speed = true

receiver: accept the normal, fast and fastest variant of the protocol

◆ rx_noise

float tinymodem::GGWaveConfig::rx_noise = 0.0f

receiver: (testing only) amplitude of added uniform noise

◆ rx_one

bool tinymodem::GGWaveConfig::rx_one = false

receiver: stop after the first message

◆ volume

float tinymodem::GGWaveConfig::volume = 1.0f

transmit amplitude (0.0 - 1.0)


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