speakremix-codes
v0.1.0
Published
Morse code, braille, binary, runes, Anglo-Saxon futhorc and ogham converters with checked tables. Zero dependencies.
Maintainers
Readme
speakremix-codes
Converters for Morse code, braille, binary, Norse runes, Anglo-Saxon runes (futhorc) and ogham, plus cursive and Egyptian hieroglyph lettering. These are the tables and functions behind the converters on SpeakRemix, with the tests that pin them. Zero dependencies, ESM, TypeScript types included.
npm install speakremix-codesImport everything from the package root, or one module at a time (speakremix-codes/morse, /braille, /binary, /runes, /futhorc, /ogham, /cursive, /hieroglyphs).
Morse code
import { toMorse, fromMorse, morseTimeline, dotSeconds, MORSE_ITU } from 'speakremix-codes'
toMorse('Hello, world') // ".... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.."
fromMorse('.... .. / - .... . .-. .') // "HI THERE"
MORSE_ITU.a // ".-"
// Timing in dots: [start, length] for each signal, and the total length.
morseTimeline('.-') // { tones: [[0, 1], [2, 3]], length: 5 }
dotSeconds(18) // 0.06666666666666667 (seconds per dot at 18 words per minute)toMorse separates letters with a space and words with /. fromMorse also accepts · • for dots, − – _ for dashes, and a bar or three spaces between words.
In the browser, playMorse(code, onEnd, wpm = 18, frequency = 600) plays code as a tone with Web Audio and returns a function that stops it. It needs window, so don’t call it in Node.
Braille
import { toBraille, fromBraille, BRAILLE_INDICATORS } from 'speakremix-codes'
toBraille('Room 101.') // "⠠⠗⠕⠕⠍ ⠼⠁⠚⠁⠲"
toBraille('NASA rocks') // "⠠⠠⠝⠁⠎⠁ ⠗⠕⠉⠅⠎"
fromBraille('⠠⠞⠓⠁⠝⠅ ⠽⠕⠥') // "Thank you"
toBraille('report3.doc') // "⠗⠑⠏⠕⠗⠞⠼⠉⠲⠰⠙⠕⠉" (a full stop doesn't end a number, so d needs ⠰)
fromBraille('⠠⠠⠝⠁⠎⠁⠤⠇⠊⠅⠑') // "NASA-like" (a word in capitals ends at the hyphen)
BRAILLE_INDICATORS // { capital: "⠠", numeric: "⠼", grade1: "⠰" }BRAILLE_LETTERS and BRAILLE_SIGNS hold the cells for a–z and for the punctuation and signs listed below.
Binary
import { toBinary, fromBinary } from 'speakremix-codes'
toBinary('Hi') // "01001000 01101001"
toBinary('é') // "11000011 10101001" (UTF-8: two bytes)
fromBinary('0100100001101001') // "Hi"Norse runes (Elder and Younger Futhark)
import { toRunes, ELDER_FUTHARK, YOUNGER_FUTHARK } from 'speakremix-codes'
toRunes('Thor Odin') // "ᚦᛟᚱ᛫ᛟᛞᛁᚾ"
toRunes('Odin', 'younger') // "ᚬᛏᛁᚾ"
toRunes('Thor Odin', 'elder', false) // "ᚦᛟᚱ ᛟᛞᛁᚾ" (no word dividers)
ELDER_FUTHARK[0] // { rune: "ᚠ", name: "Fehu", sound: "f" }Anglo-Saxon runes (futhorc)
import { toFuthorc, FUTHORC } from 'speakremix-codes'
toFuthorc('Beowulf') // "ᛒᛖᚩᚹᚢᛚᚠ"
toFuthorc('the sea') // "ᚦᛖ᛫ᛋᛠ" (th is þorn, ea is ēar)
FUTHORC.length // 29Ogham
import { toOgham, OGHAM, OGHAM_MARKS } from 'speakremix-codes'
toOgham('Brigid') // "᚛ᚁᚏᚔᚌᚔᚇ᚜"
toOgham('King Sean', false) // "ᚉᚔᚍ ᚄᚓᚐᚅ" (no feather marks; the gap is the ogham space mark U+1680)
OGHAM[0].letters[0] // { char: "ᚁ", name: "Beith", sound: "b" }Cursive and hieroglyphs
import { toCursive, toHieroglyphs } from 'speakremix-codes'
toCursive('Hello') // "ℋℯ𝓁𝓁ℴ"
toCursive('Hello', 'bold') // "𝓗𝓮𝓵𝓵𝓸"
toHieroglyphs('Cleopatra') // "𓎡𓃭𓇋𓅱𓊪𓄿𓏏𓂋𓄿"Cursive uses the Unicode Mathematical Script letters, so it isn’t a font. Hieroglyphs spell English letter by letter with the single-consonant signs listed in HIEROGLYPH_SIGNS. This is a fun transliteration, not a translation into Ancient Egyptian.
One entry point
import { convert } from 'speakremix-codes'
convert('braille', '⠠⠓⠊', {}, 'from') // "Hi"
convert('runes', 'Freya', { runes: 'younger' }) // "ᚠᚱᛁᚢᛅ"convert(style, text, options?, direction?) takes cursive, hieroglyphs, runes, futhorc, ogham, morse, binary or braille. With 'from' it reads Morse, binary and braille back to text. options.dividers (on by default) controls rune word dividers and ogham feather marks.
What it was checked against
- Morse code: every letter, figure and punctuation code, and the timing (a dash is three dots; gaps of one, three and seven dots), follow Recommendation ITU-R M.1677-1: International Morse code, checked character by character.
- Braille: letters, the capital, numeric and grade 1 indicators, and every punctuation sign follow the ICEB Unified English Braille symbol lists, checked symbol by symbol. Where a number ends and when ⠰ is needed after it follow Rules of Unified English Braille (2024) 6.2.1, 6.3.1 and 6.5.2, and where a word in capitals ends follows rule 8.4.2; the tests include the rulebook's own examples. Each braille character’s Unicode name was checked against Unicode 16.0, for example ⠼ is U+283C BRAILLE PATTERN DOTS-3456.
- Runes, futhorc and ogham: every character’s code point and Unicode name was checked against the Unicode Character Database 16.0 (Runic chart, Ogham chart).
The tests in test/ pin these values, for example the dot numbers of every braille sign and the ITU code of every punctuation mark.
Unicode identifies the characters. It doesn’t make an English spelling in runes or ogham historical: the letter mappings are this library’s own rules, documented in the source.
Limits
- Braille: uncontracted (grade 1) Unified English Braille only. Most books, signs and labels use contracted (grade 2) braille, which won’t read back correctly. Rules for emphasis, accented letters and capitals passages are left out, and accents are dropped (é becomes e). For anything people will touch, have it produced and checked by a braille transcriber.
- Morse code:
! & ; _ $are widely used but aren’t in the ITU standard, so other tools may write them differently. Characters without a code, such as emoji, are kept as they are, andfromMorseshows an unknown code as�. Decoded text is in capitals. - Binary: bytes are UTF-8. An invalid byte sequence shows as
�, and anything that isn’t made of 0s and 1s is kept as typed. - Runes, futhorc, ogham and hieroglyphs: they spell English letter by letter; they don’t translate into Old Norse, Old English, Irish or Ancient Egyptian. Accents are dropped. The Younger Futhark has 16 runes, so one rune covers several letters (t and d, k and g, b and p…). Ogham has no letters for j, k, v, w, x or y, so the nearest letters are used.
Try it online
- Morse code translator, with sound
- Braille translator
- Binary translator
- Rune translator (Elder and Younger Futhark)
- Anglo-Saxon runes
- Ogham translator
- Cursive translator and hieroglyphics translator
Printable charts made from the same tables: Morse code chart, braille alphabet, rune alphabet and ogham alphabet.
Development
npm install
npm run build # dist/ (ESM + .d.ts)
npm test # node --test, on the TypeScript source and the buildThe tests run the TypeScript source directly, so they need a Node version with type stripping (22.18 or later). The built package is ES2022 JavaScript for Node 18 or later and modern browsers.
License
MIT © 2026 SpeakRemix
