Abstract
Audio inpainting aims to restore missing or corrupted segments in sound recordings. While existing methods excel at repairing millisecond-scale gaps, they often fail when faced with longer durations of several seconds. This paper proposes a novel approach that exploits the inherent structural redundancies in music. By constructing a similarity graph based on log-spectrogram and phase derivative features, the algorithm identifies matching segments from other parts of the recording to fill gaps seamlessly. Perceptual tests indicate that this method can restore audio with high fidelity, often indistinguishable from the original to human listeners.
1. Introduction
Traditional audio restoration techniques typically address "micro-gaps"—short-duration artifacts like clicks or pops. These methods rely on local signal continuity, assuming that the audio characteristics remain stable across the gap. However, for "macro-gaps" lasting seconds—caused by physical damage, environmental noise, or transmission errors—local interpolation is insufficient. This work addresses long-duration audio inpainting by leveraging the repetitive nature of musical structures, such as choruses and motifs.
2. Methodology
The proposed method relies on finding similar content within the same track to transplant into the missing segment.
2.1 Feature Extraction
To capture the essential characteristics of the music, the algorithm extracts two primary features: a normalized log-spectrogram for loudness and the partial derivative of the phase for instantaneous frequency. This dual representation ensures that both rhythmic and tonal information are preserved, providing a robust basis for similarity comparison. Using the phase derivative is particularly crucial as it allows the algorithm to match stable harmonic components even when volume varies.
2.2 Graph Construction and Persistence
Every time point in the audio is represented as a node in a similarity graph. Edges are established between nodes with high feature similarity. To ensure temporal coherence, the algorithm identifies sequences of matching frames rather than isolated points. This "time-persistence" is achieved using a diagonal convolution kernel to filter out coincidental similarities. The resulting graph is then sparsified to focus only on the strongest structural connections, significantly reducing computational complexity.
2.3 Optimization and Stitching
When a gap is identified, the algorithm searches the graph for the best candidate segment. The selection process optimizes a cost function that considers the gap length, transition smoothness at the boundaries, and the overall similarity of the replacement segment.
Finally, the chosen segment is integrated using time-frequency cross-fading to eliminate audible artifacts like clicks or phase discontinuities.
3. Results and Discussion
The method was evaluated on 16 tracks across pop, rock, jazz, and classical genres. In psychoacoustic tests with 15 participants, the algorithm successfully "fooled" listeners more than 60% of the time, meaning subjects often could not distinguish the inpainted version from the original. Even when repairs were detected, they were generally rated as "not disturbing" due to the preservation of musical context.
Computationally, the method is highly efficient, processing one minute of audio in approximately 2.47 seconds on standard hardware. While effective for repetitive music, the approach's reliance on self-similarity means it may struggle with non-repetitive or avant-garde compositions. Future work will focus on automated gap detection and incorporating more advanced psychoacoustic models to further refine similarity measures.
Summary updated