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
ENH: Remove signal.spectrogram, replace with vocalpy.spectrogram #88
The signal.spectrogram code is ... not great (speaking as the author). In example snippets we log transform to visualize as a very crude sort of map to dB
Ideally there should be a way to get a Spectrogram by default from some function that looks good. Ofc "looks good" depends on parameters and these can vary depending on species. But seems like we can offer "good enough" for now.
Librosa.stft provides better looking spectrograms by default, but for someone who does not think DSP natively (e.g., moi) it is not intuitive to have to do the steps of stft -> amplitude_to_db(np.abs(S))
So I think we should:
remove signal.spectrogram
add a function vocalpy.spectrogram or spect_from_audio that gives back a Spectrogram from an Audio
basically a wrapper around librosa.stft
that does the stft -> amplitude_to_db(np.abs(S)) step
that additionally uses other librosa helper functions to get times and frequencies for the vocalpy.Spectrogram
and of course in the docstring we should point out it's just a wrapper around these functions and ask people to cite librosa
... I'm unsure about whether I want to keep the spectrogram namespace to put other things in or if I want to prefer a flatter namespace. The whole point of this will be to make it as easy as possible to get a vocalpy.Spectrogram to visualize, so I think we should go with flat. The other things I would put in a spectrogram namepsace would be other ways of computing spectrograms, e.g. multi-taper, time-freq replacement, whatever sigsound does (fancy Theunissen thing I am as yet too dumb to understand). But I think those make more sense in the spectral module
Activity
NickleDave commentedon Dec 27, 2023
We should have a parameter like
transformthat can be either a string or a callableRewrite spectrogram module to have single spectrogram function that r…
Remove spectrogram function from vocalpy/signal/spectogram.py, fixing #…
Rewrite spectrogram module to have single spectrogram function that r…
Remove spectrogram function from vocalpy/signal/spectogram.py, fixing #…
Rewrite spectrogram module to have single spectrogram function that r…
Remove spectrogram function from vocalpy/signal/spectogram.py, fixing #…