GlassMic

简体中文

GlassMic is an open-source virtual microphone and audio pipeline testing module for rooted Android devices with LSPosed. It lets you route an imported audio file into target recording apps through AudioRecord/AAudio hooks while keeping the module visible, controllable, and easy to disable.

GlassMic is intended for local testing, development, compatibility checks, and lawful accessibility or debugging scenarios on devices you own or control. Do not use it to impersonate others, deceive people, bypass platform rules, harass anyone, or violate privacy or law.

Features

  • Import local audio files such as MP3, WAV, M4A, AAC, OGG, and FLAC.
  • Manage audio clips and groups.
  • Use playback policies: loop, silence after end, or return to the real microphone.
  • Restore the last selected audio source after the app process is killed.
  • Start restored audio in a paused state so playback is explicit.
  • Floating ball with customizable icon and size (small/standard/large).
  • Tap the ball to open a song menu and pick audio by group directly.
  • While playing, tap the ball for a mini control bar: pause/resume, seek, and switch source.
  • Configurable floating ball opacity.
  • Runtime routing through a foreground service and always-visible notification.
  • LSPosed integration with recommended scope limited to Android/system framework.
  • AudioRecord and AAudio input interception paths.
  • Per-consumer sample-rate/channel conversion for clients such as WeChat and system recorders.
  • Diagnostics, logs, hook status, and interception statistics.
  • Optional experimental audio effects such as high gain and stronger noise simulation.
  • Text-to-speech (TTS): type text and feed synthesized speech into the target app — handy for testing voice recognition / voice input without preparing audio files.
  • Two-step TTS flow: generate first, then play (replayable).
  • Offline system TTS out of the box, plus optional online AI TTS with OpenAI, Google Gemini, and Xiaomi MiMo protocols, custom endpoint URL and model, model listing, connection test, and audition.
  • MiMo preset voices, voice design (describe a voice in text), and voice cloning from a short reference audio sample (≤60 s / ≤5 MB).

Text-to-Speech (TTS)

Open the floating window's menu and tap "🗣 Text-to-Speech". Type your text, tap Generate to synthesize, then tap Play to feed the audio into whatever app is recording. Play is repeatable, so you can re-feed the same clip without regenerating.

  • System TTS works fully offline with no configuration.
  • AI TTS (Settings → AI Provider (TTS)) enables online synthesis with a custom endpoint URL and model, and supports three protocols:
    • OpenAI/audio/speech
    • Google GeminigenerateContent with the AUDIO modality
    • Xiaomi MiMochat/completions, including preset voices, voice design (describe a voice in text), and voice cloning from a reference audio sample (≤60 s / ≤5 MB)
  • Fetch the available model list from the provider, run a connection test, and audition the result (generate, then play through the speaker) before feeding it to an app.

Requirements

  • Android 10 (API 29) minimum; Android 15/16 recommended target environment.
  • Root access, for example Magisk or KernelSU.
  • LSPosed with libxposed API support.
  • Android notification, overlay, file access, and foreground service permissions.
  • JDK 17 and Android SDK for building from source.

Installation

  1. Install the APK.
  2. Enable the GlassMic module in LSPosed.
  3. It is recommended to use android and system for the scope, as well as the target application.
  4. Reboot the device so the module is loaded cleanly.
  5. Open GlassMic, complete onboarding, grant permissions, import an audio file, and select it as the current source.
  6. Start GlassMic from the main screen when you want the virtual microphone to be active.

How It Works

GlassMic has three modules:

  • app: Android app, Compose UI, foreground service, floating window, ContentProviders, diagnostics, and audio publishing.
  • xposed: LSPosed/libxposed entry points, AudioRecord hooks, native AAudio hook, and PCM pipe reader.
  • core: shared models, constants, and scope matching helpers.

When enabled, target recording calls are intercepted and filled from the current PCM stream. The app publishes PCM through a ContentProvider pipe, and each consumer receives audio converted to its requested sample rate and channel count.

Safety Model

GlassMic is designed to fail toward the real microphone:

  • Device reboot disables the active virtual microphone state.
  • Safe mode can stop the module after repeated system/audio failures.
  • If no valid selected audio file exists, GlassMic falls back instead of forcing a broken source.
  • The foreground notification remains visible while the service is running.
  • The app itself is excluded from interception to avoid feedback loops.

