ITADN

How to use fsts rule correctly?

#119Opennewrichard 创建于 2025-10-28
N
newrichardcommented
I'm trying to run a matcha tts example from sherpa-onnx. Without fsts setup, test program runs correctly and audio.wav generated is OK. But when adding rule_fsts, it fails to verify fst file and exits with STATUS_ACCESS_VIOLATION. The program's outputs: ``` D:\a\sherpa-onnx\sherpa-onnx\sherpa-onnx\csrc\offline-tts.cc:Validate:126 Rule fst '?r€3' does not exist. D:\a\sherpa-onnx\sherpa-onnx\sherpa-onnx\c-api\c-api.cc:SherpaOnnxCreateOfflineTts:1250 Errors in config error: process didn't exit successfully: `target\debug\sherpa-tts-tools.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) ``` And the code: ```rust pub use sherpa_rs::tts::{CommonTtsConfig, MatchaTts, MatchaTtsConfig}; fn main() { let config = MatchaTtsConfig { acoustic_model: "./matcha-icefall-zh-baker/model-steps-3.onnx".into(), vocoder: "./vocos-22khz-univ.onnx".into(), lexicon: "./matcha-icefall-zh-baker/lexicon.txt".into(), tokens: "./matcha-icefall-zh-baker/tokens.txt".into(), dict_dir: "./matcha-icefall-zh-baker/dict".into(), common_config: CommonTtsConfig { rule_fsts: "./matcha-icefall-zh-baker/phone.fst,./matcha-icefall-zh-baker/date.fst,./matcha-icefall-zh-baker/number.fst".into(), ..Default::default() }, ..Default::default() }; let mut tts = MatchaTts::new(config); let sid = 0; let audio = tts .create("某某银行的副行长和一些行政领导表示,他们去过长江和长白山; 经济不断增长。2024年12月31号,拨打110或者18920240511。123456块钱。", sid, 1.0) .unwrap(); sherpa_rs::write_audio_file("audio.wav", &audio.samples, audio.sample_rate).unwrap(); println!("Created audio.wav") } ``` So, how can I get fsts setup correctly to make tts generating numbers speech. Thanks.
1 条评论