Skip to content

Commit

Permalink
Renamed package to morse-code-translator, updated audio.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ozdemirburak committed Sep 29, 2024
1 parent 333a288 commit e2dfb6e
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 42 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Burak Özdemir
Copyright (c) 2024 Burak Özdemir

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
# [Morse Code Translator](https://morsedecoder.com) with Audio - Morse Decoder
# [Morse Code Translator](https://morsecodetranslator.com)

[![npm-version]][npm] [![npm-downloads]][npm]

Morse code encoder and decoder with no dependencies. It supports Latin, Cyrillic, Greek, Hebrew, Arabic,
Morse code encoder and Morse decoder with no dependencies. It supports Latin, Cyrillic, Greek, Hebrew, Arabic,
Persian, Japanese, Korean, and Thai, with audio-generation functionality using the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API).

## Installation

### npm

```bash
$ npm install morse-decoder --save
```

### yarn

```bash
$ yarn add morse-decoder
$ npm install @ozdemirburak/morse-code-translator --save
```

## Usage

### Common JS
```js
const morse = require('morse-decoder');
const morse = require('morse-code-translator');
const encoded = morse.encode('SOS'); // ... --- ...
const decoded = morse.decode('... --- ...'); // SOS
const characters = morse.characters(); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
Expand All @@ -34,9 +29,10 @@ const url = await audio.getWaveUrl(); // get audio wave url (promise)
const blob = await audio.getWaveBlob(); // get audio wave blob (promise)
```
### Browser
Morse decoder exports a global object named 'morse-decoder';

Morse decoder exports a global object named 'morse-code-translator';
```js
const morse = window['morse-decoder']
const morse = window['morse-code-translator']
const audioElement = document.querySelector('audio');
const helloAudio = morse.audio('Hello world');
helloAudio.getWaveUrl().then((url) => {
Expand All @@ -45,7 +41,6 @@ helloAudio.getWaveUrl().then((url) => {
});
```


### Options and localization

You can customize the dash, dot, or space characters and specify the alphabet with the priority option for
Expand Down Expand Up @@ -96,10 +91,26 @@ arabicAudio.stop(); // will stop playing Morse audio

## Contributions

[morse-decoder](https://github.com/ozdemirburak/morse-decoder) has been developed
with extensive feedback and contributions from [numerous developers](https://github.com/ozdemirburak/morse-decoder/graphs/contributors).
[morse-code-translator](https://github.com/ozdemirburak/morse-code-translator) has been developed
with extensive feedback and contributions from [numerous developers](https://github.com/ozdemirburak/morse-code-translator/graphs/contributors).
Special thanks to [Chris Jones](https://github.com/chris--jones), who added many great features.

## References

Please consider referencing the website of this project, if you find this package useful for your work.

```html
<a href="https://morsecodetranslator.com">Morse Code Translator</a>
```

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

[npm-version]: https://img.shields.io/npm/v/@ozdemirburak/morse-code-translator.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/@ozdemirburak/morse-code-translator.svg?style=flat-square
[npm]: https://www.npmjs.com/package/@ozdemirburak/morse-code-translator

## Generating Minified Files

Install node and npm and run the commands below.
Expand All @@ -108,15 +119,6 @@ Install node and npm and run the commands below.
$ npm install
# generate `index.js` inside `src`
$ npm run build
# generate `morse-decoder.min.js` (minified) inside `dist`
# generate `morse-code-translator.min.js` (minified) inside `dist`
$ npm run build-rel
```

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

[npm-version]: https://img.shields.io/npm/v/morse-decoder.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/morse-decoder.svg?style=flat-square

[npm]: https://www.npmjs.com/package/morse-decoder
Loading

0 comments on commit e2dfb6e

Please sign in to comment.