mirror of
https://github.com/neodyland/sbv2-api.git
synced 2026-01-09 07:52:57 +00:00
add options args
This commit is contained in:
@@ -24,8 +24,7 @@ fn main() -> anyhow::Result<()> {
|
||||
tones.clone(),
|
||||
lang_ids.clone(),
|
||||
style_vector.clone(),
|
||||
0.0,
|
||||
0.5,
|
||||
tts::SynthesizeOptions::default(),
|
||||
)?;
|
||||
std::fs::write("output.wav", data)?;
|
||||
let now = Instant::now();
|
||||
@@ -45,8 +44,7 @@ fn main() -> anyhow::Result<()> {
|
||||
tones.clone(),
|
||||
lang_ids.clone(),
|
||||
style_vector.clone(),
|
||||
0.0,
|
||||
1.0,
|
||||
tts::SynthesizeOptions::default(),
|
||||
)?;
|
||||
}
|
||||
println!(
|
||||
|
||||
@@ -206,8 +206,7 @@ impl TTSModelHolder {
|
||||
tones: Array1<i64>,
|
||||
lang_ids: Array1<i64>,
|
||||
style_vector: Array1<f32>,
|
||||
sdp_ratio: f32,
|
||||
length_scale: f32,
|
||||
options: SynthesizeOptions,
|
||||
) -> Result<Vec<u8>> {
|
||||
let buffer = model::synthesize(
|
||||
&self.find_model(ident)?.vits2,
|
||||
@@ -216,9 +215,25 @@ impl TTSModelHolder {
|
||||
tones,
|
||||
lang_ids,
|
||||
style_vector,
|
||||
sdp_ratio,
|
||||
length_scale,
|
||||
options.sdp_ratio,
|
||||
options.length_scale,
|
||||
)?;
|
||||
Ok(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SynthesizeOptions {
|
||||
sdp_ratio: f32,
|
||||
length_scale: f32,
|
||||
split_sentences: bool,
|
||||
}
|
||||
|
||||
impl Default for SynthesizeOptions {
|
||||
fn default() -> Self {
|
||||
SynthesizeOptions {
|
||||
sdp_ratio: 0.0,
|
||||
length_scale: 1.0,
|
||||
split_sentences: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user