i started with the idea of a tuner, which gave me the idea of Hz. since tuners don't actually "hear" the pitch of what the instrument is, it just measures the frequency, in Hertz. so i coded a little function using numpy and pyaudio to take an input .WAV file and spit out the frequency.
Great. Now what?
Well, i had to somehow convert that into a color. for the longest time, i was confused. Now, theoretically, its impossible to actually convert sound to color, but we can do something close.
You see, light in its own way has a frequency too. however its measured in wavelengths (if i understand so correctly), but sadly, Hertz was not going to do the job for me.
λ = wavelength
λ = c/f
c = velocity of light
f = frequency
However, using Hz i found out, would just produce a wavelength too minute for our eyes to pick up. we can only see (in nanometers) a range of 750 - 380, (from dark red to violet) anything else comes off as black to our eyes. so i thought of the idea of THz (TeraHertz), which is simply attained by doing (Hz x 2^40), and now i had a frequency i could use to produce a visible color on the color spectrum.
now i could do c/THz
c being the velocity of light (3x10^8 m/s) then even far so,
nm = int(pre</i>10<i></i>(-floor(log10(pre)))*100)
now i have a whole number i then used PyGame (which i had had some experience before with) to fill the background with an rgb color (using wavetorgb module to convert the Wavelength to rgb), then blit it to the screen.
Please remember, this script is not quite done yet, and please let me know how i can improve it, because honestly, i am a terrible coder, and i know there is always a better solution!
https://github.com/Pholey/Psynesthesia
Enjoy and let me know what you think!