cw
Command Line Time Tracking App
Last updated 7 years ago by arjunbajaj .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cw -g
SYNC missed versions from official npm registry.

CW.js

Node.js CI NPM

A comprehensive Morse Code (CW) library

Usage

Node

Install the package via npm or yarn:

$ npm install cw

You can then use:

const cw = require("cw");
console.log(cw.codes["C"]); // "-.-."

Browser

You can either build the browser bundle yourself with:

$ npm install
$ npm run build

Which will create dist/cw.js and dist/cw.min.js. Or you can just use it from a CDN:

<script src="https://cdn.example.com/cw.min.js"></script>

Once the script is loaded you can call the cw.play() function:

<script>
  cw.play("hello world");
</script>

Options can be passed to customize the played sequence:

cw.play("abcd", {
  tone: 800, // tone frequency in Hz
  wpm: 20, // character speed in words per minute (WPM)
  fwpm: 10, // farnsworth speed in words per minute (WPM)
});

In cases of multiple plays, it is recommended to create a global audioContext object:

let actx = cw.initAudioContext({ tone: 600 }); // tone is passed here

cw.play("abcd", { actx, wpm: 10 });
cw.play("efgh", { actx, wpm: 20 });
cw.play("ijkl", { actx, wpm: 30 });

For more examples see the examples/ directory.

Testing

$ npm test

License

ISC

Current Tags

  • 0.2.0                                ...           latest (4 days ago)

5 Versions

  • 0.2.0                                ...           4 days ago
  • 0.1.2                                ...           24 days ago
  • 0.1.1                                ...           24 days ago
  • 0.1.0                                ...           24 days ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 13
This Month 1
Last Day 1
Last Week 0
Last Month 52
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |