Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

test(mobile): check dub output is French by its words, not a greeting list

debpalasha362ebc20cc4
diff --git a/mobile/android/app/src/androidTest/kotlin/com/voicestudio/mobile/PhoneDubInferenceTest.kt b/mobile/android/app/src/androidTest/kotlin/com/voicestudio/mobile/PhoneDubInferenceTest.kt
index 2a2448463..51debeb69 100644
--- a/mobile/android/app/src/androidTest/kotlin/com/voicestudio/mobile/PhoneDubInferenceTest.kt
+++ b/mobile/android/app/src/androidTest/kotlin/com/voicestudio/mobile/PhoneDubInferenceTest.kt
@@ -49,8 +49,10 @@ class PhoneDubInferenceTest {
assertTrue(result.segments.all {it.speech.start>=0&&it.speech.end>it.speech.start&&it.translations["fr"]?.isNotBlank()==true})
// The translation must actually be French, not the source echoed back (the
// prompt once named the source language "auto" and the model returned the input).
+ val source=result.segments.joinToString(" ") {it.speech.text}.lowercase()
val french=result.segments.mapNotNull {it.translations["fr"]}.joinToString(" ").lowercase()
- assertTrue("Not French: $french",listOf("bonjour","salut","comment","vous","merci","ça","toi").any {french.contains(it)})
+ val words=Regex("[\\p{L}']+").findAll(french).map {it.value}.toSet()
+ assertTrue("Not translated: $french",french!=source && setOf("le","la","les","des","du","un","une","et","est","par","pour","vous","comment").any {it in words})
val output=jobs.file(request.id,result.outputs.single().file)
val pcm=AndroidAudioDecoder().decode(output,File(root,"verification.pcm"))
assertTrue(pcm.frames>2400)
diff --git a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/PhoneWorkflowTests.swift b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/PhoneWorkflowTests.swift
index ec2674556..be30937a1 100644
--- a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/PhoneWorkflowTests.swift
+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/PhoneWorkflowTests.swift
@@ -196,7 +196,10 @@ func realAuxiliaryPhoneDubOfflineAndResume() async throws {
let translated = result.segments.compactMap { $0.translations["fr"] }.joined(separator: " ").lowercased()
print("Phone dub native segments:", result.segments.map { $0.speech.text })
print("Phone dub native translation:", translated)
- #expect(["bonjour", "salut", "comment", "vous", "merci"].contains { translated.contains($0) })
+ // Must be French, not the source echoed back (the prompt once named the source "auto").
+ let source = result.segments.map { $0.speech.text }.joined(separator: " ").lowercased()
+ let words = Set(translated.split { !$0.isLetter && $0 != "'" }.map(String.init))
+ #expect(translated != source && !words.isDisjoint(with: ["le", "la", "les", "des", "du", "un", "une", "et", "est", "par", "pour", "vous", "comment", "toi"]))
let wave = try await store.file(request.id,result.outputs[0].file)
let decoded = try await AVPhoneAudioDecoder().decode(source: wave,output: root.appendingPathComponent("result.pcm"),maxSeconds: 30,progress: { _ in })
#expect(try decoded.frames > 1000)