TECHNICAL SYNTHESIS / MUSIC INFORMATION RETRIEVAL
When two songs
sound alike.
Synthesis, timing, pitch and the measurable distance between musical passages
Klyff Harlley Toledo · January 2018 · Updated October 24, 2026
A literature-based study with original synthetic audio and reproducible illustrations. Similarity measurements support investigation; they are not percentages of plagiarism.
Abstract
Can two musical passages remain recognizably related after changes in voice, instrument, pitch and playback speed? This technical synthesis proposes an auditable comparison protocol that separates the recorded performance, musical composition and lyrics. We model synthesis explicitly, preserve the original signals, estimate tuning and tempo differences, and align normalized pitch-class sequences using Euclidean distance and local dynamic time warping. A reproducible synthetic example links corresponding time regions with matching colors and reports feature proximity, temporal coverage and transformation parameters separately. Waveforms, spectrograms, histograms and a cross-distance matrix expose what the metric captures—and what it discards. We do not estimate a percentage of plagiarism, infer authorship or classify legal parody from acoustics. The resulting evidence package supports listening, musicological analysis and contextual review rather than replacing them.
Keywords: sound synthesis; musical similarity; chroma; Euclidean distance; time stretching; pitch shift; DTW; lyrics alignment; parody; evidence provenance.
1. Similarity is evidence with a defined object
My first question is not “how much plagiarism?” It is “which representation of which passage is close to which other passage, under which transformations?” Matching a recorded waveform, recognizing a transposed melody, and finding repeated words are different tasks. A single aggregate number can obscure their disagreement.
The U.S. Copyright Office distinguishes the musical composition, including accompanying lyrics, from the particular sound recording. That distinction is useful for organizing evidence even before considering jurisdiction: a new performance may resemble a composition while sharing no recorded samples. Conversely, a short reused recording may be buried under a substantially different arrangement. [1]
| Channel | What to compare | Main failure mode |
|---|---|---|
| Recording | Local spectral landmarks, waveform correlation after alignment, production artifacts | A re-performance changes the waveform; an identical licensed sample still matches |
| Composition | Pitch intervals, melody contour, note durations, harmony and phrase ordering | Common scales, cadences and chord loops produce incidental matches |
| Lyrics | Time-aligned words, phrase order, rhyme and phonetic patterns | ASR errors, generic phrases, translation and coincidental vocabulary |
| Context | Provenance, dates, permissions, sources, purpose and musical significance | No acoustic distance can recover all of these facts |
“Region” means a time interval in A mapped to an interval in B, not a geographic origin. Report seconds and, when available, bars and beats. Describe a relation between the recordings; do not imply that the time direction establishes who copied whom.
2. What synthesis changes—and what normalization must preserve
A simplified additive synthesizer represents a pitched note as a sum of harmonics under a time-varying envelope. Frequency trajectories encode pitch, harmonic amplitudes shape timbre, and envelopes shape attack and release. A voice adds formants, articulation, consonants, breath and expressive pitch movement; a real mixed recording also includes percussion, reverberation and mastering.
Changing the harmonic weights can make the same notes sound unlike one another without changing the intended melody. Changing a singer may alter spectral shape more strongly than changing a melody. This motivates multiple representations rather than raw sample-by-sample subtraction.
Equalization is not tempo correction. EQ changes the balance of frequency bands. Time stretching changes duration while attempting to preserve pitch; pitch shifting changes pitch while attempting to preserve duration. Simple resampling couples pitch and duration. Librosa exposes separate time-stretch and pitch-shift operations; its documented time-stretch implementation uses a phase vocoder. These operations can create artifacts and must be logged. [2]
Keep original files immutable. Produce analysis copies with a declared sample rate and channel treatment; retain stereo when spatial production matters. Avoid peak-normalizing silence, clipped files or nearly silent frames. Check clipping, DC offset and channel cancellation before any feature extraction. Loudness adjustment is a documented analysis choice, not a way to erase differences.
Estimate three quantities separately: global transposition in semitones, fine tuning in cents, and local timing. A semitone shift is not the same as a singer’s intonation drift. For comparison of continuous pitch tracks, use a cents scale; for coarse tonal structure, use pitch classes. Preserve octave and interval information in a parallel melody channel, because chroma intentionally folds octaves together.
α = duration(B matched region) / duration(A matched region)
If α = 1.25, the B passage lasts 25% longer; its relative tempo is 1/α = 0.8. Calling it “25% slower” confuses duration and tempo conventions. For polyphonic music, one dominant pitch tracker cannot reliably represent every simultaneous voice. A production implementation should compare full-mix features with separated vocal/harmonic estimates, retain their disagreement and audit separation artifacts.
3. Euclidean distance after alignment
The AudioLabs synchronization example uses L2-normalized chroma vectors, Euclidean local costs and dynamic programming to align different musical representations. Its methodological point is the tradeoff between robustness to irrelevant variation and retention of distinctive musical information. [3]
For our proposed protocol, let cᴀ(i) and cʙ(j) be nonnegative 12-component chroma vectors. Exclude frames below an energy threshold; dividing a silent frame by a tiny constant does not make it informative. Normalize each retained frame to unit L2 length. Search cyclic pitch-class shifts k only when the question permits transposition, and retain the best uncorrected result as a comparison.
Cₖ(i,j) = ‖xᵢ − roll(yⱼ, k)‖₂
For nonnegative unit vectors: 0 ≤ Cₖ ≤ √2
Cₖ² = 2 − 2 xᵢᵀ roll(yⱼ,k)
A distance near zero means close pitch-class profiles under this representation. It does not mean identical notes, production or words. If features contain signed values, the √2 upper bound no longer generally applies; two arbitrary unit vectors can be distance 2 apart. If feature groups have different units, normalize or whiten them using training-set statistics before a weighted combination. Never concatenate seconds, hertz, chroma and language embeddings and call the unscaled Euclidean norm meaningful.
Unaligned time coordinates make even genuine repeats look distant. Local or subsequence matching should search plausible start and end regions; DTW then permits nonuniform timing inside a candidate. AudioLabs discusses subsequence matching and chroma-axis shifting for transposition-tolerant retrieval. [4]
d̄(P) = (Σ_(i,j)∈P C(i,j)) / |P|
S_feature(P) = 100 × max(0, 1 − d̄(P)/√2)
The recurrence above is the basic unconstrained form. A deployable search also needs boundaries, allowed steps, minimum duration, slope constraints and run-length limits. Otherwise it can stretch an unrelated sustained chord across a whole phrase. The minimum-total-cost path is not necessarily the minimum-average-cost path; disclose the objective used to select the path, then report its normalized cost. Our demo minimizes the sum and reports the mean afterward.
The percentage S is a deliberately transparent display transform of a feature distance, not a calibrated probability. “78%” here means 78 points on this particular chroma-proximity scale. It does not mean 78% of the music was copied, 78% probability of infringement, or 78% shared authorship. A percentage of matched duration is yet another measurement, with a different denominator.
coverage(B) = length(union of accepted B intervals) / duration(B)
Count overlapping regions once. Report the pair of coverages rather than averaging them away. Preserve offsets, path coordinates, pitch correction, tempo ratio, feature configuration and the threshold used to accept the candidate.
4. A controlled experiment you can inspect
We synthesize an original 12-second, 24-note sequence A at 8 kHz. B contains two deliberately inserted phrases, unrelated interludes and different harmonic weights. The first four seconds of A appear at 2–7 seconds in B; the last four seconds appear at 9–12.333 seconds in B. Both inserted phrases are transposed up three semitones before synthesis. We compensate by shifting B’s chroma down three classes.
Scope of the experiment: the inserted windows and transposition are known from construction. We run DTW inside those windows. This verifies measurement and visualization, not autonomous detection, blind key estimation, vocal transcription or real-world plagiarism accuracy. There are no commercial songs, human vocal samples or copied lyrics in these files.
Listen before reading the score. Audio plays only when you press Play. Both players remain in their original tuning; the analysis correction is applied to features.

