Skip to content

Deliver spoken pairing-code digits as server-supplied audio pack - #173

Merged
arturpragacz merged 4 commits into
mainfrom
ap/dynamic-pin-server-sound-pack
Aug 28, 2026
Merged

arturpragacz merged 4 commits into
mainfrom
ap/dynamic-pin-server-sound-pack

Conversation

@arturpragacz

Copy link
Copy Markdown
Contributor

Deliver spoken pairing-code digits as server-supplied audio pack.

Speaker clients no longer need bundled voice assets. In the dynamic audio pairing flow the server supplies a pack of ten short clips, one per digit, in a language of its choosing, and the client plays them in pairing code order.

  • Client advertises digit_audio in its dynamic_pairing_code descriptor: accepted formats (codec, sample rate, bit depth) and max_bytes.
  • Server picks the format, announces it as digit_audio in the pairing server/activate.
  • New binary message type 2: one clip per message, ten in ascending order. Clips are mono, at most 2 seconds each.
  • languages moves from the pairing activation to server/hello as a general operator-language hint.

Needs #172 merged first.

Comment thread messaging.md Resolved
Comment thread pairing.md Resolved
Comment thread messaging.md Resolved
Comment thread pairing.md Resolved
Base automatically changed from ap/fragmentation-single-id to main August 26, 2026 18:53
@arturpragacz
arturpragacz force-pushed the ap/dynamic-pin-server-sound-pack branch from e09ad87 to 00c498f Compare August 26, 2026 18:53
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread messaging.md Resolved
Comment thread pairing.md
- `codec`: 'opus' | 'flac' | 'pcm' - codec identifier
- `sample_rate`: integer - sample rate in Hz (e.g., 16000)
- `bit_depth`: integer - bit depth (e.g., 16); meaningful for `pcm` and `flac` only, ignored for `opus`
- `max_bytes`: integer - maximum total encoded size of the ten clips in bytes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: Should we give a minimum size to not land in the situation that some clients can't be paired with some servers/languages?

@arturpragacz arturpragacz Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that wouldn't be a bad idea.

@kahrendt What do you think we could put here? Would something like 32 KiB be reasonable?

It would be easier to make this decision if we first had recordings for a bunch of languages that we want to support.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32 KiB is very restrictive for PCM. That's only 1 second at 16 kHz mono audio at 16 bits per sample. I would imagine most clients would just use their output format sample rate; i.e., 48 kHz, and that is only 0.33 seconds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but should be enough for Opus probably?

Otherwise we would have to mandate it based on the supported codecs, so that gets a little more complicated.

I'm leaning towards just leaving it out for now. We can reevaluate once we have the recordings.

@maximmaxim345 maximmaxim345 Aug 28, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of supporting multiple formats for audio packs?
The server in either way will have to support any samplerate/bitdepth/codec (so you can actually pair it successfully).
That will also simplify the max_bytes recommendations in case we define different ones per codec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the digit audio format negotiation.

@arturpragacz
arturpragacz marked this pull request as ready for review August 28, 2026 13:11

@maximmaxim345 maximmaxim345 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good now.

@arturpragacz can you create a issue (and add it to the project board) so we don't forget to add max_bytes recommendations/requirements?

@arturpragacz
arturpragacz merged commit 36daa86 into main Aug 28, 2026
1 check passed
@arturpragacz
arturpragacz deleted the ap/dynamic-pin-server-sound-pack branch August 28, 2026 14:47
@arturpragacz

Copy link
Copy Markdown
Contributor Author

I added it here: Sendspin/backlog#41.

maximmaxim345 added a commit that referenced this pull request Sep 10, 2026
Removes the digit audio pack that #173 introduced. During initial
pairing the pack came from an unauthenticated peer, which thereby chose
what the client's speaker played and drove the client's audio decoders
before any trust was established. Speaking clients return to their own
bundled voice, choosing the language against the server's `languages`
hint in `server/hello` under RFC 4647 Lookup matching, as before #173.

Hand revert rather than `git revert`: #179, #194 and #237 have since
rewritten the surrounding text, and the `languages` move from
`server/activate` to `server/hello` in #173 stays, since
`client/pair-pending`'s `message` field relies on it.

Changes, all in `messaging.md` and `pairing.md` with `README.md`
regenerated:

- Binary message ID `2` returns to the reserved `2-3` range.
- `server/activate` `pairing.format?` no longer conditions `digits` on
fitting a pack.
- Sequence diagram, Digits emission, Protocol Errors, the
`dynamic_pairing_code` descriptor (`digit_audio` removed; `out_channels`
unchanged), the Messages intro, `client/pair-init` and
`server/pair-init` lose their pack references.
- The `Server → Client: Digit Audio Clip (Binary)` section is removed.

Closes #203

---------

Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
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.

3 participants