

Show HN: Small C Program to Convert Photos to Audio - kylophone
https://github.com/kylophone/spectro-photo

======
cnvogel
Aphex Twin had hidden spectrogram images in some of his tracks in the past,
unfortunately I think they are not well preserved by multiple steps of
compression/reencoding to youtube videos.

[https://www.google.de/search?q=Aphex+Twin+Spectrograph&tbm=i...](https://www.google.de/search?q=Aphex+Twin+Spectrograph&tbm=isch)

[https://youtu.be/M9xMuPWAZW8?t=5m31s](https://youtu.be/M9xMuPWAZW8?t=5m31s)

~~~
KeytarHero
On Madeon's latest album, he hid his logo in the transition between two
tracks: [http://i.imgur.com/yPJTTs0.jpg](http://i.imgur.com/yPJTTs0.jpg)

It sounds pretty cool too - you can hear the tones going up & down:
[http://www.youtube.com/watch?v=lz10F2Rtqv8&t=3m40s](http://www.youtube.com/watch?v=lz10F2Rtqv8&t=3m40s)

------
daeken
On the flipside of this, there's an interesting hack you can use to generate
textures from audio, primarily for use in size-constrained demos.
[http://www.iquilezles.org/www/articles/gmdlsgfx/gmdlsgfx.htm](http://www.iquilezles.org/www/articles/gmdlsgfx/gmdlsgfx.htm)

------
kylophone
This turns an image into a PCM audio file. The image is visible on the
spectrogram. For example, here's Ernest Hemmingway punting a beer can:
[http://imgur.com/QR5a8mw](http://imgur.com/QR5a8mw)

------
jheriko
+1 stb_image.h it uses a good interface for an image loading library,
something nobody seems capable of even in the "good ol' days"... just a shame
it doesn't support more of PNG (16-bit channels would be nice, and support for
bigger images too)

using libpng, libjpeg etc. however is a massive pain with lots of work
required even if you just want to do what everyone does pretty much and load a
file into RGBA buffer and get back the width and height. :)

~~~
kylophone
Yep. The stb_image.h API is very simple. Also, because its just an #include,
you don't need to worry about your users needing to figure out how to link a
library.

------
neilh23
I got some very interesting results from feeding fractal images into a program
like this a few years back - unfortunately, I don't have the resulting sounds,
but you pick less busy images with filaments, and adjust the contrast - the
result is very organic. Must have a go with this ...

------
naggie
Very interesting. I wonder how it would cope with some noise -- for example
playing the resultant file and recording it with a microphone for example.

I suspect there will be content lost at the bottom and the top of the image
depending on the frequency response of the microphone/speaker.

~~~
wrigby
I would expect to see the frequency response of the speaker + mic combination
show up as darker and lighter horizontal bands in the image (since these
spectrograms are plotted with frequency on the y axis). It might look really
cool!

Edit: depending on the time alignment / phase response of the speakers, you
might see the low frequency parts of the image get distorted to the right.

~~~
kylophone
Give it a try! The output file contains both very low frequencies and also
frequencies up to Nyquist, in this case 24kHz.

~~~
wrigby
I'll try to give it a shot! What are you using to generate the spectrograms?

~~~
kylophone

      sox -c 1 -r 48000 -b 32 -e float -t raw out.raw -n spectrogram

~~~
eridal
please post your results!

science is fun

------
el33th4xx0r
transfer it via phone line, you'll got facsimile

