pynesthesia
Description
Pynesthesia is inspired by the condition "synesthesia," which refers to when one sense triggers other senses. An example of this would be seeing colors when hearing music or being able to taste words. Our python package reads a given file's SHA-256 hash and is able to turn it into colored text, a jingle (MP3), chiptune (WAV), a page of fortune cards (HTML), or a flower drawing (SVG).
PyPI Page and Install
Our package is on PyPI at pynesthesia
pip install pynesthesia
How It Works
A SHA-256 hash consists of 32 numbers from 0 to 255. Each of our features use these numbers to determine qualities like tempo, notes, words, colors, and flower type.
Using Pynesthesia
Begin by generating a hash for a given file:
from pynesthesia import hashseed
seed = hashseed.generate_file_hash("/absolute/path/to/file.txt")
# Return the file's SHA-256 hash, or None if it cannot be read.
Colored text
from pynesthesia import colors
print(colors.colorize(seed))
# add a color for each character of the text in terminal
Jingle
from pathlib import Path
from pynesthesia import jingle, output
output.save_mp3(seed, Path("jingle.mp3"), measures=4)
# encode the generated electronic audio as an mp3
for block in jingle.audio_blocks(seed, measures=2):
print(len(block))
# make one measure of audio at a time
Chiptune
from pynesthesia import chiptune
wav_bytes = chiptune.create_chiptune(seed, bpm=140, bars=4, wave_type="square")
# Turn a SHA-256 hash (64 hex characters) into WAV bytes. Same hash -> same song.
# bpm: 60-240 (default: picked by the hash) bars: 1+ (default 4)
# wave_type: "square" (default), "triangle", "saw", "pulse"
chiptune.save_chiptune(seed, "chiptune.wav", bars=8, wave_type="saw")
# Create the chiptune and write it to `path` as a .wav file. Same arguments as above.
# Refuses to replace a file that already exists (raises FileExistsError).
8-BIT
from pynesthesia import retro8bit
wav_bytes = retro8bit.create_retro(seed, bpm=150, bars=4, wave_type="pulse25")
# Turn a SHA-256 hash (64 hex characters) into 8-bit WAV bytes. Same hash -> same tune.
# bpm: 60-240 (default: picked by the hash) bars: 1+ (default 4)
# wave_type: "pulse12" (thin), "pulse25" (nasal, default), "pulse50" (full), "triangle" (soft)
retro8bit.save_retro(seed, "retro.wav", bars=8, wave_type="pulse12")
# Create the 8-bit tune and write it to `path` as a .wav file. Same arguments as above.
# Refuses to replace a file that already exists (raises FileExistsError).
Fortune cards
from pynesthesia import htmlgen
cards = htmlgen.generate_cards(seed)
htmlgen.write_html(cards, "fortunes.html")
Flower
from pynesthesia import flower
species, style = flower.choose_flower(seed)
# turn a sha-256 hash into name of flower species and art style
svg_text = flower.render_flower_svg(seed)
# turn a sha-256 hash into flower drawn as svg text
flower.svg_to_file(seed, "flower.svg")
# save svg text of hash into a .svg file
Example program
examples/demo.py uses every function above. Run it from a clone of this repo with:
pipenv run python examples/demo.py
Run from Command Line
Make sure file paths are absolute. Output can be found in the 'pynesthesia_output' folder.
jingle: create a jingle from a file--measures: number of measures (1-112, default 8)
pynesthesia jingle /absolute/path/to/file.txt --measures 4
chiptune: create a chiptune wav from a file--bars: length in bars (1-32, default 4)--wave: melody sound (square, triangle, saw or pulse; default square)
pynesthesia chiptune /absolute/path/to/file.txt --bars 8 --wave saw
html: Create a html fortune page from a file
pynesthesia html /absolute/path/to/file.txt
colorize: text to print in color
pynesthesia colorize 2cf24dba5fb0a30e
Configuration
Environment variables
pynesthesia doesn't use any environment variables.
Starter data
pynesthesia doesn't use a database or need any starter data.
Secret configuration files
There is no .env or other secret file.
Optional settings
Jingle tempos, scales, rhythms, sounds and length limits are in src/pynesthesia/jingleConfig.json.
Contributing
- Set up:
git clone https://github.com/software-students-fall2026/python-package-exercise-nocturnal.git
cd python-package-exercise-nocturnal
pip install pipenv
pipenv install --dev
- Test:
pipenv run python -m pytest --cov=pynesthesia --cov-report=term-missing --cov-fail-under=100
- Build and check:
pipenv run python -m build
pipenv run twine check dist/*
Team
Metadata
Release files for pynesthesia 2026.11.11.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pynesthesia-2026.11.11.22.tar.gz | 43.2 kB | With provenance | Details for pynesthesia-2026.11.11.22.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pynesthesia-2026.11.11.22-py3-none-any.whl | Python 3 | none | any | Details for pynesthesia-2026.11.11.22-py3-none-any.whl |
Total release size: 77.8 kB
Release files / pynesthesia-2026.11.11.22.tar.gz
| Download URL | pynesthesia-2026.11.11.22.tar.gz |
|---|---|
| Size | 43.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ded84759cd41b5e9600fa81ed1770ffd51b67f77c014562a85fcb5872243e9f0
|
|
BLAKE2b-256 checksum How to use checksums |
af9ba305bbbaf04ff91370073b878027c994b61c3704e0d3cbe150760b9c7a2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / pynesthesia-2026.11.11.22-py3-none-any.whl
| Download URL | pynesthesia-2026.11.11.22-py3-none-any.whl |
|---|---|
| Size | 34.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76a9158611581797526297e311d91bfaa530d09b4266131ecb492b04ded569e0
|
|
BLAKE2b-256 checksum How to use checksums |
a2bb9c14de9b01a35d694f21a3320a356ff4f0de74e2baf2eb3a1c2fd9fd42e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for pynesthesia 2026.11.11.22
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pynesthesia-2026.11.11.22.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA 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.