Music Player and Cutter App: Audio / Song Waveform Plot with Multiselector

Hi,

Iā€™m trying to create an interactive sound waveform. I am able to generate a plot using matplotlib, but when i do the same with plotly, it keeps processing and eventually gives up. Is it because the sample is too big? (my 3 min no_time mp3 had a 1D array with 21891072 datapoints)

####### Code ########
#conda install -c conda-forge pydub
#conda install -c anaconda pyaudio
#conda install -c anaconda pillow
#conda install -c conda-forge ffmpeg

import pyaudio
import pydub
from pydub import AudioSegment
from pydub.playback import play
from matplotlib import pyplot as plt
from PIL import Image, ImageDraw
import numpy as np
import os
import pandas as pd
import copy
import dash
from dash.dependencies import Input, Output, State, ClientsideFunction
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import plotly.graph_objects as go

#you can load any mp3 audio song here
audio = AudioSegment.from_mp3(ā€œNo_Time.mp3ā€)
channels = audio.channels
width = audio.sample_width
frate = audio.frame_rate

#obtaining raw_data from mp3 for plotting songs waveform
data = np.fromstring(audio._data, np.int16)
#audio song aplitude data
g = pd.DataFrame({ā€˜Amplitudeā€™: data})

plt.plot(g)
#plot pic is attached

####### Code Ends ########

For plotly i have tried a bunch:

px.bar(df,x=df.index,y=ā€˜Amplitudeā€™)
px.line(df,x=df.index,y=ā€˜Amplitudeā€™)
go.Figure([go.Scatter(x=df.index, y=df[ā€˜Amplitudeā€™])])

None of them seems to work.

In the end. I want to have a plot like ā€œCompleted Wells/Yearā€ in the ā€œNew York Oil and Gasā€ dash sample app.
Oil_gas_app

And regarding, Multi-selector I mean like if you play with the ā€œcompleted wells/yearā€ graph, you can only ā€œbox-selectā€ one portion of a graph at a time, is it possible to have multiple-selector boxes over a plot? With multi-selector boxes hovering over the original plot, I can erase/cut multiple portions of a song in a single cut.

Thanks