Skip to main content

Phonochrome

Phonochrome is a bijective 8-bit RGB encoding library that generates phonotactically plausible appellations. The library constructs a unique string for each of the 16.7 million possible 8-bit RGB tuple permutations ($256^3 = 16,777,216$).

Each RGB component is first converted to base 16, which allows us to derive values from a more compact set of characters, represented as $S$. Let $x^1$ and $x^2$ represent the two hexadecimal digits (since the range 0-255 only comprises up to FF). If a component is less than 16, its hexadecimal string will be zero-padded to a length of two. Each hexadecimal character is then reconverted into decimal to serve as an index. $x^1$ maps to $C \subsetneq S$, and $x^2$ maps to $V \subsetneq S$, where $C$ and $V$ are lists of consonants and vowels (or vowel-like phonetics), meticulously curated to ensure phonotactic plausibility. The order of these lists changes based on the index of the enumerated RGB tuple. This is done for each component before the generated parts are concatenated and returned as an appellation.

Example Usage

The library is extremely easy to use, and comes with two functions: encode and decode.

>>> import phonochrome

>>> black_rgb = (0, 0, 0) # define our RGB tuple
>>> phonochrome.encode(black_rgb) # encode the RGB into a phonochrome appellation
'bacedi'
>>> import phonochrome

>>> phonochrome.decode('bacedi') # encode the RGB into a phonochrome appellation
(0, 0, 0)

Command Line Interface

Phonochrome comes with a command line interface which is automatically added to your environment's scripts upon installation. You can invoke it like this:

$ phonochrome encode 122 16 14
'kusdeda'
$ phonochrome decode kusdeda
(122, 16, 14)
$ phonochrome --help

usage: phonochrome [-h] {encode,decode} ...

Phonochrome: A bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.

options:
  -h, --help       show this help message and exit

Commands:
  {encode,decode}
    encode         Encode an 8-bit RGB tuple into a phonochrome appellation.
    decode         Decode a phonochrome appellation into an 8-bit RGB tuple.

In the event that an invalid argument was passed to encode/decode, the script will terminate with exit code 2, otherwise code 0.

$ phonochrome encode 295 543 712
Error: Invalid 8-bit RGB tuple: (295, 543, 712)
$ phonochrome decode invalid
Error: Invalid appellation: 'invalid'

Installation

Install from pip:

pip install phonochrome

Metadata

Release files for phonochrome 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phonochrome 1.0.0
File Size Uploaded Provenance Actions
phonochrome-1.0.0.tar.gz 4.6 kB Without provenance Details for phonochrome-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phonochrome 1.0.0
File Interpreter ABI Platform Actions
phonochrome-1.0.0-py3-none-any.whl Python 3 none any Details for phonochrome-1.0.0-py3-none-any.whl

Total release size: 9.5 kB

Release files / phonochrome-1.0.0.tar.gz

Download URL phonochrome-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e88ffb679adb26f1c38480df618747bfe6f0726286b92a64468c981bc9498fb
BLAKE2b-256 checksum
How to use checksums
22cc808b2f8eda713e72180a32f67e2998967cf333e8249319838fed4d0dfba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / phonochrome-1.0.0-py3-none-any.whl

Download URL phonochrome-1.0.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d17818e487484400ed5b772afe64126c1217561ca2c78311434ff9700b3164c
BLAKE2b-256 checksum
How to use checksums
bf9e912d01f89704bd0ea20d5c1aa132e706d93b33e7c21078648c2b4174f1e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for phonochrome 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page