|
TinyModem
Header-only software audio modem library
|
Morse code demodulator (CW): the PCM audio data is written to the decoder and the decoded characters (upper case) are written to the output. The input can be 8, 16 or 32 bit signed samples with any number of channels (only MorseConfig::channel is evaluated). More...
#include <MorseDecoder.h>


Public Member Functions | |
| MorseDecoder ()=default | |
| MorseDecoder (Print &out) | |
| MorseConfig | defaultConfig () |
| Provides a default configuration: International Morse code, 20 wpm. | |
| void | setAudioInfo (audio_tools::AudioInfo info) override |
| Defines the format of the input audio data. | |
| audio_tools::AudioInfo | audioInfo () override |
| bool | begin (MorseConfig config) |
| Starts the processing with the indicated configuration. | |
| bool | begin () override |
| void | end () override |
| Processes the remaining samples and reports the end of the carrier. | |
| void | flush () override |
| Processes the remaining samples (e.g. at the end of the input). | |
| size_t | write (const uint8_t *data, size_t len) override |
| Provide PCM data to the decoder. | |
| bool | isCarrier () override |
| true while a transmission is received | |
| bool | isFinished () override |
| true if the decoding was stopped (rx_one) | |
| float | wpm () |
| Current speed of the sender in words per minute. | |
| MorseConfig & | config () |
| The configuration which was provided in begin(). | |
| operator bool () override | |
| Public Member Functions inherited from tinymodem::ModemDecoder | |
| void | setStatusOutput (Print &out) |
| Defines the output for the ### CARRIER / ### NOCARRIER messages. | |
| void | setQuiet (bool quiet) |
| Suppresses the status messages. | |
| const char * | mime () override |
Protected Member Functions | |
| void | resetState () |
| float | noise () |
| uniform random value in the range -0.5 to 0.5 | |
| void | addSample (float x, bool add_noise) |
| void | recalculate () |
| Avoids the accumulation of rounding errors. | |
| void | processBlock (float level) |
| On/off decision of one block with the level of the tone. | |
| void | endOfMark (float raw_length) |
| void | endOfSpace (float raw_length) |
| void | checkSpace (float raw_length) |
| Ends the character, the word or the transmission during a space. | |
| void | finishCharacter () |
| void | output (char ch) |
| void | startOfCarrier () |
| void | endOfCarrier () |
| Protected Member Functions inherited from tinymodem::ModemDecoder | |
| void | status (const char *fmt,...) |
Protected Attributes | |
| MorseConfig | cfg |
| bool | is_active = false |
| bool | is_finished = false |
| PcmInput | input |
| uint32_t | noise_seed = 1 |
| int | block = 96 |
| int | window = 480 |
| int | count = 0 |
| audio_tools::Vector< float > | history |
| int | pos = 0 |
| float | sum_i = 0 |
| float | sum_q = 0 |
| float | re = 1 |
| float | im = 0 |
| float | step_re = 1 |
| float | step_im = 0 |
| uint32_t | sample_count = 0 |
| float | signal_level = 0 |
| float | noise_level = 0 |
| float | noise_mean = 0 |
| bool | first_block = true |
| bool | tone_on = false |
| int | pending = 0 |
| float | duration = 0 |
| float | unit = 0.06f |
| float | bias = 0 |
| float | last_mark = 0 |
| char | last_element = 0 |
| bool | carrier = false |
| bool | word_pending = false |
| char | code [MAX_CODE+1] |
| int | code_len = 0 |
| unsigned | ndata = 0 |
| Protected Attributes inherited from tinymodem::ModemDecoder | |
| Print * | p_status = nullptr |
| bool | is_quiet = false |
Static Protected Attributes | |
| static constexpr float | BLOCK_SEC = 0.002f |
| static constexpr float | WINDOW_UNITS = 0.5f |
| length of the measurement window in units | |
| static constexpr float | DEBOUNCE_UNITS = 0.3f |
| changes which are shorter than this (in units) are ignored | |
| static constexpr int | MAX_CODE = 16 |
| static constexpr float | MIN_SNR = 5.0f |
| min ratio of the tone level to the average noise level | |
Morse code demodulator (CW): the PCM audio data is written to the decoder and the decoded characters (upper case) are written to the output. The input can be 8, 16 or 32 bit signed samples with any number of channels (only MorseConfig::channel is evaluated).
The level of the tone is measured with a mixer and a sliding sum over half a dot, every 2 ms. The tone is on when the level is above the middle between the signal and the noise level (with hysteresis), and short changes are ignored. The length of the marks and spaces in units provides the dots and dashes and the spaces between the elements, characters and words. The length of a unit adapts to the speed of the sender. The rise and fall time of the tone shortens the marks and lengthens the spaces by the same amount: this is measured with the dots and the following element spaces (both are 1 unit) and corrected.
A transmission ends after MorseConfig::rx_timeout_units without a tone: this is reported with ### NOCARRIER.
|
default |
|
inline |
|
inlineprotected |
|
inlineoverride |
|
inlineoverride |
|
inline |
Starts the processing with the indicated configuration.
|
inlineprotected |
Ends the character, the word or the transmission during a space.
|
inline |
The configuration which was provided in begin().
|
inline |
Provides a default configuration: International Morse code, 20 wpm.
|
inlineoverride |
Processes the remaining samples and reports the end of the carrier.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineoverridevirtual |
Processes the remaining samples (e.g. at the end of the input).
Implements tinymodem::ModemDecoder.
|
inlineoverridevirtual |
true while a transmission is received
Implements tinymodem::ModemDecoder.
|
inlineoverridevirtual |
true if the decoding was stopped (rx_one)
Implements tinymodem::ModemDecoder.
|
inlineprotected |
uniform random value in the range -0.5 to 0.5
|
inlineoverride |
|
inlineprotected |
|
inlineprotected |
On/off decision of one block with the level of the tone.
|
inlineprotected |
Avoids the accumulation of rounding errors.
|
inlineprotected |
|
inlineoverride |
Defines the format of the input audio data.
|
inlineprotected |
|
inline |
Current speed of the sender in words per minute.
|
inlineoverride |
Provide PCM data to the decoder.
|
protected |
|
protected |
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
changes which are shorter than this (in units) are ignored
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
|
staticconstexprprotected |
min ratio of the tone level to the average noise level
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
length of the measurement window in units
|
protected |