Hello Bokeh users,
I want to create an interactive version of an audio Spectrogram in a Jupyter Notebook where the user can click on the Spectrogram and have the audio jump to that location.
The plot would have a red line over the Spectrogram that indicates where the audio currently is in real-time.
Also, I want to sync some other plots (audio information for the current timestamp), therefore Bokeh seems more appropriate than Matplotlib.
The part I want to know now is how to plot a Spectrogram with Bokeh.
With Matplotlib you would use [
matplotlib.pyplot.pcolormesh](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pcolormesh.html#matplotlib.pyplot.pcolormesh)
.
As example, take a look at the Librosa library for audio that makes use of this: https://librosa.github.io/librosa/generated/librosa.display.specshow.html
I tried to run the Spectrogram example found here: https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram
However, I ran into a deprecated error
(https://github.com/bokeh/bokeh/issues/8779) and this example is also without Jupyter Notebook.
I found this stackoverflow question: https://stackoverflow.com/questions/51090223/bokeh-plot-a-spectrogram
However, it doesn’t seem that straightforward and not sure if this is the right approach?
QuadMesh
In GeoViews a QuadMesh function is added in version 1.5: http://blog.holoviews.org/release_1.5.html
Which is described as “GeoViews now also has a QuadMesh
element (akin to matplotlib’s pcolormesh
).”
Therefore, that seems like a useful function?
In this HoloViews Github issue an user used this QuadMesh approach, but mentioned he couldn’t share the full code:
https://github.com/pyviz/holoviews/issues/3107
Question
There are many snippets around how to do a Spectrogram with Bokeh, but since I don’t have experience with Bokeh yet, it’s kinda hard to wrap my head around it.
It would be very helpful if someone could add a Spectrogram example to Bokeh notebooks here: https://github.com/bokeh/bokeh-notebooks
or any other advice / link to a tutorial that would help me get started.
Thank you for reading.