Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OpenTone

A data-over-sound toolkit in pure Python. OpenTone carries data through an audio channel using a family of schemes: telephone tones, modems, Morse, image transmission, and watermarking. Each scheme is its own submodule that shares one set of WAV, synthesis, and Goertzel primitives. The core schemes have no dependencies.

Install

pip install opentone            # core schemes (no dependencies)
pip install opentone[all]       # + image/DSP schemes (numpy, Pillow)

Schemes

Module What it carries Dependencies
opentone.dtmf Telephone-keypad DTMF tones (text or dial strings) none
opentone.morse Morse / CW on-off keyed tones none
opentone.fsk Bytes over a Bell 202 frequency-shift-keying modem none
opentone.callerid Bell 202 caller-ID (SDMF / MDMF) messages none
opentone.mf Multi-frequency (R1) 2-of-6 signalling none
opentone.fec Reed-Solomon error correction (shared by the modems) none
opentone.sstv Images over slow-scan-TV-style FM numpy, Pillow
opentone.spectrogram An image painted into the audio spectrogram numpy, Pillow
opentone.watermark Hidden data inside existing audio numpy

Quickstart

DTMF (also re-exported at the top level for backwards compatibility):

from opentone import encode_text, decode

encode_text("hello world", "message.wav")
print(decode("message.wav"))          # "hello world"

Morse:

from opentone import morse
morse.encode_text("SOS", "sos.wav")
print(morse.decode("sos.wav"))        # "SOS"

FSK modem, with optional Reed-Solomon error correction:

from opentone import fsk
fsk.encode(b"arbitrary bytes", "data.wav", nsym=8)
print(fsk.decode("data.wav", nsym=8))  # b"arbitrary bytes"

Caller-ID:

from opentone import callerid
callerid.encode("call.wav", number="5551234567", name="JARBAS AI",
                timestamp="06041530", mdmf=True)
print(callerid.decode("call.wav"))

Image into a spectrogram, and slow-scan-TV image transmission:

from opentone import spectrogram, sstv
spectrogram.encode_image("logo.png", "logo.wav")   # view the WAV's spectrogram
sstv.encode_image("photo.png", "photo.wav", width=160, height=120)
img = sstv.decode_image("photo.wav", width=160, height=120)

Hide data in existing audio:

from opentone import watermark
watermark.embed("song.wav", "marked.wav", b"owner-id")
print(watermark.extract("marked.wav", 8))   # b"owner-id"

Input audio

The tone schemes write 8 kHz mono 16-bit WAV. To decode audio from another source, convert it first:

ffmpeg -i some_file.mp3 -acodec pcm_s16le -ac 1 -ar 8000 out.wav

Documentation

Runnable scripts are in examples/.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentone-0.1.2a3.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opentone-0.1.2a3-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file opentone-0.1.2a3.tar.gz.

File metadata

  • Download URL: opentone-0.1.2a3.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for opentone-0.1.2a3.tar.gz
Algorithm Hash digest
SHA256 e26b7bde4e3b2ad2a4d853e2dd8cbd021ac65f1d94f07d71d0697024041b053b
MD5 19c1354c83806e42d36cbbbe6e126268
BLAKE2b-256 3aa68a29b08bc563226cea3daf0e70e6fb3bd10a98435d014fa1243ba0b4788e

See more details on using hashes here.

File details

Details for the file opentone-0.1.2a3-py3-none-any.whl.

File metadata

  • Download URL: opentone-0.1.2a3-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for opentone-0.1.2a3-py3-none-any.whl
Algorithm Hash digest
SHA256 d353b39d147a579beb42eb642573fa879b04d391f473ecdfc17f3b2da8922bc7
MD5 91e82dd67468f91e5717f9269025f2f8
BLAKE2b-256 c8ee26f04705ad1773afcd664abbdf2fee6caa3d11a16651bd595cd907b2abc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page