# What's the easiest method to store a spectrogram graph like a data struture that may be in comparison against?

I've produced a procedure much like Shazam that produces a Spectrogram of the given seem clip. I'm trying to puzzle out a means by which to keep this data right into a database to ensure that I'm able to run evaluations onto it. (I do not need actual code, just conceptual help around the process).

For individuals not really acquainted with a spectrogram, its a graph of your time around the x-axis and frequency around the y-axis. I want a means of saving this data in ways will be able to run evaluations. Also, I can not simply produce a lengthy from the frequency values from left to right because that turns into a time complexity problem when attempting to look against it with large data sets (essentially an N^2 substring comparison).

Basically I believed about producing some kind of hash around the seem clip and saving the information like a trie or suffix tree from the hash but I am unsure the way i could perform a comparison for this then.

Any ideas could be greatly appreciated.

This can be a 2D array. Possibly a sparse one if the majority of the information is ..

I'd make use of a ROOT histogram (say [cde]) to prevent needing to manage all of the edge cases and so forth, though just about any scientific library should support a suitable data structure. ROOT supports a minimum of two histogram similarity measures (Chi squared and Kolmogorov) which will help you to make quantitative evaluations.

You may either store it as being a raw 2D array, or you will have to do some greater level feature extraction (track pitch curves etc) to extract the functional features which you'll then use to compare reasons.

The issue having a hash is you need close matches, not exact matches - I believed of something like removing the (time, freq) tuples of local peaks within the spectrogram after which putting individuals inside a http://en.wikipedia.org/wiki/Spatial_database .

To look you can extract n greatest peaks (four to eight?) after which look for the nearest peaks within the spatial database and get the best fitting match.