New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

morse-player

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morse-player

Browser morse code audio player

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

Morse Player

This is a browser based morse code audio player that implements audio scheduling to accurately synchronize morse code audio playback with browser callback events for correlating UI and audio rendering. It also implements options inheritance, a rich scripting engine, glitchless pausing, and word-level rewind. It doesn't include any external dependencies and is very lightweight (just a few kilobytes uncompressed).


Getting Started

Initialize the player with system default options.

const player = new Player({
  volume: 0.7,
  gain: 0.5,
  freq: 600,
  q: 10,
  wpm: 25,
  eff: 25,
  color: '#fff'
});

Bind to events to capture player behavior.

const cancel = player.on('options', console.log);
const cancel = player.on('play:start', console.log);
const cancel = player.on('play:stop', console.log);
const cancel = player.on('play:resume', console.log);
const cancel = player.on('play:pause', console.log);
const cancel = player.on('play:rewind', console.log);

Setter for user options, and getter for aggregated options objects.

player.setOptions({ volume: 0.6 });
const options = player.getOptions();

Play a script, with optional script scoped options. This needs to happen within the context of a click-event within the browser for the audio to start playing.

player.play("Hello World", { wpm: 30 });
player.stop();
player.pause();
player.replay();
player.rewind(wordCount = 1);

Player

The core application

Options

The options system consists of four layers:

  1. System Options (defined on player creation)
  2. User Options (set at any time with setOptions())
  3. Script Options (set at playtime and optionally within the play script)
  4. Comined Options (the combined system->user->script options)

Emitter

Capture audio events to trigger UI changes.

Audio

The core audio driver the plays the characters.

Schedule

The schedule is how the player schedules events to coincide with the playing audio.

Script

The script renders the raw player text into playable characters. This expands any programatic directives within the script to set options or dynamically render text with actions.

Actions

Programatic directives within a player script to set options or dynamically render text.

[set wpm:25 [+ ]

Inspirations

  • Audio Scheduling
  • Speed Rendering
  • Audio Scheduler
  • JSCW Lib

Class Structure

  • Player
    • Options
    • Emitter
    • Audio
    • Schedule
    • Script
      • Render
        • Parse
          • Tokenize
        • Actions

Keywords

FAQs

Package last updated on 22 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc