Engineering Decisions & Reliability Matrix
Architectural rationale, verified test suites, jitter benchmarks, and production technology matrix powering Shiddat.
Decisions behind the experience.
Every layer in Shiddat was deliberately chosen to solve a concrete engineering problem — prioritizing deterministic playback, cellular efficiency, and real-world audio fidelity.
Why server-time anchors?
Broadcasting 'play now' creates audible drift across heterogeneous mobile networks.
If a server commands five phones to 'play now', a packet arriving 40ms late on Wi-Fi and 300ms late on mobile data causes them to start a quarter-second apart. Re-sending packets only compounds drift. By transmitting a fixed position anchored to an authoritative server timestamp, every device calculates playhead = positionMs + (serverNow - anchorMs) locally and converges autonomously.
Why separate queue state?
Queue mutations are low-frequency events that must not bloat recurring heartbeats.
Playback position and active playback state must be refreshed frequently (every 5 seconds) to heal packet drops and clock drift. However, playlist queues can contain hundreds of tracks. Sending the entire track array with every heartbeat would consume substantial cellular data. Decoupling queue state into delta mutations (Append, Remove, Move) preserves network bandwidth.
Why WebSockets over HTTP polling?
Real-time party sessions require continuous sub-50ms bidirectional interactivity.
HTTP polling introduces connection handshake overheads, HTTP header tax, and unpredictable polling latency. A single persistent WebSocket connection per device enables instantaneous host command dispatch (seek, pause, skip) and deterministic NTP-style ping/pong round-trip time sampling.
Why Android Media3 / ExoPlayer?
First-class integration with Android OS media sessions and hardware audio sinks.
Media3 provides seamless background audio execution within a proper foreground service, lockscreen transport controls, Android Auto compatibility, and hardware volume key interception. Its customizable AudioSink architecture enables zero-gap crossfades and 32-bit floating-point DSP chaining directly before DAC output.
Why native C++ for audio analysis?
Intensive Fourier transforms require deterministic memory and SIMD vectorization.
Computing Short-Time Fourier Transforms (STFT), 128-band Mel spectrograms, and autocorrelation tempo detection across thousands of PCM audio frames generates intense heap allocation pressure in the JVM. Compiling optimized C++ algorithms via CMake and NDK executes within pre-allocated scratch buffers with ARM NEON SIMD vectorization without triggering garbage collection pauses.
Built to survive real playback.
Music playback apps fail under real conditions: phones enter battery doze mode, Bluetooth headphones disconnect, and cell towers drop WebSocket frames. Shiddat is backed by 84+ verified test suites and 30 formal cross-device acceptance specifications.
PrecisionAudioSinkTest.kt
Media3 DirectTrack audio sink zero-underrun verification
FloatDspChainTest.kt
32-bit float equalizer bands, pre-amp clamping, and dynamic leveling
party_test.go
Time-anchor drift calculations, monotonic clock assertions, and member token auth
LocalJamHostServerTest.kt
Local room creation, client join handshake, and heartbeat state reassertion
PartyQueueMoveTest.kt
Deterministic resolution of concurrent queue delta operations across devices
QueueShuffleTierTest.kt
Pseudo-random seed preservation across session restarts and handoffs
OfflineDashTest.kt
Segmented media caching, atomic file writes, and corrupted stream recovery
DownloadSessionTest.kt
Network state transitions (cellular vs Wi-Fi) and automatic download throttling
CD-001 Zero Autoplay
Opening second device displays remote status without triggering audio playback
CD-002 Play Here Handoff
Atomic lease transfer preserves playhead within 150ms drift tolerance
CD-008 Buffering Rollback
8-second target buffer failure coordinator rolls back lease to source device
WordSyncTest.kt
Sub-millisecond syllable interpolation and LRC time offset bounds checking
Representative Production Stress Scenarios
Zero Inverted State GuaranteesRenderer receives and acknowledges pause state without rewinding playback buffer.
Multiple users reordering songs concurrently resolve deterministically against central epoch.
Wi-Fi to LTE drop recovers via 45-second socket grace period without kicking user from party.
Host OS NTP clock stepping does not perturb playback anchor or cause audio stutter.
An engineered stack from metal to UI.
Every technology in Shiddat was picked for reliability, determinism, and performance. No superficial wrapper frameworks — true native code at every tier.