Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VRCMC is a VRChat Chatbox companion built with Kotlin Multiplatform and Compose
- **VRChat Chatbox**: Send messages over OSC to VRChat on the same computer or local network. Save multiple devices and switch between them; desktop and Android builds can also scan the local network. An IP alone defaults to `9000:IP:9001`, or you can specify both ports. The input limit follows Chatbox's 144-character and 9-line limits and the number of output languages; disable dynamic character limiting in Preferences.
- **Translation providers**: The API page exposes Qwen, Microsoft Edge Web (Bing), DeepSeek, OpenAI/GPT, and a custom compatible endpoint. Configure an API key, base URL, model, timeout, retries, fallback model, custom headers, and streaming where supported.
- **Translation output**: Select up to two target languages, choose whether to show the original, configure line breaks and output order, and optionally send the original before the translation.
- **Voice input**: Use Qwen Fun-ASR cloud recognition. On Windows x64, download SenseVoice Small INT8 or Fun-ASR-Nano INT8 for offline recognition. Desktop builds let you select a microphone; Android uses cloud recognition and requires microphone permission.
- **Voice input**: Use Qwen Fun-ASR cloud recognition. Windows x64 supports SenseVoice Small INT8, Fun-ASR-Nano INT8, and Qwen3-ASR 0.6B INT8 locally; Android ARM64 supports SenseVoice Small INT8 locally. Downloaded models can be deleted. Desktop builds let you select a microphone, and mobile builds require microphone permission.
- **Interpretation**: Use system voice input or app recognition. Simultaneous interpretation follows the VRChat microphone state and sends after mute; Always interpretation sends after input pauses and can merge quick successive messages.
- **Listen to others (Windows)**: Click the ear button on the Chat page to capture the Windows default playback device. Speech is detected locally and shown sentence by sentence with the original and one translation in an always-on-top subtitle window. Choose listening and target languages, resize or minimize the window, and adjust opacity.
- **SteamVR overlay**: Enable it in subtitle settings and choose the left hand, right hand, or screen center. Hand overlays follow controllers and the center overlay follows the headset. Choose 50%–200% size and an independent 75%–200% font size; opacity is shared with desktop subtitles and ranges from 30%–100%. SteamVR and a connected headset are required.
Expand Down
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VRCMC は、Kotlin Multiplatform と Compose Multiplatform で開発された VR
- **VRChat Chatbox**:OSC で同じ PC またはローカルネットワーク上の VRChat にメッセージを送信します。複数のデバイスを保存して切り替えられ、デスクトップ版と Android ではローカルネットワークのスキャンも利用できます。IP だけを入力した場合は `9000:IP:9001` を使用し、送受信ポートも指定できます。入力欄の文字数上限は Chatbox の 144 文字・9 行制限と出力言語数に応じて計算され、設定で動的な文字数制限を無効にできます。
- **翻訳サービス**:API ページで Qwen、Microsoft Edge Web(Bing)、DeepSeek、OpenAI/GPT、カスタム互換エンドポイントを選択できます。サービスに応じて API Key、Base URL、モデル、タイムアウト、再試行、フォールバックモデル、カスタムヘッダー、ストリーミングを設定できます。
- **翻訳出力**:最大 2 つの翻訳先言語を選択し、原文の表示、改行、原文と訳文の順番を設定できます。原文を先に送信することもできます。
- **音声入力**:Qwen Fun-ASR のクラウド認識を利用できます。Windows x64 では SenseVoice Small INT8 または Fun-ASR-Nano INT8 をダウンロードし、オフライン認識できます。デスクトップ版ではマイクを選択でき、Android ではクラウド認識とマイク権限を使用します。
- **音声入力**:Qwen Fun-ASR のクラウド認識を利用できます。Windows x64 では SenseVoice Small INT8、Fun-ASR-Nano INT8、Qwen3-ASR 0.6B INT8 のローカル認識に対応し、Android ARM64 では SenseVoice Small INT8 のローカル認識に対応します。ダウンロード済みモデルは削除でき、デスクトップ版ではマイクを選択でき、モバイル版ではマイク権限が必要です。
- **同時通訳**:システムの音声入力またはアプリ内認識と連携できます。有効にすると VRChat のマイク状態に応じて録音し、マイクを切った後に翻訳して送信します。「常時通訳」では入力が止まった後に自動送信し、短時間に続けて入力したメッセージを結合できます。
- **相手の声を聞く(Windows)**:チャットページ右上の耳ボタンで Windows の既定の再生デバイスを聞き取り、音声をローカルで検出して、常に手前に表示される字幕ウィンドウに原文と 1 つの訳文を文単位で表示します。聞き取り言語と翻訳先言語、ウィンドウのサイズ・最小化・不透明度を設定できます。
- **SteamVR オーバーレイ**:字幕設定で有効にし、左手・右手・画面中央から位置を選べます。手元のパネルはコントローラーに、画面中央のパネルはヘッドセットに追従します。サイズは 50%–200%、字幕の文字サイズは 75%–200% から個別に選べ、不透明度はデスクトップ字幕と共通の 30%–100% です。SteamVR と接続済みのヘッドセットが必要です。
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VRCMC 是一款基于 Kotlin Multiplatform 与 Compose Multiplatform 开发的 V
- **VRChat Chatbox**:通过 OSC 向同一台电脑或局域网中的 VRChat 发送消息。可保存多个设备并切换,桌面版和 Android 还可扫描局域网设备;只填 IP 时使用 `9000:IP:9001`,也可指定收发端口。输入框会根据 Chatbox 的 144 字符、9 行限制和输出语言数量计算字符上限,可在偏好设置中关闭动态字符限制。
- **翻译服务**:API 页面可选择 Qwen、Microsoft Edge Web(Bing)、DeepSeek、OpenAI/GPT 或自定义兼容端点。可按服务支持情况设置 API Key、Base URL、模型、超时、重试、备用模型、自定义请求头和流式响应。
- **翻译输出**:最多选择两种目标语言,设置是否显示原文、换行方式和原文/译文顺序,也可以先发送原文再发送译文。
- **语音输入**:可使用 Qwen Fun-ASR 云端识别;Windows x64 设备可下载 SenseVoice Small INT8 或 Fun-ASR-Nano INT8,在本地离线识别。桌面版可选择麦克风,Android 使用云端识别并需要麦克风权限。
- **语音输入**:可使用 Qwen Fun-ASR 云端识别。Windows x64 支持 SenseVoice Small INT8、Fun-ASR-Nano INT8 和 Qwen3-ASR 0.6B INT8 本地识别;Android ARM64 支持 SenseVoice Small INT8 本地识别。已下载模型可删除,桌面版可选择麦克风,移动端需要麦克风权限。
- **同声传译**:可配合系统语音输入或应用内识别。开启后会根据 VRChat 麦克风状态采集语音,闭麦后翻译并发送;“始终传译”会在输入暂停后自动发送,并可合并快速连续消息。
- **听别人说话(Windows)**:点击聊天页右上角的耳朵按钮,监听 Windows 默认播放设备并在本地检测人声,在置顶字幕窗口中按句显示原文和一种译文。窗口可调整大小、最小化和不透明度,设置中可选择听的语言和目标语言。
- **SteamVR 叠加界面**:可在字幕设置中开启,位置支持左手、右手或屏幕中间;手部面板跟随控制器,屏幕中间面板跟随头显。大小可选 50%–200%,字幕字号可独立选择 75%–200%,与桌面字幕共用 30%–100% 的不透明度,需要 SteamVR 和已连接的头显。
Expand Down
2 changes: 1 addition & 1 deletion README.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VRCMC 是一款使用 Kotlin Multiplatform 與 Compose Multiplatform 開發的 V
- **VRChat Chatbox**:透過 OSC 向同一台電腦或區域網路中的 VRChat 傳送訊息。可儲存多個裝置並切換,桌面版和 Android 也可掃描區域網路裝置;只填 IP 時使用 `9000:IP:9001`,也可指定收發連接埠。輸入框會依 Chatbox 的 144 字元、9 行限制與輸出語言數量計算字元上限,可在偏好設定中關閉動態字元限制。
- **翻譯服務**:API 頁面可選擇 Qwen、Microsoft Edge Web(Bing)、DeepSeek、OpenAI/GPT 或自訂相容端點。可依服務支援情況設定 API Key、Base URL、模型、逾時、重試、備用模型、自訂請求標頭與串流回應。
- **翻譯輸出**:最多選擇兩種目標語言,設定是否顯示原文、換行方式與原文/譯文順序,也可以先傳送原文再傳送譯文。
- **語音輸入**:可使用 Qwen Fun-ASR 雲端辨識;Windows x64 裝置可下載 SenseVoice Small INT8 或 Fun-ASR-Nano INT8,在本機離線辨識。桌面版可選擇麥克風,Android 使用雲端辨識並需要麥克風權限。
- **語音輸入**:可使用 Qwen Fun-ASR 雲端辨識。Windows x64 支援 SenseVoice Small INT8、Fun-ASR-Nano INT8 和 Qwen3-ASR 0.6B INT8 本機辨識;Android ARM64 支援 SenseVoice Small INT8 本機辨識。已下載模型可刪除,桌面版可選擇麥克風,行動裝置需要麥克風權限。
- **同聲口譯**:可搭配系統語音輸入或應用程式內辨識。開啟後會依 VRChat 麥克風狀態收音,閉麥後翻譯並傳送;「始終口譯」會在輸入暫停後自動傳送,並可合併快速連續訊息。
- **聽別人說話(Windows)**:點擊聊天頁右上角的耳朵按鈕,監聽 Windows 預設播放裝置並在本機偵測人聲,在置頂字幕視窗中按句顯示原文與一種譯文。視窗可調整大小、最小化與不透明度,設定中可選擇聆聽語言和目標語言。
- **SteamVR 疊加介面**:可在字幕設定中開啟,位置支援左手、右手或螢幕中央;手部面板跟隨控制器,螢幕中央面板跟隨頭顯。大小可選 50%–200%,字幕字級可獨立選擇 75%–200%,與桌面字幕共用 30%–100% 的不透明度,需要 SteamVR 和已連接的頭顯。
Expand Down
28 changes: 25 additions & 3 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ kotlin { jvm("desktop"); androidTarget(); iosX64(); iosArm64(); iosSimulatorArm6
named("desktopMain") {
kotlin.srcDir("src/jvmMain/kotlin")
kotlin.srcDir("src/jvmLocalMain/kotlin")
dependencies { implementation(libs.jlayer); implementation(desktopOnnxRuntime) }
dependencies {
implementation(libs.jlayer)
implementation(desktopOnnxRuntime)
implementation(files("libs/sherpa-onnx-jvm-2.0.0.jar"))
implementation(files("libs/sherpa-onnx-native-lib-win-x64-2.0.0.jar"))
}
dependencies {
implementation(libs.lwjgl.core)
implementation(libs.lwjgl.openvr)
Expand All @@ -92,7 +97,15 @@ kotlin { jvm("desktop"); androidTarget(); iosX64(); iosArm64(); iosSimulatorArm6
}
androidMain {
kotlin.srcDir("src/jvmMain/kotlin")
dependencies { implementation(libs.activity.compose); implementation(libs.ktor.client.cio); implementation(libs.ktor.client.okhttp); implementation(libs.kuromoji.core); implementation(kuromojiIpadicRuntime); implementation(libs.wanakana.core) }
dependencies {
implementation(libs.activity.compose)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.client.okhttp)
implementation(libs.kuromoji.core)
implementation(kuromojiIpadicRuntime)
implementation(libs.wanakana.core)
implementation(files("libs/sherpa-onnx-android-arm64-2.0.0.aar"))
}
}
iosMain.dependencies { implementation(libs.ktor.client.darwin) }
} }
Expand All @@ -106,6 +119,9 @@ android {
"META-INF/NOTICE.md",
)
}
jniLibs {
useLegacyPackaging = true
}
}

