Skip to main content

#pygame virtual keyboard which assigns a prime number, light frequency, and sound frequency #to keys. it mixes the light frequencies to corresponding RGB colors, mixes #the pure tones to sounds, and multiplies the primes to get unique numbers.

This code assigns a color and sound to a range of positive integers in a natural way.

Input: n

  1. Factor n into a product of primes n = p_1^s_1 * ... * p_r ^s_r

  2. Map every prime to a wavelength into the visible range which is roughly 380nm (800Thz, violet) - 700nm (400Thz, red). Use f_red*(f_violet/f_red)^((i-1)/(num_keys-1)) in analogy to the keyboard mapping of sound frequencies 440Hz*2^((i-49)/12).

  3. For example, the number 197 is p_45. Its light frequency is 492 THz -> 608nm wavelength, so red. 563 is p_103, so 649 THz -> 462nm, so blue. Combining them we get the number 110911 which has a bright purple color.

  4. To convert this spectrum to the appropriate color of light we use the CIE color matching functions (https://www.cs.rit.edu/~ncs/color/t_spectr.html). This can be implemented in almost any language. (https://mathematica.stackexchange.com/questions/57389/convert-spectral-distribution-to-rgb-color/57457#57457).

Output: An RBG color specification.

A similar method can be used for sound, in which case we just scale into the audible range of 20Hz - 20kHz. We then need to mix the tones to get a sound using a synthesizer package, in this case tones.

Importantly, spectra of colors and sounds combine additively. Combining natural numbers via multiplication is straightforward.

This could be used to make a *keyboard whose keys are appropriately colored and labeled by prime numbers.

Metadata

Release files for synesthesiaer 0.1.1

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

Source distribution (sdist)

Source distribution for synesthesiaer 0.1.1
File Size Uploaded
synesthesiaer-0.1.1.tar.gz 6.9 kB Details

Built distribution (wheel)

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

Total release size: 14.3 kB

Release files / synesthesiaer-0.1.1.tar.gz

Download URL synesthesiaer-0.1.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
56911c297598c576512e7aeb3f79b00ee4e35020f152c3176d0addd561bda4c1
BLAKE2b-256 checksum
How to use checksums
e48951ee7352a60f99d4acfbfa7cfc9948e1f9b554c4b73ca5f12cc9037b0639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.9

Release files / synesthesiaer-0.1.1-py3-none-any.whl

Download URL synesthesiaer-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb91302688f2aed1ebb5004f63b832a4494e738864494adf1b9287615519c786
BLAKE2b-256 checksum
How to use checksums
35647e37bb2aa54777c8ee3e7bd65c9533320bb9d9a1625f29185dfb8634bbc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

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