Google AI Edge Gallery 中的设备端语音识别与语音合成
原题On-Device Speech Recognition and Text-to-Speech in Google AI Edge Gallery
读前速览
Google 宣布在 Google AI Edge Gallery 中推出设备端自动语音识别(ASR)和文本转语音(TTS)功能,通过 Android 版 ML Kit 以及面向跨平台应用的 MediaPipe Tasks/LiteRT,实现离线语音交互、流式转录和低延迟语音合成。
设备端 ASR 和 TTS 支持离线语音交互
这些新功能让开发者能够构建支持流式实时转录和自然语音回复的应用,且完全离线运行,从而解决手机和可穿戴设备面临的网络连接限制。
ML Kit 为 Android 提供高性能语音模型
ML Kit 由 Google 最新的设备端语音模型驱动,可支持 100+ 种语言的多语言转录,速度达到实时的 10 倍,在 FLEURS 上的 WER 为 8.0-9.0%;TTS 约 100ms 即可开始播放,合成速度达到实时的 50 倍。
MediaPipe Tasks 和 LiteRT 支持跨平台语音功能
针对 iOS、macOS、Windows、Linux 和 Web,MediaPipe Tasks 提供开箱即用的 ASR 和 TTS API,并支持 Parakeet-TDT 0.6B 和 PocketTTS 100M 等开放权重模型。模型打包为 .litertlm 格式,便于部署。
与设备端 SLM 集成,支持多模态语音应用
轻量语音模型可与 Gemini Nano 和 Gemma 4 配合,构建 XR Language Teacher 等应用。该应用可进行实时视觉定位和流式语音输入,为用户提供实时语言辅导,并支持双语 TTS 语码切换。
完整摘要
Google 在 Google AI Edge Gallery 中推出设备端 ASR 和 TTS 功能,让开发者能够为移动端和跨平台应用构建离线语音界面。此次发布包含 ML Kit 的 Android 系统语音模型,支持 100+ 种语言的转录,速度可达实时的 10 倍;基于扩散模型的 TTS 合成速度则可达实时的 50 倍。跨平台支持通过 MediaPipe Tasks 和 LiteRT 提供,涵盖 Parakeet-TDT 0.6B 等开放权重 ASR 模型,以及 PocketTTS 100M 等 TTS 模型。这些轻量模型可与 Gemini Nano、Gemma 4 等设备端小语言模型(SLM)无缝集成,支持 XR Language Teacher 展示应用中的实时视觉定位和双语 TTS 语码切换,以及支持语音交互的 AI Chat 和与句子同步的语音播放。
目录 · 11 节
今天,我们在 Google AI Edge Gallery 中推出端侧自动语音识别(ASR)和文本转语音(TTS)功能。语音往往是人们在手机和可穿戴设备上与 AI 交互最自然的方式。紧凑型语音架构的最新进展,使得准确的多语言 ASR 和富有表现力的 TTS 模型能够完全在设备端运行,同时占用少量内存、延迟低,并且完全离线。将这些轻量级语音模型与 Gemini Nano 和 Gemma 4 等端侧小语言模型(SLM)结合后,开发者便能构建这样的应用:用户说话时实时生成转录文本,并在本地合成自然流畅的语音回复。Today, we are introducing on-device Automatic Speech Recognition (ASR) and Text-to-Speech (TTS) capabilities in Google AI Edge Gallery. Voice is often the most natural way to interact with AI on phones and wearables. Recent advances in compact speech architectures now make it possible to run accurate, multilingual ASR and expressive TTS models entirely on device, all within a small memory footprint, with low latency, and completely offline. By pairing these lightweight speech models with on-device small language models (SLMs) like Gemini Nano and Gemma 4, developers can build apps that stream live transcriptions as the user speaks and synthesize natural spoken replies locally.
此次发布汇集了 Google 系统语音模型和开放权重生态系统的多项重大进展:This release brings together major advancements across both Google’s system speech models and the open-weight ecosystem:
- Android:借助 ML Kit 实现更快速、更准确的系统语音模型:ML Kit 由 Google 最新的设备端语音模型提供支持,可在 100 多种语言中实现极高准确度的转录,速度达到实时速度的 10 倍。它还配备了一个少步扩散式 TTS 模型,仅约 100 毫秒即可开始播报,并能以最高 50 倍实时速度合成 24 kHz 音频。这两种模型都已集成到操作系统中,不会增加 APK 的大小。Android: faster, more accurate system speech models with ML Kit: Powered by Google’s latest on-device speech models, ML Kit delivers incredibly accurate multilingual transcription across 100+ languages at 10x real-time speed. It is paired with a few-step diffusion TTS model that begins speaking in just ~100 ms and synthesizes 24 kHz audio at up to 50x real-time speed. Both models are integrated into the OS, adding 0 MB to your APK.
- Web、桌面及更多平台:借助 MediaPipe Tasks 和 LiteRT 实现跨平台开放权重语音功能:针对跨平台应用,我们优化了新型 .litertlm 模型语音包,包括 Parakeet-TDT 0.6B、PocketTTS 100M、Kokoro-82M 和 Phonon 31M。它们以内存占用小为特点,可实现实时流式转录和低延迟语音合成,并能与设备端 SLM 顺畅协同运行,不会争抢计算资源。Web, Desktop and Beyond: cross-platform, open-weight speech with MediaPipe Tasks and LiteRT: For cross-platform apps, we optimized new .litertlm model speech bundles, including Parakeet-TDT 0.6B, PocketTTS 100M, Kokoro-82M, and Phonon 31M. They deliver real-time streaming transcription and low-latency speech synthesis in a compact memory footprint, and run smoothly alongside on-device SLMs without compute contention.
下面,我们将探讨这套本地语音处理流程如何为全新的 XR(扩展现实)语言教师演示项目提供支持、如何升级 Google AI Edge Gallery 中的 AI Chat,以及你今天就能如何利用这些 API 和模型进行开发。Below, we’ll explore how this local voice pipeline powers the new XR (Extended Reality) Language Teacher showcase, upgrades AI Chat in Google AI Edge Gallery, and how you can build with these APIs and models today.
使用 XR Language Teacher 进行多模态语音辅导Multimodal voice tutoring with XR Language Teacher
旅行途中学习语言是在真实世界中发生的,地点往往是地下车站、热闹的集市,或是 Wi-Fi 和漫游数据可能无法使用的海外地区。为了展示视觉、语言和语音模型如何在手机上完全本地运行、无需网络连接,我们在 Google AI Edge Gallery 中打造了 XR Language Teacher 展示项目。只需将摄像头对准陌生物品或菜单,问一句“那是什么?我该怎么点一份?”,你就能立即听到用自己的语言讲解的内容,以及地道的当地语言发音。Learning a language while traveling happens in the real world, often in underground stations, busy markets, or abroad where Wi-Fi and roaming data may not be available. To show how vision, language, and speech models can work together 100% locally on your phone with no network connection needed, we built the XR Language Teacher showcase in Google AI Edge Gallery. Simply point your camera at an unfamiliar object or menu, ask "What is that, and how do I ask for one?", and immediately hear an explanation in your language alongside authentic pronunciation in the local language.
YouTube 视频链接(仅在禁用 JS 时可见)Link to Youtube Video (visible only when JS is disabled)
完全在设备端进行视觉识别、语音交互和学习Seeing, speaking, and learning entirely on device
- 实时视觉定位与流式语音输入:将摄像头对准路牌、菜单或物体,然后大声提出问题。设备端 ASR 会将你说出的问题与摄像头画面同步实时传送给 Android 设备上的 Gemini Nano,或其他平台上的 Gemma 4,一次完成处理。Live visual grounding and streaming voice input: Point your camera at a street sign, menu, or object and ask a question aloud. On-device ASR streams your spoken question in real time alongside the camera frame to Gemini Nano on Android devices —or Gemma 4 across other platforms—in a single pass.
- 用于双语 TTS 语码转换的结构化输出:通过使用结构化输出模式,模型可以用你的母语讲解场景,同时单独标记外语短语,让 TTS 流程能够在句子中途无缝切换语音和口音,从母语切换到目标语言,并同步显示屏幕上的词汇卡片。Structured outputs for bilingual TTS code-switching: Using a structured output schema, the model explains the scene in your own language while tagging foreign-language phrases separately, allowing the TTS pipeline to seamlessly switch voices and accents mid-sentence from your mother tongue to the target language alongside an on-screen vocabulary card.
适配智能眼镜Adapt for intelligent eyewear
借助配对手机在本地运行推理,同样的体验既可在手机上独立使用,也能自然延伸至免手持智能眼镜。想了解我们如何为智能眼镜改造 Language Teacher,欢迎观看我们近期在 Android Dev Summit 上的演讲:《使用 Gemini Nano 为智能眼镜打造音频优先体验》。With inference running locally on a paired phone, the same experience works standalone on a phone and extends naturally to hands-free smart glasses. To see how we adapted Language Teacher for intelligent glasses check out our recent talk at Android Dev Summit: Building Audio-First Experiences for Intelligent Eyewear with Gemini Nano.
AI Chat 中的流式语音听写和朗读播放Streaming voice dictation and read-aloud playback in AI Chat
除了 XR Language Teacher 演示之外,我们还将 ASR 和 TTS 直接集成到 Google AI Edge Gallery 的主要 AI Chat 功能中,让 Gemini Nano 和 Gemma 4 等设备端小型语言模型(SLM)在外出时也能通过自然的离线语音界面进行交互。Beyond the XR Language Teacher showcase, we also built ASR and TTS directly into Google AI Edge Gallery’s main AI Chat feature, giving on-device SLMs like Gemini Nano and Gemma 4 a natural, offline voice interface while on the go.
YouTube 视频链接(仅在禁用 JavaScript 时可见)Link to Youtube Video (visible only when JS is disabled)
与句子同步的播放和可配置的语音设置Sentence-synchronized playback and configurable speech settings
- 模型管理中的 ASR 和 TTS 设置:在一个集中位置选择可用的 ASR 和 TTS 流水线、预设语音以及已下载的语言包。ASR and TTS settings in Model Management: Choose between available ASR and TTS pipelines, preset voices, and downloaded language packs in one central place.
- 朗读播放并实时高亮句子:开启“自动播放 TTS”,或点击任意回复上的扬声器按钮,即可启动悬浮式 TTS 控制栏,在朗读过程中实时高亮每个句子,还可通过点击任意句子直接跳转。Read-aloud playback with live sentence highlighting: Turn on “Auto-play TTS” or tap the speaker button on any response to launch a floating TTS bar that highlights each spoken sentence in real time, with the ability to jump to any sentence by tapping it.
- 聊天语音输出参考实现:我们的开源代码库演示了如何去除 Markdown 语法、跳过代码片段和表格等不适合朗读的内容块,并按句子级别调度语音合成,以避免在 LLM 生成 token 期间争抢计算和内存资源。Reference implementation for chat voice outputs: Our open-source codebase demonstrates how to strip Markdown syntax, skip non-spoken blocks like code snippets and tables, and schedule synthesis at the sentence level to avoid compute and memory contention during LLM token generation.
深入探究:使用 ML Kit、MediaPipe Tasks 和 LiteRT 构建应用Under the Hood: Building with ML Kit, MediaPipe Tasks, and LiteRT
虽然 Gemma 4 等多模态模型可以直接处理音频输入,但我们也提供了一种模块化方案,将语言模型与独立、轻量级的语音模型级联,以优化延迟并提升灵活性。根据目标设备和模型需求,我们在 GitHub 上提供的开源代码展示了针对 Android 使用 ML Kit 的优化推荐方案,以及借助 MediaPipe Tasks 和 LiteRT 实现跨平台支持并兼容开放模型的方案。While multimodal models like Gemma 4 can process audio inputs directly, we provide a modular solution for cascading language models with separate, lightweight voice models for latency optimization and flexibility. Depending on your target devices and model requirements, our open-source code on GitHub shows you the optimized and recommended solution for Android using ML Kit, as well as MediaPipe Tasks and LiteRT for cross-platform coverage and open model support.
面向搭载 ML Kit 的旗舰级 Android 设备进行构建Building for flagship Android with ML Kit
对于面向 Android 设备开发的开发者,ML Kit 的 GenAI 语音识别和文本转语音 API 提供了标准化、与平台集成的开箱即用方案。底层语音模型由 AICore 和 Google 的设备端语音服务管理,开发者无需管理模型下载,也不必担心 APK 体积膨胀,即可获得生产级品质。应用还可自动受益于 NPU 和 TPU 后端的硬件加速(如果可用),以及无缝的后台模型更新。For developers building for Android devices, ML Kit’s GenAI Speech Recognition and Text-to-Speech APIs provide a standardized, platform-integrated path out of the box. With the underlying speech models managed through AICore and Google’s on-device speech services, developers get production-grade quality without having to manage model downloads or worry about APK size bloat. Your app also benefits automatically from hardware acceleration across NPU and TPU backends (when available) and seamless background model updates.
- ML Kit GenAI 语音识别 API:在用户说话时流式输出实时的部分转录结果和最终转录文本,支持接收设备内置麦克风或智能眼镜等外部音频流输入。我们最新的端侧 ASR 技术进展,可实现对 100 多种语言极其准确的多语言识别(在 FLEURS 上的词错误率达到 8.0% 至 9.0%),转录速度比实时音频快 10 倍(每 3 秒语音约需 300 毫秒),并将端到端语音翻译等待时间缩短 35% 至 44%。ML Kit GenAI Speech Recognition API: Streams live partial and final transcriptions as the user speaks, accepting audio from either the built-in device microphone or external audio streams such as smart glasses. Our latest on-device ASR advancements deliver incredibly accurate multilingual recognition across 100+ languages (reaching 8.0% to 9.0% Word Error Rate on FLEURS) while transcribing speech 10x faster than the real time audio being transcribed (~300 ms per 3 seconds of speech) and cutting end-to-end speech translation wait times by 35% to 44%.
- ML Kit GenAI 文本转语音 API:这款设备端 TTS 由经过 NPU 加速的紧凑型少步扩散模型驱动,可在约 100 毫秒内开始朗读,并以最高实时速度的 50 倍,使用 8 种富有表现力的语音、覆盖 21 个地区生成自然的 24 kHz 语音。它仅需约 500 毫秒即可合成一段 27 秒的文字,与传统自回归 TTS 模型相比,设备活跃时的功耗降低了 50% 以上,并内置提示音支持。ML Kit GenAI Text-to-Speech API: Powered by a compact, few-step diffusion model accelerated on NPU, the on-device TTS begins speaking in ~100 ms and generates natural 24 kHz speech across 8 expressive voices and 21 locales at up to 50x real-time speed. It synthesizes a 27-second paragraph in just ~500 ms while cutting active device power by over 50% compared to traditional autoregressive TTS models, and includes built-in earcon support.
使用 MediaPipe Tasks 构建跨平台应用Building across platforms with MediaPipe Tasks
在跨平台应用中集成 ASR 和 TTS,通常需要处理底层音频分帧、语音活动检测(VAD)以及复杂的解码流程。MediaPipe Task 通过在 iOS、macOS、Windows、Linux 和 Web 平台上提供统一、开箱即用的 ASR 和 TTS API,简化了这一过程。这些 API 将手动预处理、音频流路由和特定于平台的音频管理抽象为简单的高级接口:Integrating ASR and TTS into cross-platform applications usually requires handling low-level audio framing, Voice Activity Detection (VAD), and complex decoding pipelines. MediaPipe Task simplifies this by providing unified, turnkey ASR and TTS APIs across iOS, macOS, Windows, Linux, and Web that abstract away manual pre-processing, audio stream routing, and platform-specific audio management into simple, high-level interfaces:
- MediaPipe 语音识别(ASR)任务:自动处理音频分帧、可配置的语音活动检测(VAD)和解码。它支持实时流式、完整句子批处理和混合转录模式(用户说话时实时输出词语,并在语音结束后优化完整句子),开箱即用地展示 Parakeet-TDT 0.6B 等开放权重模型。现在就可以直接在浏览器中试用!MediaPipe Speech Recognition (ASR) Task: Automatically handles audio framing, configurable Voice Activity Detection (VAD), and decoding. It supports real-time streaming, full-sentence batch, and hybrid transcription modes (streaming live words as the user speaks and refining the full sentence once speech ends), and showcases open-weight models like Parakeet-TDT 0.6B out of the box. Try it now directly in the browser!
- MediaPipe 文本转语音(TTS)任务:提供一套开箱即用的语音合成界面,支持语音选择和低延迟流式音频输出,并开箱即用地展示开放权重模型,包括 PocketTTS 100M 和 Kokoro-82M 等多语言模型,以及 Phonon 31M 等超轻量级英语模型;在大多数设备和平台上,其首次音频生成时间(TTFA)低于 100 毫秒。现在就直接在浏览器中试用!MediaPipe Text-to-Speech (TTS) Task: Provides a turnkey synthesis interface with voice selection and low-latency streaming audio output, showcasing open-weight models out of the box, including multilingual models like PocketTTS 100M and Kokoro-82M, as well as ultra-lightweight English models like Phonon 31M with sub-100ms Time-to-First-Audio (TTFA) on most devices and platforms. Try it now directly in the browser!
借助 LiteRT 为跨平台语音功能和灵活的模型支持提供动力Powering cross-platform speech and flexible model support with LiteRT
在底层,ML Kit 和 MediaPipe Tasks 由 LiteRT 提供支持。LiteRT 是 Google 高性能的设备端 AI 推理基础设施。对于需要更精细地控制语音处理或采用自定义模型架构的跨平台应用,也可以直接基于 LiteRT 构建。Under the hood, ML Kit and MediaPipe Tasks are powered by LiteRT, Google’s high-performance on-device AI inference infrastructure. Cross-platform applications requiring even more fine-grained control over speech processing or custom model architectures can also build on it directly.
语音模型通常依赖多个子图和辅助资源,例如 ASR 所用的编码器/解码器子图和分词器,或 TTS 所用的音素转换词典、语音嵌入和声码器。每个模型所需的所有组件都会打包到一个 .litertlm 文件中,便于部署。该应用内置了可直接使用的 .litertlm 模型,包括 Parakeet-TDT-0.6B-v3(多语言 ASR)、PocketTTS 100M(多语言 TTS)、Phonon 31M(超轻量级英语 TTS)和 Kokoro-82M(多语言 TTS)。除此之外,拥有超过 10K+ 关注者、活跃的 Hugging Face LiteRT 社区还提供了不断扩充的开放权重模型目录,例如用于 ASR 的 Whisper、Qwen3-ASR 和 Moonshine,以及用于 TTS 的 Qwen3-TTS 和 Matcha。对于希望自定义实现或支持其他开放权重语音模型的开发者,LiteRT 提供了丰富的多模态模型示例,助你快速入门,更多内容也将陆续推出。Speech models often rely on multiple subgraphs and auxiliary assets, such as encoder/decoder subgraphs and tokenizers for ASR, or phonemizer dictionaries, voice embeddings, and vocoders for TTS. All required components for each model are packaged into a single .litertlm file for easy deployment. The app ships with ready-to-use .litertlm models, including Parakeet-TDT-0.6B-v3 (multilingual ASR), PocketTTS 100M (multilingual TTS), Phonon 31M (ultra-lightweight English TTS), and Kokoro-82M (multilingual TTS). Beyond these, the vibrant Hugging Face LiteRT Community with over 10K+ followers offers a growing catalog of open-weight models, like Whisper, Qwen3-ASR and Moonshine for ASR, or Qwen3-TTS and Matcha for TTS. For developers seeking custom implementations or support for additional open-weight voice models, LiteRT provides a rich set of multimodal model examples to help you get started, with more on the way.
今天就开始使用Get started today
添加本地语音管线,让设备端小语言模型(SLM)突破基于打字的聊天界面,支持自然、语音优先的交互,并可在任何地方完全离线运行。如今,体验这些功能或将其集成到你自己的应用所需的所有组件都已就绪:Adding a local voice pipeline takes on-device SLMs beyond typing-based chat interfaces, enabling natural, voice-first interactions that work anywhere, completely offline. All the building blocks to try these experiences or integrate them into your own apps are available today:
- 体验全新的语音功能:在 Android 和 iOS 上下载最新版 Google AI Edge Gallery 应用,即可在自己的设备上试用 XR Language Teacher 和支持语音的 AI Chat。Experience the new voice features: Download the latest Google AI Edge Gallery app on Android and iOS to try XR Language Teacher and voice-enabled AI Chat on your own device.
- 探索并改造开源代码:查看 Google AI Edge Gallery GitHub 仓库中的参考实现,或者让你喜欢的编程代理(例如 Google Antigravity)查看我们的 GitHub 仓库,快速将流式 ASR、双语 TTS 代码切换和句子同步播放流程改造为适用于你自己应用的版本。Explore and adapt the open-source code: Check out the reference implementation in the Google AI Edge Gallery GitHub repository, or point your favorite coding agent, such as Google Antigravity, at our GitHub repo to quickly adapt the streaming ASR, bilingual TTS code-switching, and sentence-synchronized playback pipeline for your own app.
- 开始使用 ML Kit、MediaPipe Tasks 和 LiteRT 构建:探索 ML Kit GenAI 语音识别文档,了解 Android 集成;使用 MediaPipe Tasks 获取开箱即用的跨平台 API;或遵循 LiteRT 开发者指南,并从 Hugging Face LiteRT Community 下载可直接运行的 .litertlm 软件包。在 Google Cloud 的 Developer Device Platform 上,使用 200 多台真实设备测试并评测你的端侧语音处理流程。Start building with ML Kit, MediaPipe Tasks, and LiteRT: Explore the ML Kit GenAI Speech Recognition documentation for Android integrations, MediaPipe Tasks for turnkey cross-platform APIs, or follow the LiteRT developer guide and download ready-to-run .litertlm bundles from the Hugging Face LiteRT Community. Test and benchmark your on-device voice pipelines across 200+ real physical devices in Google Cloud’s Developer Device Platform.
- 观看 Android Dev Summit 专题演讲:查看我们的 Android Dev Summit 演讲录像,了解 Language Teacher 如何适配智能眼镜,并学习构建该流水线的更多工程技巧。Watch the Android Dev Summit session: Check out our Android Dev Summit session recording to see how Language Teacher is adapted for intelligent eyewear and learn more engineering tips from building the pipeline.
致谢(按字母顺序排列)Acknowledgements (alphabetical order)
我们谨向为本项目作出重要贡献的贡献者致以特别感谢:We'd like to extend a special thanks to our significant contributors for their work on this project:
Alice Zheng、Ajay Dudani、Alex Kanaukou、Amy Zeppenfeld、Byungchul Kim、Cheng Yang、Chintan Parikh、Chris Parsons、Cormac Brick、David Chou、Dong Chen、Geonsun Lee、Glenn Cameron、Hriday Chhabria、Ian Ballantyne、Ireneu Pla、James O’Donnell、Jamieson Pryor、Jason Poon、Jenn Lee、Jianing Wei、Jing Jin、Jingxiao Zheng、Jingyu Shi、Karthik Thirumalai、Kristen Wright、Lu Wang、Marius Kintel、Matthias Grundmann、Miao Wang、Mogan Shieh、Na Li、Paul Hsia、Qiumin Xu、Ravi Shankar、Rishika Sinha、Ronald Wotzlaw、Sachin Kotwani、Sandeep Patil、Sebastian Schmidt、Shao-Fu Shih、Shuangfeng Li、Suril Shah、Tiger Souvannakoumane、Tzu-Ping Chen、Weiyi Wang、Wentao Tu、Yang Yang、Yi-Chun Kuo、Yishuang Pang、Yu-che Liu、Yu-hui Chen、Yuling Liang、Zhihao Yang、Zichuan Wei。Alice Zheng, Ajay Dudani, Alex Kanaukou, Amy Zeppenfeld, Byungchul Kim, Cheng Yang, Chintan Parikh, Chris Parsons, Cormac Brick, David Chou, Dong Chen, Geonsun Lee, Glenn Cameron, Hriday Chhabria, Ian Ballantyne, Ireneu Pla, James O’Donnell, Jamieson Pryor, Jason Poon, Jenn Lee, Jianing Wei, Jing Jin, Jingxiao Zheng, Jingyu Shi, Karthik Thirumalai, Kristen Wright, Lu Wang, Marius Kintel, Matthias Grundmann, Miao Wang, Mogan Shieh, Na Li, Paul Hsia, Qiumin Xu, Ravi Shankar, Rishika Sinha, Ronald Wotzlaw, Sachin Kotwani, Sandeep Patil, Sebastian Schmidt, Shao-Fu Shih, Shuangfeng Li, Suril Shah, Tiger Souvannakoumane, Tzu-Ping Chen, Weiyi Wang, Wentao Tu, Yang Yang, Yi-Chun Kuo, Yishuang Pang, Yu-che Liu, Yu-hui Chen, Yuling Liang, Zhihao Yang, Zichuan Wei.