enigma.keyer

A Morse code keyer.

A Morse “key” is a device with a button used to encode the carrier wave with a Morse signal. Morse operators use these to produce the familiar “dits” and “dahs” of Morse code. The Keyer class converts dots and dashes into an encoded carrier waveform and plays it audibly.

Module Contents

Classes

Keyer

Convert Morse code to audio and play it.

Attributes

MORSE_DIT_FREQ

MORSE_DIT

MORSE_DAH

FREQUENCY

SAMPLE_RATE

enigma.keyer.MORSE_DIT_FREQ = 10
enigma.keyer.MORSE_DIT = 1
enigma.keyer.MORSE_DAH = 3
enigma.keyer.FREQUENCY = 440
enigma.keyer.SAMPLE_RATE = 44100
class enigma.keyer.Keyer(morse)

Convert Morse code to audio and play it.

create_binary_signal(self, morse)

Converts Morse code into a binary signal.

For example, “.- .” becomes “1011100001” :param morse: dot-and-dash Morse code :type morse: str :return: binary Morse code signal :rtype: np.ndarray

convert_audio(self)

Convert binary signal to audio.

Encode sine wave with binary signal and create playable audio. :return: 16-bit audio waveform :rtype: np.ndarray

play(self)

Play Morse code.

In the case of audio errors (i.e. on CI system with no sound card), catch exception and notify.