feat(studio): server-side waveform generation with caching#497
Merged
miguel-heygen merged 1 commit intoheygen-com:mainfrom Apr 25, 2026
Merged
Conversation
miguel-heygen
approved these changes
Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add server-side waveform generation for audio assets in the Studio, backed by a new /api/projects/:id/waveform/* endpoint and an on-disk cache.
Why
Waveform peaks were previously decoded entirely in the browser using the Web Audio API. For small files or projects with few audio tracks this is barely noticeable, but the approach has two compounding problems:
Memory pressure under real-world usage. Decoding audio in the browser allocates large ArrayBuffers and AudioBuffers on the main thread. For longer audio files this gets expensive, and the situation worsens when the user interacts with the timeline while decoding is still in progress, for example, dragging an audio clip to a new position. Repeating this a few times caused: (status code 5 / ERR_OUT_OF_MEMORY).
No persistence between sessions. Because decoding happened at render time with no caching, every time the project was reopened every waveform had to be fully recomputed from scratch, repeating the same expensive work indefinitely.
Moving decoding to the server with FFmpeg and persisting the result to disk solves both: the browser receives a small JSON array, and subsequent loads (including re-opens) are instant from cache.
How
Moved all waveform processing to the server so the browser no longer has to do any heavy lifting. The server decodes the audio, computes the peaks, and sends back a small JSON array that the AudioWaveform component renders directly.
Added a cache layer similar to the existing preview system. Once an audio file is processed, the result is saved to disk so reopening the project or reloading the page does not trigger any recomputation.
Test plan
How was this tested?