attempt 4 at fps issue
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def extract_waveform_animation(audio_file, window_seconds=5):
|
|
12 |
FPS = 30
|
13 |
fig, ax = plt.subplots()
|
14 |
line, = ax.plot([], [], lw=2)
|
15 |
-
window_length = int(window_seconds * sr
|
16 |
|
17 |
# Initialize with first window
|
18 |
first_window = y[:window_length]
|
@@ -40,7 +40,7 @@ def extract_waveform_animation(audio_file, window_seconds=5):
|
|
40 |
|
41 |
total_frames = int(duration)
|
42 |
ani = FuncAnimation(fig, update, frames=range(total_frames),
|
43 |
-
init_func=init, interval=window_seconds, blit=False)
|
44 |
|
45 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as tmpfile:
|
46 |
ani.save(tmpfile.name, writer='ffmpeg', fps=FPS)
|
|
|
12 |
FPS = 30
|
13 |
fig, ax = plt.subplots()
|
14 |
line, = ax.plot([], [], lw=2)
|
15 |
+
window_length = int(window_seconds * sr * FPS)
|
16 |
|
17 |
# Initialize with first window
|
18 |
first_window = y[:window_length]
|
|
|
40 |
|
41 |
total_frames = int(duration)
|
42 |
ani = FuncAnimation(fig, update, frames=range(total_frames),
|
43 |
+
init_func=init, interval=window_seconds*FPS, blit=False)
|
44 |
|
45 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as tmpfile:
|
46 |
ani.save(tmpfile.name, writer='ffmpeg', fps=FPS)
|