An open API service indexing awesome lists of open source software.

https://github.com/jlondonobo/morse

A simple CLI tool for translating text to Morse code
https://github.com/jlondonobo/morse

cli golang morsecode sound translation

Last synced: 5 months ago
JSON representation

A simple CLI tool for translating text to Morse code

Awesome Lists containing this project

README

          


Untitled

## Features

- Output string representation to `stdout`.
- Output sound representation to a `.wav` file via the `--output` flag.
- Supports short flags like `-s` (sound) and `-o` (output).
- Configure sound pitch, speed, and tone.

## Installation
Installing `morse` requires that you have Go installed in your system. Then run:

```bash
go install github.com/jlondonobo/morse@latest
```

## Quickstart

To translate text to Morse code, run:

```bash
morse 'Vamos' -s
```

This command will write the string representation to standard output and play it on your speakers.

To name the ouput file something different, use the `--file-name` (`-f`) flag. For example:

```bash
morse 'Lets go, Carlos, lets go' -sf 'carlitos.wav'
```

## Configuration

By default, `morse` plays a 700Hz sine wave at 20 words per minute. But you can change its pitch, speed, and tone.

Morse supports configuring the ouptut sound using the `--pitch`, `--speed`, and `--tone` flags.

### Pitch
You can set the pitch anywhere from 300Hz to 1000Hz via the `--pitch` flag.

```bash
morse 'Ace' -s --pitch 500
```

### Speed
Morse code speed is measured in **words per minute** (wpm). Because characters might have different lengths, the convention is to meausre words per minute using the word "PARIS " with a space at the end.

`morse` produces sound outputs at 20wpm, try adjusting it to anything between 5-40 wpm.

```bash
morse 'What a magnificent shot' -s --speed 35
```

### Tone
Set the output tone to one of `sine`, `triangle`, `sawtooth` and `square`. Via the `--tone` flag.

```bash
morse 'And the champion of the 2025 Nitto ATP finals is Jannik Sinner' -s --tone triangle
```
- `sine`: The base, smooth. Makes up all other waves.
- `square`: Richer and buzzier.
- `triangle`: Between sine and square.
- `sawtooth`: More friction and the buzziest of all.

## Roadmap

- [x] Enable saving sound to file
- [x] Make functions run in parallel
- [x] Set up short-version flags
- [x] Extend punctuation
- [x] Add a default file name for better ergonomics
- [x] Enable editing sound qualities
- [x] Speed
- [x] Pitch
- [x] Tone

- [ ] Improve efficiency of steream construction / duplication.
- [ ] Improve error handling in goroutine