Build

git clone https://github.com/<owner>/GlassMic.git
cd GlassMic
./gradlew assembleDebug

On Windows:

.\gradlew.bat assembleDebug

The debug APK is generated under:

app/build/outputs/apk/debug/

Recommended Repository Description

Open-source LSPosed virtual microphone and Android audio pipeline testing module for rooted devices.

License

GlassMic is licensed under the GNU General Public License v3.0. See LICENSE.

Releases

1.3.3

Stable

7/25/2026, 8:53:32 AM

修复未使用时后台顽固问题

Assets

1

1.3.2

Stable

7/22/2026, 10:24:41 AM

为 Xiaomi MiMo 添加可配置的 optimize_text_preview 选项

Assets

1

1.3.1

Stable

7/21/2026, 7:09:24 PM

修复频繁自启动问题

Assets

1

1.3.0

Stable

7/20/2026, 10:09:54 AM

更新日志

  • 重构悬浮窗组件
  • 修复悬浮窗位置问题
  • 修复安卓磁贴行为
  • 悬浮窗 TTS 设置面板:新增「延时播放」功能

Assets

1

1.2.9

Stable

7/14/2026, 11:40:37 AM

添加England适配
优化设置UI

Assets

1

1.2.8

Stable

7/10/2026, 9:57:51 AM

修改静音时的处理逻辑,优化在wx上的使用效果

Assets

1

1.2.7

Stable

7/8/2026, 12:25:47 AM

为TTS生成失败新增提示
修改静音时的逻辑

Assets

1

1.2.6

Stable

7/5/2026, 12:34:52 PM

  • 修复悬浮窗展开时点不了外部区域

  • 展开态也能拖动悬浮窗

  • 「打开悬浮窗」开关按需显示

  • TTS新增「播放进度条」开关

Assets

1

1.2.5

Stable

7/4/2026, 9:45:20 AM

📢 更新日志

🚀 新特性

  • [新增] 实时音频波形图展示,视觉反馈更直观。
  • [新增] 安卓系统快捷磁贴支持,并同步上线「快捷磁贴设置」面板。
  • [拓展] 支持系统级 TTS 播报,并全新集成 AI-TTS 接口(支持 OpenAI、Google Gemini、mimo-tts)。

🧪 实验性功能

  • [音频] 新增「混响」与「变速」效果调节。

Assets

1

1.2.1

Stable

7/2/2026, 11:28:25 AM

🚀 更新内容

  • 【优化】 导入音乐功能升级,支持调用系统原生文件管理器。
  • 【新增】 悬浮窗支持自定义样式。
  • 【重构】 重构悬浮窗。

Assets

1

1.2.0

Stable

7/1/2026, 9:53:42 AM

  • Feat: 新增兼容模式,提升部分特定系统的稳定性。
  • Refactor: 降低准入门槛,minSdk 由 30 下调至 29(最低支持 Android 10)。

Assets

1

1.1.0

Stable

6/29/2026, 11:27:26 AM

更新日志 (Changelog)

✨ 新增功能与优化

  • 新增三种录音方式的 Hook 方法:用以修复部分软件录音不生效的问题。
    • 📌 native AudioRecord::read
    • 📌 OpenSL ES 录音回调
    • 📌 AAudio 回调模式 (此前仅支持阻塞读取)

🐛 缺陷修复

  • 稳定性提升:修复了某些特定情况下程序发生闪退的问题。

Assets

1

1.0.1

Stable

6/28/2026, 9:38:03 AM

新增

  • 最低系统版本从 Android 14 (API 34) 降至 Android 11 (API 30)
    变更
  • minSdk 从 34 调整为 30(app、xposed、core 三个模块)
  • 前台服务启动增加版本守卫,API < 34 不再传递 FOREGROUND_SERVICE_TYPE_MICROPHONE 参数
  • 文件访问权限检测增加 READ_EXTERNAL_STORAGE 降级路径(API 30-32)
  • Native AAudio hook 的 ParcelFileDescriptor.detachFd() 增加 dup() 降级方案(API < 33)
  • 权限检查器的版本支持门槛从 API 34 降至 API 30

Assets

1