开发者_如何学Python
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this questionSo I have an image like this
(source: bytearray.org)Is there any algorithm to extract (get as PCM) sound from which was created that image?
Basic answer is yes.. sort of. But not from that exact picture. That is because that picture is an extremely time-compressed waveform of the sound. There are likely sound waves missing in that picture hidden between 1 pixel and the next.
In case you're wondering the algorithm is:
sound_amplitude=((pixel_height-(image_height/2))/image_height)*sound_resolution
where sound_resolution is 128 if 8 bit and 32768 if 16 bit.
But, as I said, that image is too compressed. You have multiple pixels squished into a single vertical line. You can't correctly extract pixel_height form that.
Unfortunately, the resolution of that image is too low to extract useful information. If you had a greatly zoomed-in version you could convert the pixel data back to audio.
Given sufficient precision, I'm quite sure it's possible. However, I believe this wave would be much too imprecise to allow for any good to come out of it.
To completely recover 1 second of sound at a sampling rate of, say, 44100 Hz; you need to zoom the drawing to be 44100 pixels (approx 40 screens) width.
You would need to zoom in close enough to see the actual waveform, like this:
精彩评论