Spectrogram PNG to scipy.signal.spectrogram - audio

I currently have a PNG of a spectrogram such as:
I don't have the original audio file but am wondering if there is a way I can convert this into a SciPy spectrogram object. I was thinking I could try to convert the image to an audio file first, but it seems like there aren't many packages reconstructing spectrogram audio since there's already so much lost data.
Any ideas and suggestions would be appreciated!

Related

Effect of Change of Audio Bitrate on Spectrograms

I was working on changing bitrates of some MP3 files from 160kbps to 80kbps just to see how it affects the audio quality and frequencies. So I plotted the spectrogram for both waves and it looks something like this (Upper one being 80Kbps ofcourse).
I was curious to know if spectrograms are in any way related to audio bitrates but just after a simple search it turned out that they are not. It would be great if someone could explain to me the reason behind the differences in frequencies in the spectrograms if people say that there is no relation. Also if I had to analyse the differences between the two audio waves then what would be the best way to do this if people say spectrograms shouldn't be used?
Sorry if I am missing something here as I am not from the signal processing field but I am keen on learning. Any direction or links that could help me out would be great. Thanks in advance!

Is there a way to use H.264 with custom color repersentation?

I'm currently developing new file format, it's a video with custom color representation. Every color is a single byte; there's a constant RGBA colors array, every byte of the frame is the index of color in this array. Therefore every pixel in a single byte.
So I'm looking for a way to compress videos with such format. My first idea was is create this video format myself (which unfortunately failed), second idea is H.264, but I don't know if there's any way to use H.264 this way. So is there? Or maybe there's another way to compress such video data? (except gzip, lzma, bzip2, 7zip and so on)
Please, don't close this question. I'll add all asked details if needed.
The best I can suggest for such idea would be to encode it in 4:0:0 (mono) colorspace in lossless mode in H.264. For x264 this would mean options: --input-csp i400 --output-csp i400 --qp 0. But I doubt motion compensation would be good in such palette colorspace.

How to turn an array of pixel data into a gif with node?

I'm trying to build a live gif, just for kicks, and I want to turn a 2D array of pixel data into a gif (or more specifically one frame of an animated gif). I found gifencoder and it works but it's slow as molasses (~800ms to encode a 500x500px gif). Every other solution I can find (e.g. things built on graphicsmagick or imagemagick) don't seem to have a way to accept input streams, but just already encoded images. I suppose I could just dump data to a .bmp, but that's a very roundabout way to accomplish this. The other thing I'm thinking is just lzw encoding the data but before I go digging into the technical aspects of that I'm just fishing here for other ideas.

How do I display a spectrogram from a wav file in C++?

I am doing a project in which I want to embed images into a .wav file so that when one sees the spectrogram using certain parameters, they will see the hidden image. My question is, in C++, how can I use the data in a wav file to display a spectrogram without using any signal processing libraries?
An explanation of the math (especially the Hanning window) will also be of great help, I am fairly new to signal processing. Also, since this is a very broad question, detailed steps are preferable over actual code.
Example:
above: output spectrogram;
below: input audio waveform (.wav file)
Some of the steps (write C code for each):
Convert the data into a numeric sample array.
Chop sample array into some size of chunks, (usually) overlapped.
(usually) Window with some window function.
FFT each chunk.
Take the Magnitude.
(usually) Take the Log.
Assemble all the 1D FFT result vectors into a 2D matrix.
Scale.
Color the matrix.
Render the 2D bitmap.
(optional) (optimize by rolling some of the above into a loop.)
Add plot decorations (scale, grid marks, etc.)

Get aplitude curve from audio

I am using libmpg123 library for parsing and decoding mp3 song, but I want draw something like this:
http://img.photobucket.com/albums/v627/Flabbergast/jurafirstCDpressing-1.jpg
How can I get an amplitude from mp3 song? I am trying to find solution in a lot of pages but without good result.
Thanks for your answer

Resources