0
$\begingroup$

I have created this spectrogram from a wav file. Please have a look: enter image description here enter image description here

I want to get the x = time, y= frequency, z=intensity(db) of every pixel of the spectrogram. How can I get these coordinates?

I am looking for a programmatic approach (using R, python,java etc).

Regards,

Elyn

$\endgroup$
1
0
$\begingroup$

You simply wouldn't: your spectrogram is just a visualization for human consumption.

What it really is is the color coded amplitude of DFTs done on overlapping sample sequences. The exact formula can be found in the documentation to the spectrogram functionality you're using.

So, if you just want to know what would be in a spectrogram at a specific position, you'd just do the same calculation -but instead of converting it to a column of colorful pixels, you'd just deal with the numeric values.

That calculation should almost be trivial: do an FFT from the correct amount of input samples, taken from the point in time you define as x, then take the y-defined frequency bin, and get the absolute value of that. Done.

Word of advise: trying to do signal analysis based on the pixels of a spectrogram is often a poor proxy for what you actually want to achieve. Maybe you'll want to ask about what you're trying to achieve in the bigger picture, in a new question post.

$\endgroup$
2
  • $\begingroup$ Thank you so much, I have got the CSV files from the "read_audio_fft" in R. And thanks for ur advice. Actually, I want to propose a method for bird acoustic activity calculation, based on morphological filtering and calculating of the spectrogram, which might be a new proxy for biodiversity. I don't know why doing signal analysis based on the pixels of a spectrogram is often a poor proxy. Do you want to talk more about it? $\endgroup$
    – Elyn
    Jun 6 at 7:15
  • $\begingroup$ sentiment here: if birds would sing in equally sized frequency bins that happened to align with the raster of the FFTs, then it would be a good fit. It's not – the spectrogram is a non-parametric estimator. It's as good (or as bad) at showing you the spectrum of a loudly whirring machine as of a nightingale. Maybe look into the literature what others did when analyzing birdsong – my guess is that the usual pre-processing is MFCCs, not linear-frequency spectrograms. $\endgroup$ Jun 6 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.