mirror of
https://github.com/neodyland/sbv2-api.git
synced 2025-12-26 09:09:57 +00:00
Compare commits
1 Commits
commit-b00
...
renovate/e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef0b040c3d |
30
Cargo.lock
generated
30
Cargo.lock
generated
@@ -1425,9 +1425,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.27"
|
||||
version = "0.4.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||
|
||||
[[package]]
|
||||
name = "macro_rules_attribute"
|
||||
@@ -2312,20 +2312,6 @@ dependencies = [
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sbv2_editor"
|
||||
version = "0.2.0-alpha6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
"dotenvy",
|
||||
"env_logger",
|
||||
"log",
|
||||
"sbv2_core",
|
||||
"serde",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sbv2_wasm"
|
||||
version = "0.2.0-alpha6"
|
||||
@@ -2378,18 +2364,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.219"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2746,9 +2732,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.44.1"
|
||||
version = "1.43.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
|
||||
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["./crates/sbv2_api", "./crates/sbv2_core", "./crates/sbv2_bindings", "./crates/sbv2_wasm", "crates/sbv2_editor"]
|
||||
members = ["./crates/sbv2_api", "./crates/sbv2_core", "./crates/sbv2_bindings", "./crates/sbv2_wasm"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.2.0-alpha6"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::error::{Error, Result};
|
||||
use crate::mora::{CONSONANTS, MORA_KATA_TO_MORA_PHONEMES, MORA_PHONEMES_TO_MORA_KATA, VOWELS};
|
||||
use crate::mora::{MORA_KATA_TO_MORA_PHONEMES, VOWELS};
|
||||
use crate::norm::{replace_punctuation, PUNCTUATIONS};
|
||||
use jpreprocess::{kind, DefaultTokenizer, JPreprocess, SystemDictionaryConfig, UserDictionary};
|
||||
use once_cell::sync::Lazy;
|
||||
@@ -76,34 +76,6 @@ static MORA_PATTERN: Lazy<Vec<String>> = Lazy::new(|| {
|
||||
});
|
||||
static LONG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\w)(ー*)").unwrap());
|
||||
|
||||
fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)> {
|
||||
let phones = &phones[1..];
|
||||
let tones = &tones[1..];
|
||||
let mut results = Vec::new();
|
||||
let mut current_mora = String::new();
|
||||
for ((phone, next_phone), (&tone, &next_tone)) in phones
|
||||
.iter()
|
||||
.zip(phones.iter().skip(1))
|
||||
.zip(tones.iter().zip(tones.iter().skip(1)))
|
||||
{
|
||||
if PUNCTUATIONS.contains(&phone.clone().as_str()) {
|
||||
results.push((phone.to_string(), tone));
|
||||
continue;
|
||||
}
|
||||
if CONSONANTS.contains(&phone.clone()) {
|
||||
assert_eq!(current_mora, "");
|
||||
assert_eq!(tone, next_tone);
|
||||
current_mora = phone.to_string()
|
||||
} else {
|
||||
current_mora += phone;
|
||||
let kana = MORA_PHONEMES_TO_MORA_KATA.get(¤t_mora).unwrap();
|
||||
results.push((kana.to_string(), tone));
|
||||
current_mora = String::new();
|
||||
}
|
||||
}
|
||||
results
|
||||
}
|
||||
|
||||
pub struct JTalkProcess {
|
||||
jpreprocess: Arc<JPreprocessType>,
|
||||
parsed: Vec<String>,
|
||||
@@ -193,11 +165,6 @@ impl JTalkProcess {
|
||||
Ok((phones, tones, new_word2ph))
|
||||
}
|
||||
|
||||
pub fn g2kana_tone(&self) -> Result<Vec<(String, i32)>> {
|
||||
let (phones, tones, _) = self.g2p()?;
|
||||
Ok(phone_tone_to_kana(phones, tones))
|
||||
}
|
||||
|
||||
fn distribute_phone(n_phone: i32, n_word: i32) -> Vec<i32> {
|
||||
let mut phones_per_word = vec![0; n_word as usize];
|
||||
for _ in 0..n_phone {
|
||||
|
||||
@@ -30,7 +30,8 @@ fn main_inner() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let audio = tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?;
|
||||
let audio =
|
||||
tts_holder.easy_synthesize(ident, &text, 0, 0, tts::SynthesizeOptions::default())?;
|
||||
fs::write("output.wav", audio)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -25,21 +25,6 @@ static MORA_LIST_ADDITIONAL: Lazy<Vec<Mora>> = Lazy::new(|| {
|
||||
data.additional
|
||||
});
|
||||
|
||||
pub static MORA_PHONEMES_TO_MORA_KATA: Lazy<HashMap<String, String>> = Lazy::new(|| {
|
||||
let mut map = HashMap::new();
|
||||
for mora in MORA_LIST_MINIMUM.iter() {
|
||||
map.insert(
|
||||
format!(
|
||||
"{}{}",
|
||||
mora.consonant.clone().unwrap_or("".to_string()),
|
||||
mora.vowel
|
||||
),
|
||||
mora.mora.clone(),
|
||||
);
|
||||
}
|
||||
map
|
||||
});
|
||||
|
||||
pub static MORA_KATA_TO_MORA_PHONEMES: Lazy<HashMap<String, (Option<String>, String)>> =
|
||||
Lazy::new(|| {
|
||||
let mut map = HashMap::new();
|
||||
@@ -52,12 +37,4 @@ pub static MORA_KATA_TO_MORA_PHONEMES: Lazy<HashMap<String, (Option<String>, Str
|
||||
map
|
||||
});
|
||||
|
||||
pub static CONSONANTS: Lazy<Vec<String>> = Lazy::new(|| {
|
||||
let consonants = MORA_KATA_TO_MORA_PHONEMES
|
||||
.values()
|
||||
.filter_map(|(consonant, _)| consonant.clone())
|
||||
.collect::<Vec<_>>();
|
||||
consonants
|
||||
});
|
||||
|
||||
pub const VOWELS: [&str; 6] = ["a", "i", "u", "e", "o", "N"];
|
||||
|
||||
@@ -41,7 +41,7 @@ pub struct TTSModelHolder {
|
||||
tokenizer: Tokenizer,
|
||||
bert: Session,
|
||||
models: Vec<TTSModel>,
|
||||
pub jtalk: jtalk::JTalk,
|
||||
jtalk: jtalk::JTalk,
|
||||
max_loaded_models: Option<usize>,
|
||||
}
|
||||
|
||||
@@ -205,23 +205,6 @@ impl TTSModelHolder {
|
||||
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||
crate::tts_util::parse_text_blocking(
|
||||
text,
|
||||
None,
|
||||
&self.jtalk,
|
||||
&self.tokenizer,
|
||||
|token_ids, attention_masks| {
|
||||
crate::bert::predict(&mut self.bert, token_ids, attention_masks)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
pub fn parse_text_neo(
|
||||
&mut self,
|
||||
text: String,
|
||||
given_tones: Option<Vec<i32>>,
|
||||
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||
crate::tts_util::parse_text_blocking(
|
||||
&text,
|
||||
given_tones,
|
||||
&self.jtalk,
|
||||
&self.tokenizer,
|
||||
|token_ids, attention_masks| {
|
||||
@@ -364,79 +347,6 @@ impl TTSModelHolder {
|
||||
};
|
||||
tts_util::array_to_vec(audio_array)
|
||||
}
|
||||
|
||||
pub fn easy_synthesize_neo<I: Into<TTSIdent> + Copy>(
|
||||
&mut self,
|
||||
ident: I,
|
||||
text: &str,
|
||||
given_tones: Option<Vec<i32>>,
|
||||
style_id: i32,
|
||||
speaker_id: i64,
|
||||
options: SynthesizeOptions,
|
||||
) -> Result<Vec<u8>> {
|
||||
self.find_and_load_model(ident)?;
|
||||
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 mut audios = vec![];
|
||||
for (i, t) in texts.iter().enumerate() {
|
||||
if t.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let (bert_ori, phones, tones, lang_ids) =
|
||||
self.parse_text_neo(t.to_string(), given_tones.clone())?;
|
||||
|
||||
let vits2 = self
|
||||
.find_model(ident)?
|
||||
.vits2
|
||||
.as_mut()
|
||||
.ok_or(Error::ModelNotFoundError(ident.into().to_string()))?;
|
||||
let audio = model::synthesize(
|
||||
vits2,
|
||||
bert_ori.to_owned(),
|
||||
phones,
|
||||
Array1::from_vec(vec![speaker_id]),
|
||||
tones,
|
||||
lang_ids,
|
||||
style_vector.clone(),
|
||||
options.sdp_ratio,
|
||||
options.length_scale,
|
||||
0.677,
|
||||
0.8,
|
||||
)?;
|
||||
audios.push(audio.clone());
|
||||
if i != texts.len() - 1 {
|
||||
audios.push(Array3::zeros((1, 1, 22050)));
|
||||
}
|
||||
}
|
||||
concatenate(
|
||||
Axis(2),
|
||||
&audios.iter().map(|x| x.view()).collect::<Vec<_>>(),
|
||||
)?
|
||||
} else {
|
||||
let (bert_ori, phones, tones, lang_ids) = self.parse_text(text)?;
|
||||
|
||||
let vits2 = self
|
||||
.find_model(ident)?
|
||||
.vits2
|
||||
.as_mut()
|
||||
.ok_or(Error::ModelNotFoundError(ident.into().to_string()))?;
|
||||
model::synthesize(
|
||||
vits2,
|
||||
bert_ori.to_owned(),
|
||||
phones,
|
||||
Array1::from_vec(vec![speaker_id]),
|
||||
tones,
|
||||
lang_ids,
|
||||
style_vector,
|
||||
options.sdp_ratio,
|
||||
options.length_scale,
|
||||
0.677,
|
||||
0.8,
|
||||
)?
|
||||
};
|
||||
tts_util::array_to_vec(audio_array)
|
||||
}
|
||||
}
|
||||
|
||||
/// Synthesize options
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
use std::io::Cursor;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::jtalk::JTalkProcess;
|
||||
use crate::mora::MORA_KATA_TO_MORA_PHONEMES;
|
||||
use crate::norm::PUNCTUATIONS;
|
||||
use crate::{jtalk, nlp, norm, tokenizer, utils};
|
||||
use hound::{SampleFormat, WavSpec, WavWriter};
|
||||
use ndarray::{concatenate, s, Array, Array1, Array2, Array3, Axis};
|
||||
use tokenizers::Tokenizer;
|
||||
|
||||
pub fn preprocess_parse_text(text: &str, jtalk: &jtalk::JTalk) -> Result<(String, JTalkProcess)> {
|
||||
let text = jtalk.num2word(text)?;
|
||||
let normalized_text = norm::normalize_text(&text);
|
||||
|
||||
let process = jtalk.process_text(&normalized_text)?;
|
||||
Ok((normalized_text, process))
|
||||
}
|
||||
|
||||
/// Parse text and return the input for synthesize
|
||||
///
|
||||
/// # Note
|
||||
@@ -33,9 +21,13 @@ pub async fn parse_text(
|
||||
Box<dyn std::future::Future<Output = Result<ndarray::Array2<f32>>>>,
|
||||
>,
|
||||
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||
let (normalized_text, process) = preprocess_parse_text(text, jtalk)?;
|
||||
let text = jtalk.num2word(text)?;
|
||||
let normalized_text = norm::normalize_text(&text);
|
||||
|
||||
let process = jtalk.process_text(&normalized_text)?;
|
||||
let (phones, tones, mut word2ph) = process.g2p()?;
|
||||
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
||||
|
||||
let phones = utils::intersperse(&phones, 0);
|
||||
let tones = utils::intersperse(&tones, 0);
|
||||
let lang_ids = utils::intersperse(&lang_ids, 0);
|
||||
@@ -100,7 +92,6 @@ pub async fn parse_text(
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn parse_text_blocking(
|
||||
text: &str,
|
||||
given_tones: Option<Vec<i32>>,
|
||||
jtalk: &jtalk::JTalk,
|
||||
tokenizer: &Tokenizer,
|
||||
bert_predict: impl FnOnce(Vec<i64>, Vec<i64>) -> Result<ndarray::Array2<f32>>,
|
||||
@@ -109,10 +100,7 @@ pub fn parse_text_blocking(
|
||||
let normalized_text = norm::normalize_text(&text);
|
||||
|
||||
let process = jtalk.process_text(&normalized_text)?;
|
||||
let (phones, mut tones, mut word2ph) = process.g2p()?;
|
||||
if let Some(given_tones) = given_tones {
|
||||
tones = given_tones;
|
||||
}
|
||||
let (phones, tones, mut word2ph) = process.g2p()?;
|
||||
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
||||
|
||||
let phones = utils::intersperse(&phones, 0);
|
||||
@@ -190,23 +178,3 @@ pub fn array_to_vec(audio_array: Array3<f32>) -> Result<Vec<u8>> {
|
||||
writer.finalize()?;
|
||||
Ok(cursor.into_inner())
|
||||
}
|
||||
|
||||
pub fn kata_tone2phone_tone(kata_tone: Vec<(String, i32)>) -> Vec<(String, i32)> {
|
||||
let mut results = vec![("_".to_string(), 0)];
|
||||
for (mora, tone) in kata_tone {
|
||||
if PUNCTUATIONS.contains(&mora.as_str()) {
|
||||
results.push((mora, 0));
|
||||
continue;
|
||||
} else {
|
||||
let (consonant, vowel) = MORA_KATA_TO_MORA_PHONEMES.get(&mora).unwrap();
|
||||
if let Some(consonant) = consonant {
|
||||
results.push((consonant.to_string(), tone));
|
||||
results.push((vowel.to_string(), tone));
|
||||
} else {
|
||||
results.push((vowel.to_string(), tone));
|
||||
}
|
||||
}
|
||||
}
|
||||
results.push(("_".to_string(), 0));
|
||||
results
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[package]
|
||||
name = "sbv2_editor"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
license.workspace = true
|
||||
readme.workspace = true
|
||||
repository.workspace = true
|
||||
documentation.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
axum = "0.8.1"
|
||||
dotenvy.workspace = true
|
||||
env_logger.workspace = true
|
||||
log = "0.4.27"
|
||||
sbv2_core = { version = "0.2.0-alpha6", path = "../sbv2_core", features = ["aivmx"] }
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
@@ -1,2 +0,0 @@
|
||||
# sbv2-voicevox
|
||||
sbv2-apiをvoicevox化します。
|
||||
@@ -1,226 +0,0 @@
|
||||
{
|
||||
"accent_phrases": [
|
||||
{
|
||||
"moras": [
|
||||
{
|
||||
"text": "コ",
|
||||
"consonant": "k",
|
||||
"consonant_length": 0.10002632439136505,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.15740256011486053,
|
||||
"pitch": 5.749961853027344
|
||||
},
|
||||
{
|
||||
"text": "ン",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "N",
|
||||
"vowel_length": 0.08265873789787292,
|
||||
"pitch": 5.89122200012207
|
||||
},
|
||||
{
|
||||
"text": "ニ",
|
||||
"consonant": "n",
|
||||
"consonant_length": 0.03657080978155136,
|
||||
"vowel": "i",
|
||||
"vowel_length": 0.1175866425037384,
|
||||
"pitch": 5.969866752624512
|
||||
},
|
||||
{
|
||||
"text": "チ",
|
||||
"consonant": "ch",
|
||||
"consonant_length": 0.09005842357873917,
|
||||
"vowel": "i",
|
||||
"vowel_length": 0.08666137605905533,
|
||||
"pitch": 5.958892822265625
|
||||
},
|
||||
{
|
||||
"text": "ワ",
|
||||
"consonant": "w",
|
||||
"consonant_length": 0.07833231985569,
|
||||
"vowel": "a",
|
||||
"vowel_length": 0.21250136196613312,
|
||||
"pitch": 5.949411392211914
|
||||
}
|
||||
],
|
||||
"accent": 5,
|
||||
"pause_mora": {
|
||||
"text": "、",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "pau",
|
||||
"vowel_length": 0.4723339378833771,
|
||||
"pitch": 0.0
|
||||
},
|
||||
"is_interrogative": false
|
||||
},
|
||||
{
|
||||
"moras": [
|
||||
{
|
||||
"text": "オ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.22004225850105286,
|
||||
"pitch": 5.6870927810668945
|
||||
},
|
||||
{
|
||||
"text": "ン",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "N",
|
||||
"vowel_length": 0.09161105751991272,
|
||||
"pitch": 5.93472957611084
|
||||
},
|
||||
{
|
||||
"text": "セ",
|
||||
"consonant": "s",
|
||||
"consonant_length": 0.08924821764230728,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.14142127335071564,
|
||||
"pitch": 6.121850490570068
|
||||
},
|
||||
{
|
||||
"text": "エ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.10636933892965317,
|
||||
"pitch": 6.157896041870117
|
||||
},
|
||||
{
|
||||
"text": "ゴ",
|
||||
"consonant": "g",
|
||||
"consonant_length": 0.07600915431976318,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.09598273783922195,
|
||||
"pitch": 6.188933849334717
|
||||
},
|
||||
{
|
||||
"text": "オ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.1079121008515358,
|
||||
"pitch": 6.235202789306641
|
||||
},
|
||||
{
|
||||
"text": "セ",
|
||||
"consonant": "s",
|
||||
"consonant_length": 0.09591838717460632,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.10286372154951096,
|
||||
"pitch": 6.153214454650879
|
||||
},
|
||||
{
|
||||
"text": "エ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.08992656320333481,
|
||||
"pitch": 6.02571439743042
|
||||
},
|
||||
{
|
||||
"text": "ノ",
|
||||
"consonant": "n",
|
||||
"consonant_length": 0.05660202354192734,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.09676017612218857,
|
||||
"pitch": 5.711844444274902
|
||||
}
|
||||
],
|
||||
"accent": 5,
|
||||
"pause_mora": null,
|
||||
"is_interrogative": false
|
||||
},
|
||||
{
|
||||
"moras": [
|
||||
{
|
||||
"text": "セ",
|
||||
"consonant": "s",
|
||||
"consonant_length": 0.07805486768484116,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.09617523103952408,
|
||||
"pitch": 5.774399280548096
|
||||
},
|
||||
{
|
||||
"text": "カ",
|
||||
"consonant": "k",
|
||||
"consonant_length": 0.06712044775485992,
|
||||
"vowel": "a",
|
||||
"vowel_length": 0.148829385638237,
|
||||
"pitch": 6.063965797424316
|
||||
},
|
||||
{
|
||||
"text": "イ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "i",
|
||||
"vowel_length": 0.11061104387044907,
|
||||
"pitch": 6.040698051452637
|
||||
},
|
||||
{
|
||||
"text": "エ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "e",
|
||||
"vowel_length": 0.13046696782112122,
|
||||
"pitch": 5.806027889251709
|
||||
}
|
||||
],
|
||||
"accent": 1,
|
||||
"pause_mora": null,
|
||||
"is_interrogative": false
|
||||
},
|
||||
{
|
||||
"moras": [
|
||||
{
|
||||
"text": "ヨ",
|
||||
"consonant": "y",
|
||||
"consonant_length": 0.07194744795560837,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.08622600883245468,
|
||||
"pitch": 5.694094657897949
|
||||
},
|
||||
{
|
||||
"text": "オ",
|
||||
"consonant": null,
|
||||
"consonant_length": null,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.10635452717542648,
|
||||
"pitch": 5.787222385406494
|
||||
},
|
||||
{
|
||||
"text": "コ",
|
||||
"consonant": "k",
|
||||
"consonant_length": 0.07077334076166153,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.09248624742031097,
|
||||
"pitch": 5.793357849121094
|
||||
},
|
||||
{
|
||||
"text": "ソ",
|
||||
"consonant": "s",
|
||||
"consonant_length": 0.08705667406320572,
|
||||
"vowel": "o",
|
||||
"vowel_length": 0.2238258570432663,
|
||||
"pitch": 5.643765449523926
|
||||
}
|
||||
],
|
||||
"accent": 1,
|
||||
"pause_mora": null,
|
||||
"is_interrogative": false
|
||||
}
|
||||
],
|
||||
"speedScale": 1.0,
|
||||
"pitchScale": 0.0,
|
||||
"intonationScale": 1.0,
|
||||
"volumeScale": 1.0,
|
||||
"prePhonemeLength": 0.1,
|
||||
"postPhonemeLength": 0.1,
|
||||
"pauseLength": null,
|
||||
"pauseLengthScale": 1.0,
|
||||
"outputSamplingRate": 24000,
|
||||
"outputStereo": false,
|
||||
"kana": "コンニチワ'、オンセエゴ'オセエノ/セ'カイエ/ヨ'オコソ"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
|
||||
pub type AppResult<T> = std::result::Result<T, AppError>;
|
||||
|
||||
pub struct AppError(anyhow::Error);
|
||||
|
||||
impl IntoResponse for AppError {
|
||||
fn into_response(self) -> Response {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Something went wrong: {}", self.0),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
}
|
||||
|
||||
impl<E> From<E> for AppError
|
||||
where
|
||||
E: Into<anyhow::Error>,
|
||||
{
|
||||
fn from(err: E) -> Self {
|
||||
Self(err.into())
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
use axum::extract::State;
|
||||
use axum::{
|
||||
extract::Query,
|
||||
http::header::CONTENT_TYPE,
|
||||
response::IntoResponse,
|
||||
routing::{get, post},
|
||||
Json, Router,
|
||||
};
|
||||
use sbv2_core::tts_util::kata_tone2phone_tone;
|
||||
use sbv2_core::{
|
||||
tts::{SynthesizeOptions, TTSModelHolder},
|
||||
tts_util::preprocess_parse_text,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::{fs, net::TcpListener, sync::Mutex};
|
||||
|
||||
use std::env;
|
||||
use std::sync::Arc;
|
||||
|
||||
use error::AppResult;
|
||||
|
||||
mod error;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct RequestCreateAudioQuery {
|
||||
text: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct AudioQuery {
|
||||
kana: String,
|
||||
tone: i32,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ResponseCreateAudioQuery {
|
||||
audio_query: Vec<AudioQuery>,
|
||||
text: String,
|
||||
}
|
||||
|
||||
async fn create_audio_query(
|
||||
State(state): State<AppState>,
|
||||
Query(request): Query<RequestCreateAudioQuery>,
|
||||
) -> AppResult<impl IntoResponse> {
|
||||
let (text, process) = {
|
||||
let tts_model = state.tts_model.lock().await;
|
||||
preprocess_parse_text(&request.text, &tts_model.jtalk)?
|
||||
};
|
||||
let kana_tone_list = process.g2kana_tone()?;
|
||||
let audio_query = kana_tone_list
|
||||
.iter()
|
||||
.map(|(kana, tone)| AudioQuery {
|
||||
kana: kana.clone(),
|
||||
tone: *tone,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
Ok(Json(ResponseCreateAudioQuery { audio_query, text }))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct RequestSynthesis {
|
||||
text: String,
|
||||
speaker_id: i64,
|
||||
sdp_ratio: f32,
|
||||
length_scale: f32,
|
||||
style_id: i32,
|
||||
audio_query: Vec<AudioQuery>,
|
||||
ident: String,
|
||||
}
|
||||
|
||||
async fn synthesis(
|
||||
State(state): State<AppState>,
|
||||
Json(request): Json<RequestSynthesis>,
|
||||
) -> AppResult<impl IntoResponse> {
|
||||
let phone_tone = request
|
||||
.audio_query
|
||||
.iter()
|
||||
.map(|query| (query.kana.clone(), query.tone))
|
||||
.collect::<Vec<_>>();
|
||||
let phone_tone = kata_tone2phone_tone(phone_tone);
|
||||
let tones = phone_tone.iter().map(|(_, tone)| *tone).collect::<Vec<_>>();
|
||||
let buffer = {
|
||||
let mut tts_model = state.tts_model.lock().await;
|
||||
tts_model.easy_synthesize_neo(
|
||||
&request.ident,
|
||||
&request.text,
|
||||
Some(tones),
|
||||
request.style_id,
|
||||
request.speaker_id,
|
||||
SynthesizeOptions {
|
||||
sdp_ratio: request.sdp_ratio,
|
||||
length_scale: request.length_scale,
|
||||
..Default::default()
|
||||
},
|
||||
)?
|
||||
};
|
||||
Ok(([(CONTENT_TYPE, "audio/wav")], buffer))
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct AppState {
|
||||
tts_model: Arc<Mutex<TTSModelHolder>>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub async fn new() -> anyhow::Result<Self> {
|
||||
let mut tts_model = TTSModelHolder::new(
|
||||
&fs::read(env::var("BERT_MODEL_PATH")?).await?,
|
||||
&fs::read(env::var("TOKENIZER_PATH")?).await?,
|
||||
env::var("HOLDER_MAX_LOADED_MODElS")
|
||||
.ok()
|
||||
.and_then(|x| x.parse().ok()),
|
||||
)?;
|
||||
let models = env::var("MODELS_PATH").unwrap_or("models".to_string());
|
||||
let mut f = fs::read_dir(&models).await?;
|
||||
let mut entries = vec![];
|
||||
while let Ok(Some(e)) = f.next_entry().await {
|
||||
let name = e.file_name().to_string_lossy().to_string();
|
||||
if name.ends_with(".onnx") && name.starts_with("model_") {
|
||||
let name_len = name.len();
|
||||
let name = name.chars();
|
||||
entries.push(
|
||||
name.collect::<Vec<_>>()[6..name_len - 5]
|
||||
.iter()
|
||||
.collect::<String>(),
|
||||
);
|
||||
} else if name.ends_with(".sbv2") {
|
||||
let entry = &name[..name.len() - 5];
|
||||
log::info!("Try loading: {entry}");
|
||||
let sbv2_bytes = match fs::read(format!("{models}/{entry}.sbv2")).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::warn!("Error loading sbv2_bytes from file {entry}: {e}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if let Err(e) = tts_model.load_sbv2file(entry, sbv2_bytes) {
|
||||
log::warn!("Error loading {entry}: {e}");
|
||||
};
|
||||
log::info!("Loaded: {entry}");
|
||||
} else if name.ends_with(".aivmx") {
|
||||
let entry = &name[..name.len() - 6];
|
||||
log::info!("Try loading: {entry}");
|
||||
let aivmx_bytes = match fs::read(format!("{models}/{entry}.aivmx")).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::warn!("Error loading aivmx bytes from file {entry}: {e}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if let Err(e) = tts_model.load_aivmx(entry, aivmx_bytes) {
|
||||
log::error!("Error loading {entry}: {e}");
|
||||
}
|
||||
log::info!("Loaded: {entry}");
|
||||
}
|
||||
}
|
||||
for entry in entries {
|
||||
log::info!("Try loading: {entry}");
|
||||
let style_vectors_bytes =
|
||||
match fs::read(format!("{models}/style_vectors_{entry}.json")).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::warn!("Error loading style_vectors_bytes from file {entry}: {e}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let vits2_bytes = match fs::read(format!("{models}/model_{entry}.onnx")).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::warn!("Error loading vits2_bytes from file {entry}: {e}");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if let Err(e) = tts_model.load(&entry, style_vectors_bytes, vits2_bytes) {
|
||||
log::warn!("Error loading {entry}: {e}");
|
||||
};
|
||||
log::info!("Loaded: {entry}");
|
||||
}
|
||||
Ok(Self {
|
||||
tts_model: Arc::new(Mutex::new(tts_model)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
dotenvy::dotenv_override().ok();
|
||||
env_logger::init();
|
||||
let app = Router::new()
|
||||
.route("/", get(|| async { "Hello, world!" }))
|
||||
.route("/audio_query", get(create_audio_query))
|
||||
.route("/synthesis", post(synthesis))
|
||||
.with_state(AppState::new().await?);
|
||||
let listener = TcpListener::bind("0.0.0.0:8080").await?;
|
||||
axum::serve(listener, app).await?;
|
||||
Ok(())
|
||||
}
|
||||
208
crates/sbv2_wasm/pnpm-lock.yaml
generated
208
crates/sbv2_wasm/pnpm-lock.yaml
generated
@@ -20,7 +20,7 @@ importers:
|
||||
version: 22.13.5
|
||||
esbuild:
|
||||
specifier: ^0.25.0
|
||||
version: 0.25.0
|
||||
version: 0.25.2
|
||||
typescript:
|
||||
specifier: ^5.7.3
|
||||
version: 5.7.3
|
||||
@@ -80,152 +80,152 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/aix-ppc64@0.25.0':
|
||||
resolution: {integrity: sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==}
|
||||
'@esbuild/aix-ppc64@0.25.2':
|
||||
resolution: {integrity: sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ppc64]
|
||||
os: [aix]
|
||||
|
||||
'@esbuild/android-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==}
|
||||
'@esbuild/android-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/android-arm@0.25.0':
|
||||
resolution: {integrity: sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==}
|
||||
'@esbuild/android-arm@0.25.2':
|
||||
resolution: {integrity: sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/android-x64@0.25.0':
|
||||
resolution: {integrity: sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==}
|
||||
'@esbuild/android-x64@0.25.2':
|
||||
resolution: {integrity: sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/darwin-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==}
|
||||
'@esbuild/darwin-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@esbuild/darwin-x64@0.25.0':
|
||||
resolution: {integrity: sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==}
|
||||
'@esbuild/darwin-x64@0.25.2':
|
||||
resolution: {integrity: sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@esbuild/freebsd-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==}
|
||||
'@esbuild/freebsd-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
|
||||
'@esbuild/freebsd-x64@0.25.0':
|
||||
resolution: {integrity: sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==}
|
||||
'@esbuild/freebsd-x64@0.25.2':
|
||||
resolution: {integrity: sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@esbuild/linux-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==}
|
||||
'@esbuild/linux-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-arm@0.25.0':
|
||||
resolution: {integrity: sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==}
|
||||
'@esbuild/linux-arm@0.25.2':
|
||||
resolution: {integrity: sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-ia32@0.25.0':
|
||||
resolution: {integrity: sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==}
|
||||
'@esbuild/linux-ia32@0.25.2':
|
||||
resolution: {integrity: sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ia32]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-loong64@0.25.0':
|
||||
resolution: {integrity: sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==}
|
||||
'@esbuild/linux-loong64@0.25.2':
|
||||
resolution: {integrity: sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-mips64el@0.25.0':
|
||||
resolution: {integrity: sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==}
|
||||
'@esbuild/linux-mips64el@0.25.2':
|
||||
resolution: {integrity: sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-ppc64@0.25.0':
|
||||
resolution: {integrity: sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==}
|
||||
'@esbuild/linux-ppc64@0.25.2':
|
||||
resolution: {integrity: sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-riscv64@0.25.0':
|
||||
resolution: {integrity: sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==}
|
||||
'@esbuild/linux-riscv64@0.25.2':
|
||||
resolution: {integrity: sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-s390x@0.25.0':
|
||||
resolution: {integrity: sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==}
|
||||
'@esbuild/linux-s390x@0.25.2':
|
||||
resolution: {integrity: sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-x64@0.25.0':
|
||||
resolution: {integrity: sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==}
|
||||
'@esbuild/linux-x64@0.25.2':
|
||||
resolution: {integrity: sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/netbsd-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==}
|
||||
'@esbuild/netbsd-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [netbsd]
|
||||
|
||||
'@esbuild/netbsd-x64@0.25.0':
|
||||
resolution: {integrity: sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==}
|
||||
'@esbuild/netbsd-x64@0.25.2':
|
||||
resolution: {integrity: sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
|
||||
'@esbuild/openbsd-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==}
|
||||
'@esbuild/openbsd-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [openbsd]
|
||||
|
||||
'@esbuild/openbsd-x64@0.25.0':
|
||||
resolution: {integrity: sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==}
|
||||
'@esbuild/openbsd-x64@0.25.2':
|
||||
resolution: {integrity: sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
|
||||
'@esbuild/sunos-x64@0.25.0':
|
||||
resolution: {integrity: sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==}
|
||||
'@esbuild/sunos-x64@0.25.2':
|
||||
resolution: {integrity: sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
|
||||
'@esbuild/win32-arm64@0.25.0':
|
||||
resolution: {integrity: sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==}
|
||||
'@esbuild/win32-arm64@0.25.2':
|
||||
resolution: {integrity: sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/win32-ia32@0.25.0':
|
||||
resolution: {integrity: sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==}
|
||||
'@esbuild/win32-ia32@0.25.2':
|
||||
resolution: {integrity: sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/win32-x64@0.25.0':
|
||||
resolution: {integrity: sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==}
|
||||
'@esbuild/win32-x64@0.25.2':
|
||||
resolution: {integrity: sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
@@ -263,8 +263,8 @@ packages:
|
||||
'@types/node@22.13.5':
|
||||
resolution: {integrity: sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==}
|
||||
|
||||
esbuild@0.25.0:
|
||||
resolution: {integrity: sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==}
|
||||
esbuild@0.25.2:
|
||||
resolution: {integrity: sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
@@ -335,79 +335,79 @@ snapshots:
|
||||
'@biomejs/cli-win32-x64@1.9.4':
|
||||
optional: true
|
||||
|
||||
'@esbuild/aix-ppc64@0.25.0':
|
||||
'@esbuild/aix-ppc64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-arm64@0.25.0':
|
||||
'@esbuild/android-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-arm@0.25.0':
|
||||
'@esbuild/android-arm@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-x64@0.25.0':
|
||||
'@esbuild/android-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/darwin-arm64@0.25.0':
|
||||
'@esbuild/darwin-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/darwin-x64@0.25.0':
|
||||
'@esbuild/darwin-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/freebsd-arm64@0.25.0':
|
||||
'@esbuild/freebsd-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/freebsd-x64@0.25.0':
|
||||
'@esbuild/freebsd-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-arm64@0.25.0':
|
||||
'@esbuild/linux-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-arm@0.25.0':
|
||||
'@esbuild/linux-arm@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-ia32@0.25.0':
|
||||
'@esbuild/linux-ia32@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-loong64@0.25.0':
|
||||
'@esbuild/linux-loong64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-mips64el@0.25.0':
|
||||
'@esbuild/linux-mips64el@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-ppc64@0.25.0':
|
||||
'@esbuild/linux-ppc64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-riscv64@0.25.0':
|
||||
'@esbuild/linux-riscv64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-s390x@0.25.0':
|
||||
'@esbuild/linux-s390x@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-x64@0.25.0':
|
||||
'@esbuild/linux-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/netbsd-arm64@0.25.0':
|
||||
'@esbuild/netbsd-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/netbsd-x64@0.25.0':
|
||||
'@esbuild/netbsd-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/openbsd-arm64@0.25.0':
|
||||
'@esbuild/openbsd-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/openbsd-x64@0.25.0':
|
||||
'@esbuild/openbsd-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/sunos-x64@0.25.0':
|
||||
'@esbuild/sunos-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-arm64@0.25.0':
|
||||
'@esbuild/win32-arm64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-ia32@0.25.0':
|
||||
'@esbuild/win32-ia32@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-x64@0.25.0':
|
||||
'@esbuild/win32-x64@0.25.2':
|
||||
optional: true
|
||||
|
||||
'@protobufjs/aspromise@1.1.2': {}
|
||||
@@ -437,33 +437,33 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 6.20.0
|
||||
|
||||
esbuild@0.25.0:
|
||||
esbuild@0.25.2:
|
||||
optionalDependencies:
|
||||
'@esbuild/aix-ppc64': 0.25.0
|
||||
'@esbuild/android-arm': 0.25.0
|
||||
'@esbuild/android-arm64': 0.25.0
|
||||
'@esbuild/android-x64': 0.25.0
|
||||
'@esbuild/darwin-arm64': 0.25.0
|
||||
'@esbuild/darwin-x64': 0.25.0
|
||||
'@esbuild/freebsd-arm64': 0.25.0
|
||||
'@esbuild/freebsd-x64': 0.25.0
|
||||
'@esbuild/linux-arm': 0.25.0
|
||||
'@esbuild/linux-arm64': 0.25.0
|
||||
'@esbuild/linux-ia32': 0.25.0
|
||||
'@esbuild/linux-loong64': 0.25.0
|
||||
'@esbuild/linux-mips64el': 0.25.0
|
||||
'@esbuild/linux-ppc64': 0.25.0
|
||||
'@esbuild/linux-riscv64': 0.25.0
|
||||
'@esbuild/linux-s390x': 0.25.0
|
||||
'@esbuild/linux-x64': 0.25.0
|
||||
'@esbuild/netbsd-arm64': 0.25.0
|
||||
'@esbuild/netbsd-x64': 0.25.0
|
||||
'@esbuild/openbsd-arm64': 0.25.0
|
||||
'@esbuild/openbsd-x64': 0.25.0
|
||||
'@esbuild/sunos-x64': 0.25.0
|
||||
'@esbuild/win32-arm64': 0.25.0
|
||||
'@esbuild/win32-ia32': 0.25.0
|
||||
'@esbuild/win32-x64': 0.25.0
|
||||
'@esbuild/aix-ppc64': 0.25.2
|
||||
'@esbuild/android-arm': 0.25.2
|
||||
'@esbuild/android-arm64': 0.25.2
|
||||
'@esbuild/android-x64': 0.25.2
|
||||
'@esbuild/darwin-arm64': 0.25.2
|
||||
'@esbuild/darwin-x64': 0.25.2
|
||||
'@esbuild/freebsd-arm64': 0.25.2
|
||||
'@esbuild/freebsd-x64': 0.25.2
|
||||
'@esbuild/linux-arm': 0.25.2
|
||||
'@esbuild/linux-arm64': 0.25.2
|
||||
'@esbuild/linux-ia32': 0.25.2
|
||||
'@esbuild/linux-loong64': 0.25.2
|
||||
'@esbuild/linux-mips64el': 0.25.2
|
||||
'@esbuild/linux-ppc64': 0.25.2
|
||||
'@esbuild/linux-riscv64': 0.25.2
|
||||
'@esbuild/linux-s390x': 0.25.2
|
||||
'@esbuild/linux-x64': 0.25.2
|
||||
'@esbuild/netbsd-arm64': 0.25.2
|
||||
'@esbuild/netbsd-x64': 0.25.2
|
||||
'@esbuild/openbsd-arm64': 0.25.2
|
||||
'@esbuild/openbsd-x64': 0.25.2
|
||||
'@esbuild/sunos-x64': 0.25.2
|
||||
'@esbuild/win32-arm64': 0.25.2
|
||||
'@esbuild/win32-ia32': 0.25.2
|
||||
'@esbuild/win32-x64': 0.25.2
|
||||
|
||||
flatbuffers@1.12.0: {}
|
||||
|
||||
|
||||
19
test.py
19
test.py
@@ -1,19 +0,0 @@
|
||||
import requests
|
||||
|
||||
|
||||
data = (requests.get("http://localhost:8080/audio_query", params={
|
||||
"text": "こんにちは、今日はいい天気ですね。",
|
||||
})).json()
|
||||
print(data)
|
||||
|
||||
data = (requests.post("http://localhost:8080/synthesis", json={
|
||||
"text": data["text"],
|
||||
"ident": "tsukuyomi",
|
||||
"speaker_id": 0,
|
||||
"style_id": 0,
|
||||
"sdp_ratio": 0.5,
|
||||
"length_scale": 0.5,
|
||||
"audio_query": data["audio_query"],
|
||||
})).content
|
||||
with open("test.wav", "wb") as f:
|
||||
f.write(data)
|
||||
Reference in New Issue
Block a user