marquesafonso commited on
Commit
1720501
·
verified ·
1 Parent(s): 775064d

refactor update function for windowed view

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -26,11 +26,11 @@ def extract_waveform_animation(audio_file):
26
  def update(frame):
27
  start = frame * sr
28
  end = min(start + sr, len(y))
29
- line.set_data(np.linspace(0, duration, num=len(y[:end])), y[:end])
30
  return line,
31
 
32
  # Create the animation
33
- ani = FuncAnimation(fig, update, frames=np.arange(0, int(duration)), init_func=init, interval=7, blit=False)
34
 
35
  # Save the animation to a temporary file
36
  with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as tmpfile:
 
26
  def update(frame):
27
  start = frame * sr
28
  end = min(start + sr, len(y))
29
+ line.set_data(np.linspace(start, end, num=len(y[:end])), y[:end])
30
  return line,
31
 
32
  # Create the animation
33
+ ani = FuncAnimation(fig, update, init_func=init, interval=7, blit=False)
34
 
35
  # Save the animation to a temporary file
36
  with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as tmpfile: