Skip to main content

Assigns light and sound frequencies to prime numbers and mixes them using pygame.

Project description

#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.

Project details


Download files

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

Source Distribution

synesthesiaer-0.0.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

synesthesiaer-0.0.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file synesthesiaer-0.0.5.tar.gz.

File metadata

  • Download URL: synesthesiaer-0.0.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for synesthesiaer-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3ef022ab0b428a956812a6cb0db1b30c7a8bff4c1ff144494b6ba473419ffab0
MD5 3f9aaba6e27ffb3af0f1f893914b294a
BLAKE2b-256 2b08c6b6ffaa23782ac4052a2f1ae4b6d7ca5c724ac7ed198e07864ba3d02d7f

See more details on using hashes here.

File details

Details for the file synesthesiaer-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: synesthesiaer-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for synesthesiaer-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5cbc781c6ab80a2c4dfcf1ffaa020fbae08eb855f2da6cd4ad0ed08211f54906
MD5 e7bc78f0a0014020f2178d7a675fb725
BLAKE2b-256 278586826fc450a6fe5c8d84fc7abf3fef21414eb1b846af06cb84985d9929c6

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 Pingdom Monitoring Sentry Error logging StatusPage Status page