summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cooks <tommasogagliardi+github@gmail.com>2026-09-30 08:11:24 -0400
committerTom Cooks <tommasogagliardi+github@gmail.com>2026-09-30 08:11:24 -0400
commite15b89af9889d94eca15380048fc2bf6bbc8e22e (patch)
tree082741a74856fe65204c1cd589c5f53d54f625bf
parent68402ebbdacfc95e40bd856caa8c4cb83bef8342 (diff)
downloadreccoon-e15b89af9889d94eca15380048fc2bf6bbc8e22e.tar.gz
Fix transcription: streaming resampler trim could overrun the buffer (1.3.1-alpha)
The resampler clamped nothing before Arrays.copyOfRange(buffer, drop, length), so when the fractional read position overshot the buffer end, drop could be length+1 and the copy threw IllegalArgumentException: 8194 > 8193. This broke every transcription (base and tiny, any language). Clamp drop to buffer.length.
-rw-r--r--README.md4
-rw-r--r--TODO.md2
-rw-r--r--app/build.gradle.kts4
-rw-r--r--app/src/main/java/com/wuhei/reccoon/TranscriptionEngine.java3
-rw-r--r--app/src/main/res/values/strings.xml2
5 files changed, 10 insertions, 5 deletions
diff --git a/README.md b/README.md
index 17bf0a0..0cf9692 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ on device.
- **Transcription:** on-device, offline speech recognition with
[sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) using multilingual
Whisper — works with **English and Italian**
-- **Name:** RECCoon · **by** wuhei · **version** 1.3.0-alpha
+- **Name:** RECCoon · **by** wuhei · **version** 1.3.1-alpha
- **Icon:** raccoon with a microphone
## Requirements
@@ -39,7 +39,7 @@ Outputs:
- `app/build/outputs/apk/debug/app-debug.apk`
- `app/build/outputs/apk/release/app-release.apk`
-A prebuilt copy is available at `dist/RECCoon-1.3.0-alpha.apk`. Note that the
+A prebuilt copy is available at `dist/RECCoon-1.3.1-alpha.apk`. Note that the
sherpa-onnx AAR in `app/libs/` and the APK in `dist/` are **not** tracked in
git because they are large; see `TODO.md`.
diff --git a/TODO.md b/TODO.md
index c8d1f54..c41f23e 100644
--- a/TODO.md
+++ b/TODO.md
@@ -31,3 +31,5 @@
- [ ] Library actions: delete, rename, share, "open with".
- [ ] Word-level timestamps and tap-to-seek inside a transcript segment.
- [ ] Read embedded markers back from the WAV when there is no JSON sidecar.
+- [ ] Add a JUnit regression test for `StreamingResampler` (it could throw
+ `IllegalArgumentException: <n> > <n-1>` when the trim overshot the buffer).
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index b1a0836..d57a7e6 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -15,8 +15,8 @@ android {
applicationId = "com.wuhei.reccoon"
minSdk = 26
targetSdk = 35
- versionCode = 4
- versionName = "1.3.0-alpha"
+ versionCode = 5
+ versionName = "1.3.1-alpha"
ndk {
// Prebuilt sherpa-onnx / onnxruntime native libraries.
diff --git a/app/src/main/java/com/wuhei/reccoon/TranscriptionEngine.java b/app/src/main/java/com/wuhei/reccoon/TranscriptionEngine.java
index f4306ff..efee8dd 100644
--- a/app/src/main/java/com/wuhei/reccoon/TranscriptionEngine.java
+++ b/app/src/main/java/com/wuhei/reccoon/TranscriptionEngine.java
@@ -383,6 +383,9 @@ public final class TranscriptionEngine {
}
int drop = (int) position;
+ if (drop > buffer.length) {
+ drop = buffer.length;
+ }
if (drop > 0) {
buffer = Arrays.copyOfRange(buffer, drop, buffer.length);
position -= drop;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 54a69d9..dbd3535 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">RECCoon</string>
- <string name="subtitle">by wuhei · v1.3.0-alpha</string>
+ <string name="subtitle">by wuhei · v1.3.1-alpha</string>
<string name="timer_zero">00:00</string>
<string name="footer">44.1 kHz · 16-bit · PCM (WAV) · cue markers</string>