Traditional Chinese festival village background
AI & TV Engineering

Pandivo TV

Next-Gen AI-Powered Music & Continuous AI DJ Experience for Amazon Fire TV & Android TV

Pandivo TV

The Challenge

Living room television environments present unique engineering constraints: TV remotes suffer from low-gain Bluetooth microphones and 800ms-2500ms cloud STT lag; standard Whisper models produce phantom silence hallucinations on ambient noise; and complex 10-foot D-pad navigation easily suffers from focus traps and frame drops on low-power TV chipsets.

Engineering Solution

Engineered a native C++ JNI on-device speech engine (Whistle AI, ~16.9 MB) equipped with an 80Hz high-pass filter, energy-based VAD silence trimming, and peak AGC (0.85). Coupled with an autonomous Continuous AI DJ powered by AWS Bedrock (Nova Lite) and Gemini, a plug-and-play USB OTG music player, and local SQLite WAL storage synchronized non-blockingly to Amazon DynamoDB.

Key Product Capabilities

01

Continuous AI DJ & Smart Curation: Multi-stage pipeline powered by AWS Bedrock (Nova Lite) extracting mood, energy curves, and harmonic BPM transitions with dynamic radio-host commentary.

02

100% Offline Speech-to-Text: ~120ms Time to First Token with zero cloud latency and zero network dependencies via native C++ JNI Whistle engine (~16.9MB acoustic model).

03

Plug-and-Play USB Audio Player: Automatic OTG detection for USB thumb drives with offline ID3 metadata extraction for MP3, FLAC, WAV, and AAC.

04

Sub-Millisecond Hybrid Storage: Local SQLite in WAL mode ensures 60 FPS cold boots, mirrored asynchronously to Amazon DynamoDB cloud sync.

05

Physical TV Verified at 60 FPS: Tested and validated on physical Fire OS hardware (FOS 14 3P TV) with real Fire TV remotes in Amazon Appstore Quality Central.

06

Open Source Contribution: Extracted and published the standalone npm package react-native-whistle-tv-offline for the global TV developer ecosystem.

Code Implementation

implementation_module.jsjavascript
// AudioPreprocessor.kt - Native DSP pipeline for living room TV remote microphones
package com.pandivo.whistle

class AudioPreprocessor {
    companion object {
        private const val HPF_ALPHA = 0.969f // 1-pole HPF (~80 Hz at 16kHz)
        private const val NOMINAL_PEAK = 0.85f
        private const val MAX_GAIN = 6.0f
        private const val RMS_SILENCE_THRESHOLD = 0.010f

        fun processAudio(rawPcm: ShortArray): PreprocessResult {
            var prevInput = 0f
            var prevOutput = 0f
            var peak = 0f
            var sumSquares = 0.0

            // 1. 80Hz High-Pass Filter: Eliminate DC bias & HVAC low rumble
            val filtered = FloatArray(rawPcm.size)
            for (i in rawPcm.indices) {
                val input = rawPcm[i] / 32768.0f
                val output = HPF_ALPHA * (prevOutput + input - prevInput)
                prevInput = input
                prevOutput = output
                filtered[i] = output

                val abs = Math.abs(output)
                if (abs > peak) peak = abs
                sumSquares += (output * output).toDouble()
            }

            // 2. Dual-Stage Silence Gating: Reject silence hallucinations
            val rms = Math.sqrt(sumSquares / rawPcm.size).toFloat()
            if (rms < RMS_SILENCE_THRESHOLD && peak < 0.05f) {
                return PreprocessResult(isSilent = true, audio = floatArrayOf())
            }

            // 3. Peak Automatic Gain Control (AGC) for distant TV remote mics
            val gain = if (peak > 0.001f) Math.min(NOMINAL_PEAK / peak, MAX_GAIN) else 1.0f
            for (i in filtered.indices) {
                filtered[i] = Math.max(-1.0f, Math.min(1.0f, filtered[i] * gain))
            }

            return PreprocessResult(isSilent = false, audio = filtered)
        }
    }

Technologies Used

React Native TV 0.86AWS Bedrock (Nova Lite)Google Gemini 3.5 FlashWhistle AI (C++ NDK/JNI)Amazon DynamoDBSQLite (WAL Mode)Fire OS 7 & 8Android TV (API 24-34)

Architecture Stack

1React Native 10-Foot UI

60 FPS TV interface featuring spatial D-pad focus routing, zero focus traps, and interactive companion avatars.

2Whistle Native C++ DSP Engine

1-pole 80Hz high-pass filter, VAD silence trimming, automatic gain control, and RMS silence gating.

3AWS Bedrock & Gemini Cloud AI

Amazon Bedrock Nova Lite with Gemini 3.5 Flash fallback for vibe understanding and real-time DJ commentary.

4Hybrid SQLite WAL + DynamoDB

Local-first instant query engine synchronized asynchronously to DynamoDB cloud tables.