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.5

Stable

8/19/2026, 11:27:16 AM

GlassMic v1.3.4.7

🚀 本次更新带来了全新重构的高保真音频重采样引擎、实时耳返监听功能、在线游戏(如 Roblox)硬实时低延迟优化,以及更直观的全链路推流状态可视化与 TTS 本地试听体验。

🚀 This release introduces a newly refactored Hi-Fi audio resampling engine, real-time audio monitoring, hard real-time low-latency optimizations for online games, full-pipeline streaming status awareness, and local TTS preview capabilities.


🇨🇳 中文更新日志 (Changelog)

🎵 音频核心引擎与高保真重采样 (Hi-Fi Resampling)

  • Windowed-Sinc FIR 抗混叠低通滤波:引入基于 Blackman-Harris 窗的 27 阶低通滤波器,自动在下采样($48\text{k}\to 16\text{k}$ / $44.1\text{k}\to 16\text{k}$)时滤除奈奎斯特极限以上的镜像混叠能量,彻底解决微信语音等场景的破音、金属毛刺和高频嘶嘶杂音[cite: 1]。
  • 亚采样点级线性插值与连续流处理:消除阶梯时域伪影,跨分块严格保持滤波器延迟线与时钟游标连续,实现零爆音平滑过渡[cite: 1]。
  • 防削波软拐点限幅器 (Soft Knee Limiter):引入双曲正切软过渡限幅算法,防止动态峰值过冲导致的方波削波失真[cite: 1]。
  • 底层解码与 Native 优化:重构 FileAudioSource 解码链路统一接入高质量重采样混音[cite: 1];优化 glass_aaudio.cpp 原生拦截路径音质[cite: 1]。

🎧 实时耳返监听 (Audio Monitor)

  • 低延迟本地监听 (AudioMonitorPlayer):基于高响应 AudioTrack 实现耳机/扬声器实时监听,与虚拟麦克风广播严格同步,所听即所录[cite: 1]。
  • 独立音量控制与持久化:Proto 配置与设置页支持 0%~100% 独立音量调节并持久化保存[cite: 1]。
  • 悬浮窗快捷开关:在 MiniBar 与 TTS 面板集成 🎧 耳返快捷开关,支持一键启闭[cite: 1]。

⚡ 在线/直播游戏硬实时低延迟优化

  • SPSC 无锁环形缓冲区 (SpscRingBuffer):Native 端实现 256 KB SPSC 无锁环形缓冲区与独立读取线程,硬实时音频回调与 IPC 管道 I/O 完全解耦,彻底消除 Buffer Underrun / XRun 卡顿[cite: 1]。
  • 欠载平滑补偿 (PLC):优化欠载时的舒适噪声填充与真实采样率映射,杜绝音频时间拉伸变调与漏音[cite: 1]。
  • 线程调度与保活:音频推流线程优先级提升至 URGENT_AUDIO,切片精细化至 20ms(1920 字节),前台服务增加 Partial WakeLock 防止系统休眠断流[cite: 1]。

👁️ 全链路推流状态感知与动效可视化

  • 实时推流感知 (isStreaming):动态监测目标应用是否正在实际录音取流[cite: 1]。
  • 悬浮球 (Floating Bubble) 动效:新增推流脉冲呼吸动效与高亮绿点,统一支持 FILE / TTS 环形进度展示[cite: 1]。
  • 悬浮窗 MiniBar & 主页:增加「● 录制推流中 / ○ 待命中」实时状态指示与精准时间戳进度同步[cite: 1]。

🗣️ TTS 本地试听与交互升级

  • 独立本地试听 (togglePreviewTts):支持直接通过扬声器/耳机试听合成语音,不占用虚拟麦克风推流管线[cite: 1]。
  • TTS 面板重构:集成「🔊 试听 / ⏹ 停止」按钮、耳返快捷开关与实时进度调节条[cite: 1]。
  • 国际化适配:补齐中英文多语言文案与提示支持[cite: 1]。

