Skip to content

[SDK gap] No shared canonical PCM / conformance helper — every language reimplements the same hash #40

@balloob

Description

@balloob

Problem

Conformance compares audio by hashing samples in a canonical float32 representation. Every adapter reimplements the same conversion:

  • Python: src/conformance/pcm.py FloatPcmHasher
  • Rust: adapters/sendspin-rs/client/src/main.rs:85-133 FloatPcmHasher
  • Swift: adapters/SendspinKit/client/Sources/ConformanceSendspinKitClient/main.swift:~152-231
  • C++: adapters/sendspin-cpp/client/main.cpp (openssl SHA-256 + manual normalization)
  • Go: server-side hashing lives in adapters/sendspin-go/internal/conformance/common.go

Each reimplementation is a place for subtle divergence (bit-depth normalization, 24-bit packed sample handling, endianness, sample ordering). It's also a symptom: SDKs expose raw bytes and leave "make these comparable across languages" to the harness authors.

Why this matters

  • When a client fails PCM comparison, bisecting "is this a real playback bug or a hasher bug?" is hard when every language ships its own hasher.
  • If the SDK shipped a canonical-samples iterator (or even a hash helper), adapters would stop needing this file.

Proposed SDK additions

Either:

  1. A per-SDK canonical_samples(iter_of_bytes, bit_depth) -> iter_of_f32 helper (language-idiomatic) that matches the harness's Python reference byte-for-byte.
  2. Or a shared protocol-side helper module (the time-filter repo precedent is cited in the spec itself) that every SDK can pull in.

Update all language adapters to use the helper instead of their hand-rolled hasher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions