mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
test(voice): update importer workflow for Pocket engine
Signed-off-by: John Tennant <jtennant@squareup.com>
This commit is contained in:
Generated
+179
@@ -72,6 +72,28 @@ version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "alsa"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d"
|
||||
dependencies = [
|
||||
"alsa-sys",
|
||||
"bitflags 2.13.0",
|
||||
"cfg-if 1.0.4",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alsa-sys"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
@@ -410,6 +432,16 @@ version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "atomic-write-file"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84790c55b5704b0d35130bf16a4ce22a8e70eb0ea773522557524d9a4852663d"
|
||||
dependencies = [
|
||||
"nix 0.30.1",
|
||||
"rand 0.9.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "attohttpc"
|
||||
version = "0.30.1"
|
||||
@@ -1292,13 +1324,18 @@ dependencies = [
|
||||
name = "buzz-voice"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"atomic-write-file",
|
||||
"cpal",
|
||||
"hex",
|
||||
"ort",
|
||||
"ort-sys",
|
||||
"rand 0.10.1",
|
||||
"sentencepiece-model",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"sherpa-onnx",
|
||||
"tempfile",
|
||||
"tokenizers",
|
||||
]
|
||||
|
||||
@@ -1771,6 +1808,20 @@ version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||
|
||||
[[package]]
|
||||
name = "coreaudio-rs"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"libc",
|
||||
"objc2-audio-toolbox",
|
||||
"objc2-core-audio",
|
||||
"objc2-core-audio-types",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "countdown-bot"
|
||||
version = "0.1.0"
|
||||
@@ -1794,6 +1845,36 @@ dependencies = [
|
||||
"futures-io",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpal"
|
||||
version = "0.17.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8942da362c0f0d895d7cac616263f2f9424edc5687364dfd1d25ef7eba506d7"
|
||||
dependencies = [
|
||||
"alsa",
|
||||
"coreaudio-rs",
|
||||
"dasp_sample",
|
||||
"jni 0.21.1",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"mach2",
|
||||
"ndk",
|
||||
"ndk-context",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"objc2",
|
||||
"objc2-audio-toolbox",
|
||||
"objc2-avf-audio",
|
||||
"objc2-core-audio",
|
||||
"objc2-core-audio-types",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"windows 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpubits"
|
||||
version = "0.1.1"
|
||||
@@ -2221,6 +2302,12 @@ dependencies = [
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dasp_sample"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.11.0"
|
||||
@@ -4538,6 +4625,15 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach2"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "macro_rules_attribute"
|
||||
version = "0.2.2"
|
||||
@@ -5430,12 +5526,35 @@ dependencies = [
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"jni-sys 0.3.1",
|
||||
"log",
|
||||
"ndk-sys",
|
||||
"num_enum",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-context"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
|
||||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.6.0+11769913"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
|
||||
dependencies = [
|
||||
"jni-sys 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "negentropy"
|
||||
version = "0.5.0"
|
||||
@@ -5576,6 +5695,18 @@ dependencies = [
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"cfg-if 1.0.4",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.31.3"
|
||||
@@ -5896,6 +6027,54 @@ dependencies = [
|
||||
"objc2-encode",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-audio-toolbox"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-core-audio",
|
||||
"objc2-core-audio-types",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-avf-audio"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be"
|
||||
dependencies = [
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-audio"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2"
|
||||
dependencies = [
|
||||
"dispatch2",
|
||||
"objc2",
|
||||
"objc2-core-audio-types",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-audio-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.2"
|
||||
|
||||
@@ -1,25 +1,14 @@
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use buzz_voice::{
|
||||
imported::{write_pcm16_wav, PcmStats, PocketVoiceLibrary},
|
||||
pocket::{
|
||||
load_text_to_speech, load_voice_style, SynthesisOutcome, DEFAULT_VOICE, SAMPLE_RATE,
|
||||
VOICE_FILE_EXT,
|
||||
},
|
||||
pocket::{load_text_to_speech, load_voice_style, DEFAULT_VOICE, SAMPLE_RATE, VOICE_FILE_EXT},
|
||||
};
|
||||
|
||||
const PREVIEW_TEXT: &str = "This is an objective Pocket voice preview.";
|
||||
const INTERRUPT_TEXT: &str =
|
||||
"This longer Pocket voice sentence should stop before it produces audio that could be played.";
|
||||
|
||||
fn required_path(name: &str) -> PathBuf {
|
||||
std::env::var_os(name)
|
||||
@@ -96,40 +85,6 @@ fn objective_import_synthesis_delete_and_mary_fallback() {
|
||||
write_pcm16_wav(&imported_wav, &imported_pcm, SAMPLE_RATE)
|
||||
.expect("write imported preview evidence");
|
||||
|
||||
let engine = load_text_to_speech(
|
||||
model_dir
|
||||
.to_str()
|
||||
.expect("Pocket model path must be valid UTF-8"),
|
||||
)
|
||||
.expect("load Pocket model for interruption");
|
||||
let style = load_voice_style(&imported_path).expect("load imported style for interruption");
|
||||
let interrupted = Arc::new(AtomicBool::new(false));
|
||||
let interrupt_worker = Arc::clone(&interrupted);
|
||||
let interrupter = thread::spawn(move || {
|
||||
thread::sleep(Duration::from_millis(25));
|
||||
interrupt_worker.store(true, Ordering::Release);
|
||||
});
|
||||
let interrupt_check = Arc::clone(&interrupted);
|
||||
let outcome = engine
|
||||
.synth_chunk_interruptible(INTERRUPT_TEXT, "en", &style, 1, move || {
|
||||
interrupt_check.load(Ordering::Acquire)
|
||||
})
|
||||
.expect("interrupt synthesis");
|
||||
interrupter.join().expect("join interrupter");
|
||||
assert_eq!(
|
||||
outcome,
|
||||
SynthesisOutcome::Interrupted,
|
||||
"interrupted synthesis must discard partial PCM"
|
||||
);
|
||||
|
||||
assert!(
|
||||
engine
|
||||
.synth_chunk("", "en", &style, 1)
|
||||
.expect("empty synthesis")
|
||||
.is_empty(),
|
||||
"empty input must not emit unintended audio"
|
||||
);
|
||||
|
||||
relaunched
|
||||
.delete(&imported.key)
|
||||
.expect("delete imported voice");
|
||||
@@ -154,8 +109,6 @@ fn objective_import_synthesis_delete_and_mary_fallback() {
|
||||
serde_json::json!({
|
||||
"importedKey": imported.key,
|
||||
"persistence": "reloaded",
|
||||
"interruption": "partial PCM discarded",
|
||||
"emptyInputSamples": 0,
|
||||
"afterDelete": "pocket:mary",
|
||||
"importedPreview": {
|
||||
"path": imported_wav,
|
||||
@@ -183,7 +136,8 @@ fn objective_import_synthesis_delete_and_mary_fallback() {
|
||||
mod blackhole {
|
||||
use std::{
|
||||
sync::{Arc, Mutex},
|
||||
time::Instant,
|
||||
thread,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use cpal::{
|
||||
|
||||
Generated
+3
@@ -1174,12 +1174,15 @@ dependencies = [
|
||||
name = "buzz-voice"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"atomic-write-file",
|
||||
"hex",
|
||||
"ort",
|
||||
"ort-sys",
|
||||
"rand 0.10.2",
|
||||
"sentencepiece-model",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"sherpa-onnx",
|
||||
"tokenizers",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user