You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DOC: Add units for SAT similarity features to docstrings #172
Activity
NickleDave commentedon Jun 25, 2024
Hi @ralphpeterson -- sorry I haven't been able to get you an answer sooner.
Here's an initial answer, I will come back and edit this a little more.
Short answer: well, we should probably have them in our docs, or at least the docstrings.
The real source would be the SAP docs (http://soundanalysispro.com/manual/chapter-4-the-song-features-of-sap2) and the original paper describing the method using a similar set of features (https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=77e7e76f1706d6aa73e7dc9464c1817dc978926e). Note, though, that
vocalpyimplements the features from Sound Analysis Toolbox, that is written in Matlab, and as far as I know does not have any documentation besides this page: http://soundanalysispro.com/matlab-satI'll do my best to write down what I can gather from those sources here, for the list of features returned by
feature.sat.similarity_features.amplitude
is in decibels; note that we copy exactly what SAT/SAP do (according to the SAT code and the SAP docs):
This is different from the SAP paper, that describes amplitude as "unitless", although they point out you can convert to decibels given a reference amplitude. The way I'm used to seeing it done is with a factor of 20 under the assumption we are working with the signal's amplitude (see http://msp.ucsd.edu/techniques/v0.08/book-html/node6.html and https://dspillustrations.com/pages/posts/misc/decibel-conversion-factor-10-or-factor-20.html) Basically you would take the values and convert it with
amp_dBs = 20 * np.log10(amp / amp_ref)but we instead multiply by 10. Not sure what detail I'm missing though, maybe because we are summing energy in the columns of the spectrogram to get the amplitude?pitch
we are using the
librosaimplementation of the YIN algorithm (http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf), a good enough approximation of SAT using (IIRC) the original C implementation of YIN that they vendor, or something like that. So, here "pitch" is really fundamental frequency, and as such I think it should be given in Hertz.goodness of pitch
http://soundanalysispro.com/manual/chapter-4-the-song-features-of-sap2/goodness-of-pitch
The SAP docs say "Units are comparable to amplitude and can be converted to dB by subtracting a baseline and converting to log scale (not implemented in current version)."
SAT is basically taking the max of the cepstrum, in units of quefrencies, which I think should be "seconds", although the way we end up back at seconds is weird if you are doing dimensional analysis, see https://en.wikipedia.org/wiki/Cepstrum#Related_concepts
frequency modulation
See http://soundanalysispro.com/manual/chapter-4-the-song-features-of-sap2/frequency-amplitude-modulation
"FM is the angular component of the squared time and frequency derivatives" ... so I think that means it's in radians.
amplitude modulation
See again http://soundanalysispro.com/manual/chapter-4-the-song-features-of-sap2/frequency-amplitude-modulation
"Units of AM are 1/t"
entropy
The SAP docs say "Wiener entropy is a pure number, , that is, it does not have units"
http://soundanalysispro.com/manual/chapter-4-the-song-features-of-sap2/wiener-entropy
but I see other sources saying you can convert it to dBs (https://en.wikipedia.org/wiki/Spectral_flatness#Formulation).
The
vocalpycode does what SAT does, which I think is leaving it as a "pure number", i.e. just treating the spectrum as a probability distribution, basicallyHope that helps! Happy to hear any feedback on if we should put this in the docs, try to add units with xarray, etc
ralphpeterson commentedon Jun 26, 2024
Thanks David! I think units in the docstring + somewhere else in the documentation would be good for users reporting these features in papers
[-]units for similarity features[/-][+]DOC: Add units for SAT similarity features to docstrings[/+]NickleDave commentedon Jun 26, 2024
Agreed, good idea. Changed the issue title and will put this on the to-do list. Thank you @ralphpeterson