Skip to content

Add playback-speed compensation for audio queries - #241

Open
satpal123 wants to merge 1 commit into
AddictedCS:developfrom
satpal123:feature/pitch-compensated-query
Open

Add playback-speed compensation for audio queries#241
satpal123 wants to merge 1 commit into
AddictedCS:developfrom
satpal123:feature/pitch-compensated-query

Conversation

@satpal123

Copy link
Copy Markdown

Summary

  • add a fluent From(AudioSamples, sourcePlaybackSpeedPercentage) extension for regular audio queries
  • compensate known vinyl-style playback-speed changes before fingerprinting
  • preserve the source sample rate, origin, relative timestamp, and time offset
  • document the distinction between speed-plus-pitch changes and pitch-only/key-lock processing
  • add validation, resampling unit tests, and real-audio integration coverage for both +8% and -8%

Why

DJ and vinyl sources often change tempo and pitch together. That produces different fingerprints and can prevent a query from matching the original catalogue entry, as discussed in #217.

When the source playback-speed percentage is known, reciprocal resampling can restore the query close enough to its original playback rate before fingerprinting. This keeps the stored catalogue unchanged. If the percentage is unknown, callers may try a small set of likely values, with one complete fingerprint and storage query per value.

The API is provided as an extension instead of adding a member to IQuerySource, avoiding a source-breaking change for third-party implementations.

Impact

  • default query behaviour is unchanged
  • no stored fingerprint, model-service, or wire-format changes
  • applies to vinyl-style speed changes where tempo and pitch move together
  • does not compensate pitch-only processing such as key lock

Validation

  • dotnet test src\SoundFingerprinting.Tests\SoundFingerprinting.Tests.csproj --no-restore --filter "FullyQualifiedName~SoundFingerprinting.Tests.Unit.Audio|FullyQualifiedName~PlaybackSpeedQueryTest|FullyQualifiedName~QueryCommandBuilderTest" — 79 passed
  • dotnet build src\SoundFingerprinting\SoundFingerprinting.csproj --configuration Release --no-restore — succeeded

@satpal123
satpal123 marked this pull request as ready for review August 1, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant