Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

morsea

3.0.0 • Public • Published

morsea

Encode morse messages into text and audio streams!

Installation

npm install morsea

API

CharStream

Helper stream factory to produce streams from strings. Usage is very simple:

const CharStream = require('morsea/char-stream');
 
CharStream.create('Hello, world!').pipe(process.stdout);

TextEncoder

The transform stream to encode string streams into morse codes. The output is split into single chars (dot, dash or space). Usage:

const CharStream = require('morsea/char-stream');
const TextEncoder = require('morsea/text-encoder');
 
CharStream.create('Hello, world!')
  .pipe(TextEncoder.create(textEncoder, options))
  .pipe(process.stdout);

Under the hood it uses morsify as textEncoder by default. But you can provide any encoder you like. It should has the same interfase as morsify, ie. textEncoder.encode(text, options)

Options

Default options are:

{
  space: '/',
  dash: '-',
  dot: '.'
}

AudioEncoder

The transform stream to encode morse code message symbols into raw audio buffers. Usage:

const CharStream = require('morsea/char-stream');
const TextEncoder = require('morsea/text-encoder');
const AudioEncoder = require('morsea/audio-encoder');
 
CharStream.create('Hello, world!')
  .pipe(TextEncoder.create(textEncoder, options))
  .pipe(AudioEncoder.create(options));

Also, see examples folder how to output morse audio in mp3.

Options

Default options are:

{
  unitDuration: 0.2, // how long dot symbol will sound (sec)
  frequency: 400, // oscillator frequency (Hz)
  sampleRate: 44100 // audio sample rate (Hz)
}

Examples

See examples folder

Install

npm i morsea

DownloadsWeekly Downloads

7

Version

3.0.0

License

MIT License

Last publish

Collaborators

  • avatar
  • avatar