Home Reference Source
import MorseCW from 'morse-pro/src/morse-pro-cw.js'
public class | source

MorseCW

Extends:

MorseMessage → MorseCW

Direct Subclass:

MorseCWWave

Class to create the on/off timings needed by e.g. sound generators. Timings are in milliseconds; "off" timings are negative.

Example:

import MorseCW from 'morse-pro-cw';
var morseCW = new MorseCW();
morseCW.translate("abc");
var timings = morseCW.getTimings();

Static Method Summary

Static Public Methods
public static

getTimingsGeneral(dit: number, dah: number, ditSpace: number, charSpace: number, wordSpace: number, morse: string): number[]

Return an array of millisecond timings.

Constructor Summary

Public Constructor
public

constructor(prosigns: boolean, wpm: number, fwpm: number)

Member Summary

Public Members
public set

Set the Farnsworth WPM speed.

public get
public get

Get the length of the space between words in ms.

public set

Set the WPM speed.

public get
Private Members
private

_fwpm: *

private

_wpm: *

Method Summary

Public Methods
public

Get the total duration of the message in ms 8 @return {number}

public

Return an array of millisecond timings.

Inherited Summary

From class MorseMessage
public
public
public
public
public
public
public
public

Clear all the errors from the morse and message.

public

translate(input: string, isMorse: boolean): *

Static Public Methods

public static getTimingsGeneral(dit: number, dah: number, ditSpace: number, charSpace: number, wordSpace: number, morse: string): number[] source

Return an array of millisecond timings. Each sound and space has a duration. The durations of the spaces are distinguished by being negative.

Params:

NameTypeAttributeDescription
dit number

the length of a dit in milliseconds

dah number

the length of a dah in milliseconds (normally 3 * dit)

ditSpace number

the length of an intra-character space in milliseconds (1 * dit)

charSpace number

the length of an inter-character space in milliseconds (normally 3 * dit)

wordSpace number

the length of an inter-word space in milliseconds (normally 7 * dit)

morse string

the (canonical) morse code string (matching [.-/ ]*)

Return:

number[]

Public Constructors

public constructor(prosigns: boolean, wpm: number, fwpm: number) source

Override:

MorseMessage#constructor

Params:

NameTypeAttributeDescription
prosigns boolean
  • optional
  • default: true

whether or not to include prosigns in the translations

wpm number
  • optional
  • default: 20

the speed in words per minute using PARIS as the standard word

fwpm number
  • optional
  • default: wpm

the Farnsworth speed in words per minute (defaults to wpm)

Public Members

public set fwpm: number source

Set the Farnsworth WPM speed. Ensures that WPM is no slower than Farnsworth WPM.

public get fwpm: number source

public get wordSpace: number source

Get the length of the space between words in ms.

public set wpm: number source

Set the WPM speed. Ensures that Farnsworth WPM is no faster than WPM.

public get wpm: number source

Private Members

private _fwpm: * source

private _wpm: * source

Public Methods

public getDuration(): * source

Get the total duration of the message in ms 8 @return {number}

Return:

*

public getTimings(): number[] source

Return an array of millisecond timings. With the Farnsworth method, the morse characters are played at one speed and the spaces between characters at a slower speed.

Return:

number[]