| Region | A seconds → B seconds | Duration ratio α | Mean Euclidean distance | Feature proximity |
|---|---|---|---|---|
| R1 | 0.000–4.000 → 2.000–7.000 | 1.2500 | 0.3102 | 78.1% |
| R2 | 8.000–12.000 → 9.000–12.333 | 0.8333 | 0.2921 | 79.3% |
Select a region to position both players at its start and inspect its measurement. Press each player’s Play control to listen.


The analysis window is 4,096 samples (512 ms), with a 200-sample hop (25 ms), Hann-window STFT, magnitude accumulation into nearest pitch classes over 100–1,800 Hz, and L2 normalization. Frames within 200 ms of the known region boundaries are excluded from local matching. The long window can blend adjacent notes; therefore the 25 ms hop does not imply 25 ms boundary accuracy. This intentionally simple front end is not a substitute for a validated CQT/chroma pipeline on full-band recordings.
R1 has a duration ratio of 1.25; R2 has a ratio of 0.8333. Their different proximity scores reflect representation and synthesis artifacts even though both relationships were deliberately constructed. The union of inserted windows covers 66.7% of A and approximately 58.1% of B. Those are construction coverages, not algorithmically estimated infringement shares.
5. Lyrics, musical borrowing and parody need separate analyses
For sung fragments, first obtain a time-aligned transcript, preferably reviewed against the audio. Retain alternate ASR hypotheses, word confidence, language and uncertainty from overlapping voices. Compare phrase-level token sequences with edit distance or local sequence alignment, then inspect phonetic similarity, rhyme and stressed-syllable timing separately. Preserve meaningful negations and names; aggressive text normalization can manufacture agreement.
This is a possible token-edit proximity score for a specified pair of sequences, not a likelihood of copying. Exact phrases and semantic paraphrases should be reported as distinct evidence. Repeated everyday expressions have low discriminatory value; an unusual ordered phrase carries different information. Translation may preserve meaning while changing words and phonetics. A generative model’s statement that two lines “feel alike” should not be used as a measured alignment.
| Observed pattern | Candidate explanation | Required next inspection |
|---|---|---|
| Melody close; recording distant; lyrics changed | New performance, adaptation, parody, common motif or other borrowing | Listen to phrase structure; inspect expressive details and context |
| Recording landmarks match; melody/lyrics only partly shared | Sample reuse, common licensed material or remix | Locate exact recorded event; check provenance and permissions |
| Lyrics close; melody distant | Text reuse, quotation, a new setting, or generic wording | Review distinctive wording and the complete text |
| Chroma close; melody intervals and lyrics disagree | Common harmony or representation collision | Reject a strong equivalence claim unless additional evidence supports it |
Parody is not an acoustic class. An intentional parody may preserve a recognizable tune while changing its words or purpose. That does not make a classifier capable of deciding its legal status. In Brazil, Article 47 of Law 9,610 addresses paraphrases and parodies with conditions concerning reproduction and discredit. In the United States, the Copyright Office describes fair use as a contextual, case-specific inquiry and explicitly rejects a universal permitted-percentage formula. These are distinct legal frameworks, not interchangeable numeric thresholds. [5] [6]
The proposed output therefore says “parody asserted; requires contextual review,” not “parody detected: 92%.” The same restraint applies to plagiarism. Technical localization can identify where a listener should investigate; it cannot by itself establish access to the source, copying direction, protectability, authorization, intention or a judicial conclusion.
6. From a demonstration to a defensible evaluation
A serious evaluation requires held-out recordings and annotation. Construct positive pairs with known transformations, plus hard negatives that share genre, key, tempo, chord loops, drum patterns or common samples. Include reordered phrases, same lyrics/new melody, same melody/new words, independent covers, remixes, and unrelated performances. Split by underlying composition and artist where possible, so versions of one work cannot leak between training and evaluation.
Sweep pitch shifts, fine tuning, tempo ratios, local rubato, instrumental changes, reverberation, compression, background noise, partial excerpts and overlapping voices. Measure region-level precision/recall, intersection-over-union, boundary error and retrieval ranking; publish false-positive rates at the selected operating point. Estimate uncertainty by resampling independent works or passages, not adjacent correlated audio frames. A high score discovered after searching millions of pairs needs a different false-match analysis from a preselected pair.
Report sensitivity to feature choices and to the key/tempo search range. Optimizing over more transformations increases the chance of accidental proximity. Learn thresholds from held-out labels and distinguish a calibrated task probability from the descriptive score defined here. Do not average chroma, lyric and fingerprint scores with arbitrary weights and label the result “plagiarism probability.”
The minimum review packet should include source-file hashes; duration and decoding metadata; original and analysis-copy links; feature settings; transformation search ranges; candidate intervals; DTW paths; distance distributions; channel-specific scores; coverage denominators; known failure modes; and the reviewer’s listening notes. If the system cannot distinguish silence, generic patterns or ambiguous alignment, abstention is a useful result.
Conclusion
I would use this method to make a suspected resemblance inspectable: these seconds map to those seconds, under these corrections, with this distance in this feature space. The colored rectangles organize the evidence. The percentages summarize declared measurements. Whether the resemblance represents a shared convention, a licensed use, a new performance, parody or unlawful copying requires additional musical and contextual analysis.
Reproduce and audit
All demonstration sounds and figures were generated for this article. No arbitrary-audio upload or automatic plagiarism detector is implemented on this page. The supplied script creates the audio, computes the two local alignments and regenerates all three figures.
python tools/research/music_similarity.py
References and credits
- U.S. Copyright Office. Musical Compositions and Sound Recordings.
- Librosa documentation. Effects: time_stretch and pitch_shift.
- Müller, M. and the FMP contributors. Music Synchronization. AudioLabs FMP notebooks.
- Müller, M. and the FMP contributors. Audio Matching. Includes discussion of chroma and subsequence matching.
- Presidência da República, Brazil. Lei 9.610/1998, Article 47.
- U.S. Copyright Office. Fair Use Index.
Sources checked October 24, 2026. Original synthesis, illustrative score, equations, code and figures prepared for this note with AI assistance. This is a technical synthesis and proposed evaluation protocol, not a peer-reviewed experimental result or a legal opinion about any song.