This commit is contained in:
tuna2134
2024-09-13 10:28:50 +00:00
parent ed4d6e024e
commit 796c581e8a
2 changed files with 4 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ fn main() -> anyhow::Result<()> {
tts_holder.load_sbv2file(ident, fs::read(env::var("MODEL_PATH")?)?)?;
let audio = tts_holder.easy_synthesize(ident, &text, 0, tts::SynthesizeOptions::default())?;
fs::write("output.wav", &audio)?;
fs::write("output.wav", audio)?;
Ok(())
}

View File

@@ -213,7 +213,7 @@ impl TTSModelHolder {
) -> Result<Vec<u8>> {
let style_vector = self.get_style_vector(ident, style_id, options.style_weight)?;
let audio_array = if options.split_sentences {
let texts: Vec<&str> = text.split("\n").collect();
let texts: Vec<&str> = text.split('\n').collect();
let mut audios = vec![];
for (i, t) in texts.iter().enumerate() {
if t.is_empty() {
@@ -252,7 +252,7 @@ impl TTSModelHolder {
options.length_scale,
)?
};
Ok(Self::array_to_vec(audio_array)?)
Self::array_to_vec(audio_array)
}
fn array_to_vec(audio_array: Array3<f32>) -> Result<Vec<u8>> {
@@ -296,7 +296,7 @@ impl TTSModelHolder {
sdp_ratio,
length_scale,
)?;
Ok(Self::array_to_vec(audio_array)?)
Self::array_to_vec(audio_array)
}
}