applicationVariants.all {
Expand All @@ -124,6 +140,9 @@ android {
targetSdk = 36
versionCode = libs.versions.app.code.get().toInt()
versionName = libs.versions.app.version.get()
ndk {
abiFilters += "arm64-v8a"
}
}

val signingProperties = Properties()
Expand Down Expand Up @@ -151,7 +170,10 @@ android {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
if (releaseStoreFile != null) {
signingConfig = signingConfigs.getByName("release")
}
Expand Down
54 changes: 54 additions & 0 deletions composeApp/libs/BUILD_ANDROID_ARM64.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Android ARM64 SenseVoice native runtime

The Android runtime is built from
[sherpa-onnx v2.0.0](https://github.com/k2-fsa/sherpa-onnx/tree/v2.0.0)
(`8abb7c8f87eae85b2e75f9a4115236c978980add`) with:

- Android NDK `27.2.12479018`
- CMake `3.22.1`
- `arm64-v8a`, API 26
- statically linked ONNX Runtime `1.28.2`
- `MinSizeRel` and `SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY=ON`
- `SHERPA_ONNX_ENABLE_TTS=OFF`
- `SHERPA_ONNX_ENABLE_SPEAKER_DIARIZATION=OFF`
- `SHERPA_ONNX_ENABLE_C_API=OFF`
- `SHERPA_ONNX_ENABLE_WEBSOCKET=OFF`
- `SHERPA_ONNX_ENABLE_BINARY=OFF`

Replace `offline-recognizer-impl.cc` with
[offline-recognizer-impl-sense-voice-only.cc](android-runtime/offline-recognizer-impl-sense-voice-only.cc),
and change its source entry in `sherpa-onnx/csrc/CMakeLists.txt` accordingly.
In `sherpa-onnx/jni/CMakeLists.txt`, keep only:

```text
common.cc
jni.cc
offline-recognizer.cc
offline-stream.cc
version.cc
wave-reader.cc
```

This removes every JNI binding unrelated to offline recognition and narrows
the C++ recognizer dispatcher to SenseVoice.

Build `sherpa-onnx-jni`, strip it with the NDK's `llvm-strip
--strip-unneeded`, then place it at:

```text
jni/arm64-v8a/libsherpa-onnx-jni.so
```

Use the `AndroidManifest.xml`, `classes.jar`, `R.txt`, and AAR metadata from
the official statically linked AAR. The resulting trimmed AAR is 7,484,372
bytes with SHA-256
`b281330fdd3f4e69b9bb03b837b6e6c6c432266c2fdb0e346902844734921bfb`.

Build the application with:

```powershell
.\gradlew.bat :composeApp:assembleRelease
```

The verified release APK for this revision is 9,694,107 bytes. JNI libraries
are packaged compressed and the app contains only `arm64-v8a`.
25 changes: 25 additions & 0 deletions composeApp/libs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Bundled JVM dependencies

The Qwen3-ASR local recognizer uses these prebuilt artifacts from the Apache-2.0
[sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) `v2.0.0` release:

- `sherpa-onnx-jvm-2.0.0.jar`
- Source: https://github.com/k2-fsa/sherpa-onnx/releases/download/v2.0.0/sherpa-onnx-jvm-2.0.0.jar
- SHA-256: `ae9dea81af11253c874bed3a7a35e610b583f0350e8380786a1900eff8a831f0`
- `sherpa-onnx-native-lib-win-x64-2.0.0.jar`
- Source: https://github.com/k2-fsa/sherpa-onnx/releases/download/v2.0.0/sherpa-onnx-native-lib-win-x64-2.0.0.jar
- SHA-256: `2c5c1ce813b86a3cb9c3d0ce6a40c86efda00de7d4ee286b59e2fc3892186946`
- `sherpa-onnx-android-arm64-2.0.0.aar`
- Source AAR: https://github.com/k2-fsa/sherpa-onnx/releases/download/v2.0.0/sherpa-onnx-static-link-onnxruntime-2.0.0.aar
- Source SHA-256: `59366e37cf2760b419e895d2872aa1664027fd721f6e4c827cdb0e805088fcbe`
- Custom SenseVoice-only SHA-256: `b281330fdd3f4e69b9bb03b837b6e6c6c432266c2fdb0e346902844734921bfb`
- The custom AAR is 7,484,372 bytes and contains only the Java classes plus
a stripped `arm64-v8a` `libsherpa-onnx-jni.so` that supports SenseVoice.

The native artifact contains `sherpa-onnx-jni.dll` and its matching
`onnxruntime.dll` for Windows x64. Local recognition support remains limited to
Windows x64 and Android ARM64, matching the platform checks in the application.
The Android AAR uses the statically linked ONNX Runtime build, removes all other
ABIs, and keeps only offline-recognition JNI bindings. See
[BUILD_ANDROID_ARM64.md](BUILD_ANDROID_ARM64.md) and the
[SenseVoice-only dispatcher](android-runtime/offline-recognizer-impl-sense-voice-only.cc).
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Minimal offline recognizer dispatcher used by VRCMC's Android ARM64 build.
// Only SenseVoice is retained to avoid linking unrelated ASR runtimes.

#include "sherpa-onnx/csrc/offline-recognizer-impl.h"

#include <memory>
#include <string>

#if __ANDROID_API__ >= 9
#include "android/asset_manager.h"
#include "android/asset_manager_jni.h"
#endif

#include "sherpa-onnx/csrc/macros.h"
#include "sherpa-onnx/csrc/offline-recognizer-sense-voice-impl.h"
#include "sherpa-onnx/csrc/text-utils.h"

namespace sherpa_onnx {

OfflineRecognizerImpl::OfflineRecognizerImpl(
const OfflineRecognizerConfig &config)
: config_(config) {}

template <typename Manager>
OfflineRecognizerImpl::OfflineRecognizerImpl(
Manager *, const OfflineRecognizerConfig &config)
: config_(config) {}

std::unique_ptr<OfflineRecognizerImpl> OfflineRecognizerImpl::Create(
const OfflineRecognizerConfig &config) {
if (!config.model_config.sense_voice.model.empty()) {
return std::make_unique<OfflineRecognizerSenseVoiceImpl>(config);
}
SHERPA_ONNX_LOGE("This narrowed runtime supports only SenseVoice");
SHERPA_ONNX_EXIT(-1);
return nullptr;
}

template <typename Manager>
std::unique_ptr<OfflineRecognizerImpl> OfflineRecognizerImpl::Create(
Manager *mgr, const OfflineRecognizerConfig &config) {
if (!config.model_config.sense_voice.model.empty()) {
return std::make_unique<OfflineRecognizerSenseVoiceImpl>(mgr, config);
}
SHERPA_ONNX_LOGE("This narrowed runtime supports only SenseVoice");
SHERPA_ONNX_EXIT(-1);
return nullptr;
}

void OfflineRecognizerImpl::SetConfig(const OfflineRecognizerConfig &config) {
config_ = config;
}

std::string OfflineRecognizerImpl::ApplyInverseTextNormalization(
std::string text) const {
return RemoveInvalidUtf8Sequences(text);
}

std::string OfflineRecognizerImpl::ApplyHomophoneReplacer(
std::string text) const {
return text;
}

#if __ANDROID_API__ >= 9
template OfflineRecognizerImpl::OfflineRecognizerImpl(
AAssetManager *, const OfflineRecognizerConfig &);
template std::unique_ptr<OfflineRecognizerImpl> OfflineRecognizerImpl::Create(
AAssetManager *, const OfflineRecognizerConfig &);
#endif

} // namespace sherpa_onnx
Binary file not shown.
Binary file added composeApp/libs/sherpa-onnx-jvm-2.0.0.jar
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions composeApp/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# MethodHandle.invokeExact has JVM signature-polymorphic overloads that ProGuard cannot resolve.
-dontwarn ai.onnxruntime.platform.Fp16Conversions

# sherpa-onnx binds its Java API to the bundled Windows x64 JNI library.
-keep class com.k2fsa.sherpa.onnx.** { *; }
-dontwarn com.k2fsa.sherpa.onnx.**

# Persisted enum names are restored with valueOf at runtime.
-keepclassmembers enum * {
public static **[] values();
Expand Down
Loading
Loading