🌐 English Changelog

🎵 Audio Engine & Hi-Fi Resampling

  • Windowed-Sinc FIR Anti-Aliasing Filter: Implemented a 27th-order Blackman-Harris windowed low-pass filter that eliminates mirror aliasing above the Nyquist limit during downsampling ($48\text{k}\to 16\text{k}$ / $44.1\text{k}\to 16\text{k}$), completely fixing harsh sibilance, metallic artifacts, and hissing in WeChat voice messages[cite: 1].
  • Sub-sample Linear Interpolation: Replaced nearest-neighbor truncation with fractional-sample interpolation and persistent filter delay lines across chunks to ensure zero-pop, seamless transitions[cite: 1].
  • Soft Knee Limiter: Added a tanh-based soft limiter after interpolation to prevent clipping distortion caused by peak overshoot[cite: 1].
  • Native & Pipeline Refactoring: Overhauled FileAudioSource with streaming resampling[cite: 1]; optimized glass_aaudio.cpp native audio conversion pipeline[cite: 1].

🎧 Real-time Audio Monitoring

  • Low-Latency Monitor Engine (AudioMonitorPlayer): Real-time audio playback through headphones/speakers synchronized with the virtual mic broadcast loop[cite: 1].
  • Volume Control & Persistence: Added a 0%–100% volume slider and toggle with Proto configuration persistence[cite: 1].
  • Floating Window Shortcuts: Added a 🎧 quick toggle in both MiniBar and TTS panels[cite: 1].

⚡ Real-Time Latency Optimizations for Online Games

  • SPSC Lock-Free Ring Buffer (SpscRingBuffer): 256 KB native SPSC ring buffer decoupled from IPC pipe I/O via a dedicated worker thread, completely eliminating audio underrun / XRun stutters[cite: 1].
  • Packet Loss Concealment (PLC): Refined comfort noise generation and sample rate mapping during underruns to prevent audio pitch shifts and missing samples[cite: 1].
  • Thread Scheduling & WakeLock: Elevated audio publisher thread priority to URGENT_AUDIO, refined slicing down to 20ms (1920 bytes), and added Partial WakeLock to prevent background sleep interruptions[cite: 1].

👁️ Streaming Awareness & Visual Indicators

  • Real-time Streaming Detection (isStreaming): Dynamically monitors target application consumption and recording states[cite: 1].
  • Floating Bubble Upgrades: Added pulse breathing animations, glowing green status dots, and unified circular progress rings for both FILE and TTS modes[cite: 1].
  • MiniBar & HomeScreen: Real-time indicators ("● Streaming / ○ Idle") and timestamp progress bars[cite: 1].

🗣️ TTS Local Preview & UI Refinements

  • Local Preview (togglePreviewTts): Listen to synthesized speech locally without occupying or interfering with the active virtual mic stream[cite: 1].
  • Redesigned TTS Panel: Integrated "🔊 Preview / ⏹ Stop" controls, monitor switch, and progress slider[cite: 1].
  • Localization: Full internationalization support for Simplified Chinese and English[cite: 1].

📦 Git Commits & Changes Summary

  • 743503d Follow up version bump (v1.3.4.7)[cite: 1]
  • ae39218 fix(audio): Refactor audio resampling engine, fix 16kHz aliasing & distortion issues[cite: 1]
  • 6f411ff feat: Support real-time audio monitor, streaming awareness, and local TTS preview[cite: 1]
  • 6205b15 Code style & cleanups[cite: 1]
  • b97e804 Optimize virtual mic stuttering and dropouts in online/live games[cite: 1]

📊 Stats: 22 files changed, +1384 insertions, -346 deletions[cite: 1].

Assets

1

1.3.4

Stable

7/30/2026, 5:33:51 PM

  • 适配“公平运行内存”机制
  • 新增「音量键快捷操作」

Assets

1

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