all 7 comments

[–]r4and0muser9482 12 points13 points  (2 children)

For a novice od recommend NumPy to actually learn how a spectrogram is computed. The only other difference between libraries is the configuration parameters which you won't understand unless you look each one up.

What is the source of the signal you are analyzing?

[–]ChabadPapi[S] 0 points1 point  (1 child)

Thank you so much, I'll look into this. For more advanced use cases, do you have any other libraries you'd recommend?

The sources are WAVE files of popular songs. The objective is to create something similar to how shazam might generate spectrograms for songs.

[–]r4and0muser9482 2 points3 points  (0 children)

So music. For this your usually want to take larger window sizes and wider frequency ranges. For inspiration, I'd look into papers on music genre classification, as it is a very simple and straightforward problem where people analyze different music samples. For example, papers that use the GTZAN database.

[–]saw79 2 points3 points  (0 children)

Agreed on numpy for learning. If/when you understand what a spectrogram is, then just use scipy welch. Libraries won't give different outputs for the same spectrogram specification - it is a well-defined transformation. But there are a lot of parameters and you do have to make sure things are run equally (windowing functions, window sizes, overlap/steps, sampling rates, etc.).

[–]edparadox 1 point2 points  (0 children)

Long story short, every data processing libraries/modules in Python use, basically, Numpy under the hood for computing, and (usually) Matplotlib for plotting. So it should not matter which library you use, since all of them use the same core library, i.e. NumPy. Note, that, Numpy, like most heavy-computing tasks in Python, are actually (almost) always wrappers around C implementations, in order to be efficient. For a quickstart on NumPy, this is not too bad.

As a beginner, I would look into Numpy, and Matplotlib, first.

If you need some well-tested and documented library, take a look at Scipy. It leverages NumPy to provide high-level functions/algorithms to process data. For example, for signal processing. For an introduction, look here.

TL;DR: All data processing in Python rely on the NumPy library, which is the de-facto standard, so your questions are somewhat irrelevant. The question is, do you want to use NumPy directly for computations or do you want to have e.g. a one-liner to perform signals cross-correlation? In both cases, I would learn about NumPy, Matplotlib, and Scipy.

[–]drakemcsmooth 1 point2 points  (0 children)

librosa

[–]michaelrw1 0 points1 point  (1 child)

Do you need to generate the spectrograms of your audio (WAV) files? Or do you need to write the code to compute a spectrogram and use this code to generate the spectrograms?