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
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,19 @@ jobs:
java-version: 17
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew :sip:test :gateway:test

phone-apk:
# The phone app needs no native code, so CI can compile both flavors.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew :phone:assembleFullDebug :phone:assembleFossDebug
- uses: actions/upload-artifact@v4
with:
name: simbridge-phone-debug
path: phone/build/outputs/apk/**/*.apk
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## SimBridge 2.2.0

### Main phone
- **Live call translation** for relayed calls (Settings > Call translation):
- **Captions:** the caller's words appear translated in a floating window over the call screen
(or tap Translate in the call notification for full screen).
- **Captions + voice:** your words are also spoken to the caller in their language.
- 19 languages (Turkish, English, Arabic, Persian, Russian, Ukrainian, French, German, Spanish and more).
- Free engines: Groq GPT-OSS 120B / 20B, Cerebras GPT-OSS 120B, Google Gemini 2.5 Flash-Lite,
or on-device (ML Kit, full build only). Speech recognition: Groq Whisper or on-device.
- Options: pause length, read the caller's translation to you, large text, on-device only.

## SimBridge 2.1.0

### Main phone
Expand Down
8 changes: 6 additions & 2 deletions phone/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "io.github.simbridge"
minSdk = 34
targetSdk = 36
versionCode = 220
versionName = "2.1.0"
versionCode = 230
versionName = "2.2.0"
}
// Same signing source as the gateway app: a git-ignored signing.properties in the project root.
val localSigning = Properties().apply {
Expand Down Expand Up @@ -56,6 +56,8 @@ android {
create("full") {
dimension = "store"
buildConfigField("boolean", "UPDATE_CHECK_DEFAULT", "true")
// ML Kit translation ships a ~16 MB native lib per ABI; Android 14+ phones are arm64.
ndk { abiFilters += "arm64-v8a" }
}
create("foss") {
dimension = "store"
Expand All @@ -79,5 +81,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.android)
// QR scanning for pairing via Google Play services (no camera permission needed).
"fullImplementation"("com.google.android.gms:play-services-code-scanner:16.1.0")
// On-device Turkish/English translation for call captions (offline fallback).
"fullImplementation"("com.google.mlkit:translate:17.0.3")
}

1 change: 1 addition & 0 deletions phone/fastlane/metadata/android/en-US/changelogs/230.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live call translation: captions of the caller's words in your language in a floating window, and optional translated voice to the caller. 19 languages; free cloud engines (Groq, Cerebras, Gemini) or on-device.
15 changes: 15 additions & 0 deletions phone/src/foss/kotlin/io/github/simbridge/OfflineTranslate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.simbridge

import android.content.Context

/** F-Droid build: no Google ML Kit, so translation needs the cloud (Groq key). */
object OfflineTranslate {
fun translate(@Suppress("UNUSED_PARAMETER") ctx: Context, @Suppress("UNUSED_PARAMETER") text: String,
@Suppress("UNUSED_PARAMETER") from: String, @Suppress("UNUSED_PARAMETER") to: String): String? {
Captions.say("Offline translation isn't in the F-Droid build: add a Groq key in Settings")
return null
}

@Suppress("UNUSED_PARAMETER") fun prepare(ctx: Context, a: String, b: String) = Unit

}
32 changes: 32 additions & 0 deletions phone/src/full/kotlin/io/github/simbridge/OfflineTranslate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.github.simbridge

import android.content.Context
import com.google.android.gms.tasks.Tasks
import com.google.mlkit.nl.translate.Translation
import com.google.mlkit.nl.translate.Translator
import com.google.mlkit.nl.translate.TranslatorOptions
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit

/** On-device translation with Google ML Kit (free, offline once the ~30 MB models are downloaded). */
object OfflineTranslate {
private val clients = ConcurrentHashMap<String, Translator>()

private fun client(from: String, to: String) = clients.getOrPut("$from>$to") {
Translation.getClient(TranslatorOptions.Builder().setSourceLanguage(from).setTargetLanguage(to).build())
}

/** Worker thread only: blocks until translated (downloads the model the first time). */
fun translate(@Suppress("UNUSED_PARAMETER") ctx: Context, text: String, from: String, to: String): String? = runCatching {
val t = client(from, to)
Tasks.await(t.downloadModelIfNeeded(), 90, TimeUnit.SECONDS)
Tasks.await(t.translate(text), 10, TimeUnit.SECONDS)
}.onFailure { Log.w("translate: on-device translation failed", it); Captions.say("On-device translation failed: ${it.message}") }.getOrNull()

/** Downloads both directions of a language pair in the background. */
fun prepare(@Suppress("UNUSED_PARAMETER") ctx: Context, a: String, b: String) {
client(a, b).downloadModelIfNeeded()
client(b, a).downloadModelIfNeeded()
}

}
10 changes: 10 additions & 0 deletions phone/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- Floating translate button over the call screen (user grants "Display over other apps"). -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<application
android:name=".LinkApp"
Expand Down Expand Up @@ -77,6 +79,14 @@
android:taskAffinity=""
android:theme="@style/Trampoline" />

<!-- Live call captions; shows over the lock screen, its own task so Back returns to the call. -->
<activity
android:name=".CaptionActivity"
android:exported="false"
android:launchMode="singleTask"
android:taskAffinity="io.github.simbridge.captions"
android:showWhenLocked="true" />

<receiver android:name=".RecordReceiver" android:exported="false" />

<provider
Expand Down
9 changes: 7 additions & 2 deletions phone/src/main/kotlin/io/github/simbridge/CallAudio.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class CallAudio {
@Volatile var muted = false
/** Set while the call is being recorded; gets both sides of every frame. */
@Volatile var recorder: CallRecorder? = null
/** Set during the call; hears the caller and may replace my voice with translated speech. */
@Volatile var translator: CallTranslator? = null
@Volatile private var running = false
private var thread: Thread? = null

Expand Down Expand Up @@ -79,10 +81,13 @@ class CallAudio {
got += r
}
if (got < n) { Thread.sleep(5); continue }
val up = if (muted) zero else buf
val tr = translator
val up = if (muted) zero else tr?.uplink(buf) ?: buf
port.writeFrame(up.copyOf())
val down = port.readFrame()
track.write(down, 0, down.size)
val play = tr?.downlink(down) ?: down
track.write(play, 0, play.size)
tr?.heard(down)
recorder?.write(up, down)
if (++frames % 250 == 0) { // every 5 s
Log.i("audio: upPeak=$upPeak downPeak=$downPeak muted=$muted")
Expand Down
Loading
Loading