• Welcome to Maher's Digital World.

Picture of a sounds

Started by Daniil, February 04, 2013, 12:12 PM

Previous topic - Next topic

Daniil

Hello again, comrades!

I had some C++ coding for fun on Sunday evening... And wrote a program, which converts a sounds to a pictures.

I.e. I take a .wav file, and program reads the file and transform it to a colorful image, basing on amplitude and frequency data. My main interest was to create a very fast algorythm of conversion, but - it's very beautiful also!

Look here, here is our nicknames transformed into a picture view:
Daniil


Ahmad


humbert


Maher


scarface


Shadow.97



Also - here's our forum name - Maher's Digital World.


Blue is sound amplitude, white is frequency; colorful peaks on background is maximal frequencies at that quantum of time. They're mostly red with yellow and some green because of my low voice -  program analyzing frequencies and show it like a colour (red is low, blue is high).

In sound waves is some kind of a strange, mystical beauty. It's kind of a specific "pure" beauty of physical processes, like a falling of water blobs or graceful curves of space orbits. Strange and fascinate.

Whoaf...  :P I had fall asleep at 4:00 am (that was good coding session!  ;D) I'll go now, on other posts I'll answer later.  :)

Shadow.97

Nicely done daniil, is there a maximum lenght of the soundfile? It would be interesting too see some music and other things like a roaring car engine.
It works like one of those in hospitals, right? ( those who show heart activity )

Daniil

@Shadow.97
Well, comrade, in fact there is no real restriction for length (maybe only RAM size). But on long samples program lose accuracy. It works not exact like heartbeat monitors. HBM write exact curve, program approx it. You must understand, that, for example, in your nickname (if write it as .wav stereo at 44100 sampling rate) is about 200000 wav "sound blocks". And we must "pressurize" this huge amount of blocks at about 1024-1440 pixels of picture width (size of typical wallpaper). Ofcourse we approximating values of "sound blocks", loosing accuracy by this.

I think that best sample size is up to 30 seconds. I'll try to converting other sounds - machinegun fire, car and plane engine ofcourse, blizzard sound... If any of you have an ideas what to convert, tell to me.

Ahmad

Well done, dear friend.
And thanks a lot for mentioning me.
Wish you all the best.
:)
Muhammad is the messenger of Allah.

Daniil

Thanks, thanks, comrades.  :)

That's a bunch of new pics:
Short-wave superheterodine (woo-woo sound if your old AM-reciever isn't tuned to radiostation)


"Ku-ku" - old clocks with a bird (that one who lurks inside a clocks, and when a time comes, jump out of there and cry "Err-m... What? What should I do?.. Where'm I?.. What?.. Six o'clock?.. Oh, yes, yes... Khm, khm... Coo-coo!!.. Coo-coo!!.. ...")  ;D



Also, I had watchin' new season of a TopGear, and convert some sounds linked with TopGear Show and cars:
TopGear Opening Theme (a.k.a. "Jessica"):


Ferrari Scuderia engine sound (starts, then idle, then roll-on, then idle again, then playing with throttle):

humbert

@Daniil - the graphs you posted respond to the frequency of the sound, the volume, or both? I'm asking because the graphs don't show a pattern, or at least if they do I can't see it. Also, what instrument generated the graphs?

Daniil

Bright white graph in the middle is frequency.
Blue graph around it is amplitude (volume).
Colorfull lines around volume is dependence between volume and frequency (they bigger if volume louder, and change colour if frequency is high).

Also, there's a bug feature - very low volume program identify as a high frequency.
That's not an instrument - I record a .wav-file via microphone (or take it from the internet) and convert it to the .bmp via self-made C++ program.

humbert

Let me see if I understand. The first 3 images have a white light in the center of the line. Does this mean they're around 8000kHz? If so then does the thickness of the white line indicate higher or lower value? What about the last graph where white is absent?

More blue around the center means the volume (amplitude) is turned up higher?

Also, I'm thinking there would be great variation in sound quality of the real thing to a .wav file obtained online.

Daniil

Thiker white line - more frequency. Also, I can't say exact frequency, because program measure only relative frequency (count of "over-zero" transfers of the graph in a pixel-block)
On the last graph is record of Ferrary motor sound, it's loud but low, frequency line on image loosing.

Yes, thicker blue line means higher volume of the sound.

Also, I must remind, that values of all graphs also is relative, not absolute.

Well, .wav samples from the internet was recorded from a real things, I guess. So, in fact, if a record to .wav was made correctly, there isn't visible difference. But sometimes there is incorrect records, for example, "normalised", or converted from highly-compressed MP3. They gives bad, boring pictures with fixed blue amplitude.