fastpages icon indicating copy to clipboard operation
fastpages copied to clipboard

Building Tools to Interact With Your Data | Scott Condron’s Blog

Open utterances-bot opened this issue 2 years ago • 5 comments

Building Tools to Interact With Your Data | Scott Condron’s Blog

Creating an interactive audio visualisation tool from the ground up in Jupyter Notebooks using Python.

https://www.scottcondron.com/jupyter/visualisation/audio/2020/10/21/interactive-audio-plots-in-jupyter-notebook.html

utterances-bot avatar Jul 28 '22 08:07 utterances-bot

Awesome post! Thank you for this. Also can we change the colour of the vertical line from somewhere?

AMITKESARI2000 avatar Jul 28 '22 08:07 AMITKESARI2000

Thanks, yep. With Holoviews you update styling by passing in opts with the type you want to change to opts. Here is how you would style the VLine:

def update_playhead(x,y,t):
    if x is None:
        return hv.VLine(t).opts(opts.VLine(color='red', linewidth=6))
    else:
        audio.time = x
        return hv.VLine(x).opts(opts.VLine(color='red', linewidth=6))

scottire avatar Jul 29 '22 13:07 scottire

Hello,

Thanks for this post, exactly what I was looking for ! 🤗

However, I face two issues, and you may help me resolve it.

I copied you code from All code in one place but I get the following error:

ValueError: Audio pane does not support objects of type 'ndarray'.

I changed the code to send the file path instead of audio data and sample rate to pn.pane.Audio and it executes fine.

However, I don't have any output, nothing get displayed.
FYI, I'm not familiar at all with holoviews (juste discovered it here).

I'm working with Python 3.9.13 in Jupyter with the following version:

IPython          : 8.4.0
ipykernel        : 6.15.1
ipywidgets       : 7.7.1
jupyter_client   : 7.3.4
jupyter_core     : 4.11.1
jupyter_server   : 1.18.1
jupyterlab       : 3.4.4
nbclient         : 0.6.6
nbconvert        : 6.5.0
nbformat         : 5.4.0
notebook         : 6.4.12
qtconsole        : 5.3.1
traitlets        : 5.3.0

Any idea of what is going on here?

ThomasHezard avatar Aug 01 '22 14:08 ThomasHezard

Thanks for sharing the code, this is what I am looking for. Unfortunately, the "VLine" is not updating its position when pressing the play button. Do you have any idea, why it might not be working?

ai2ys avatar Oct 08 '22 14:10 ai2ys

Hello,

Thanks for this post, exactly what I was looking for ! 🤗

However, I face two issues, and you may help me resolve it.

I copied you code from All code in one place but I get the following error:

ValueError: Audio pane does not support objects of type 'ndarray'.

I changed the code to send the file path instead of audio data and sample rate to pn.pane.Audio and it executes fine.

However, I don't have any output, nothing get displayed. FYI, I'm not familiar at all with holoviews (juste discovered it here).

I'm working with Python 3.9.13 in Jupyter with the following version:

IPython          : 8.4.0
ipykernel        : 6.15.1
ipywidgets       : 7.7.1
jupyter_client   : 7.3.4
jupyter_core     : 4.11.1
jupyter_server   : 1.18.1
jupyterlab       : 3.4.4
nbclient         : 0.6.6
nbconvert        : 6.5.0
nbformat         : 5.4.0
notebook         : 6.4.12
qtconsole        : 5.3.1
traitlets        : 5.3.0

Any idea of what is going on here?

pn.pane.Audio only accepts np.array with int16, you need to transfer your array into the corresponding format, such as:

samples16 = np.int16(samples * 32767)
audio = pn.pane.Audio(samples16, sample_rate=sr, name='Audio', throttle=500)

YuhengHuang42 avatar Jan 05 '23 03:01 YuhengHuang42