From 22d77a7c955f2b8b4351aeb425f3ca5c87ea70f1 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 28 Oct 2016 00:01:57 -0400 Subject: [PATCH] Remove old "diphones" param, add (unused) syllables param --- src/handlers/audio_synth_handler.rs | 21 +++++++++++---------- src/synthesis/synthesizer.rs | 22 +++------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/handlers/audio_synth_handler.rs b/src/handlers/audio_synth_handler.rs index 76d2e176ef..1d3798763b 100644 --- a/src/handlers/audio_synth_handler.rs +++ b/src/handlers/audio_synth_handler.rs @@ -32,7 +32,7 @@ const SENTENCE_PARAM : &'static str = "s"; const SPEAKER_PARAM : &'static str = "v"; const SPEED_PARAM : &'static str = "spd"; const USE_PHONEMES_PARAM: &'static str = "up"; -const USE_DIPHONES_PARAM: &'static str = "ud"; +const USE_SYLLABLES_PARAM: &'static str = "us"; const USE_N_PHONES_PARAM: &'static str = "un"; const USE_WORDS_PARAM: &'static str = "uw"; const USE_ENDS_PARAM: &'static str = "ue"; @@ -63,12 +63,12 @@ struct SpeakRequest { /** Whether to use phonemes. */ pub use_phonemes: bool, - /** Whether to use diphones. */ - pub use_diphones: bool, - /** Whether to use n-phones. */ pub use_n_phones: bool, + /** Whether to use syllable boundaries. */ + pub use_syllables: bool, + /** Whether to use words. */ pub use_words: bool, @@ -147,8 +147,8 @@ impl SpeakRequest { }); let use_phonemes = get_bool(params, USE_PHONEMES_PARAM).unwrap_or(true); - let use_diphones = get_bool(params, USE_DIPHONES_PARAM).unwrap_or(true); let use_n_phones = get_bool(params, USE_N_PHONES_PARAM).unwrap_or(true); + let use_syllables = get_bool(params, USE_SYLLABLES_PARAM).unwrap_or(true); let use_words = get_bool(params, USE_WORDS_PARAM).unwrap_or(true); let use_ends = get_bool(params, USE_ENDS_PARAM).unwrap_or(true); @@ -164,8 +164,8 @@ impl SpeakRequest { volume: volume, speed: speed, use_phonemes: use_phonemes, - use_diphones: use_diphones, use_n_phones: use_n_phones, + use_syllables: use_syllables, use_words: use_words, use_ends: use_ends, monophone_padding_start: mps, @@ -247,8 +247,8 @@ impl AudioSynthHandler { let params = SynthesisParams { use_words: request.use_words, use_phonemes: request.use_phonemes, - use_diphones: request.use_diphones, use_n_phones: request.use_n_phones, + use_syllables: request.use_syllables, use_ends: request.use_ends, volume: request.volume, speed: request.speed, @@ -283,9 +283,10 @@ impl AudioSynthHandler { let mut use_byte = 0u8; if request.use_phonemes { use_byte |= 1 << 1; } - if request.use_diphones { use_byte |= 1 << 2; } - if request.use_words { use_byte |= 1 << 3; } - if request.use_ends { use_byte |= 1 << 4; } + if request.use_n_phones { use_byte |= 1 << 2; } + if request.use_syllables { use_byte |= 1 << 3; } + if request.use_words { use_byte |= 1 << 4; } + if request.use_ends { use_byte |= 1 << 5; } hasher.input(&[use_byte]); diff --git a/src/synthesis/synthesizer.rs b/src/synthesis/synthesizer.rs index c1056c7221..7be30d6e7b 100644 --- a/src/synthesis/synthesizer.rs +++ b/src/synthesis/synthesizer.rs @@ -22,8 +22,8 @@ pub type WavBytes = Vec; pub struct SynthesisParams { pub use_words: bool, pub use_phonemes: bool, - pub use_diphones: bool, pub use_n_phones: bool, + pub use_syllables: bool, pub use_ends: bool, pub volume: Option, pub speed: Option, @@ -167,7 +167,7 @@ impl Synthesizer { self.concatenate_polyphone(concatenated_waveform, speaker, word, - params.use_diphones, + params.use_syllables, params.monophone_padding_start, params.monophone_padding_end, params.polyphone_padding_end); @@ -213,7 +213,7 @@ impl Synthesizer { concatenated_waveform: &mut Vec, speaker: &Speaker, word: &str, - use_diphones: bool, + _use_syllables: bool, monophone_padding_start: Option, monophone_padding_end: Option, polyphone_padding_end: Option) -> bool { @@ -256,22 +256,6 @@ impl Synthesizer { let phoneme = &polyphone[i]; - // Attempt to read a diphone. - if use_diphones && i < end { - let first = phoneme; - let second = &polyphone[i+1]; - match self.audiobank.get_diphone(speaker.as_str(), first, second) { - None => {}, - Some(diphone_data) => { - info!(target: "synthesis", - "Read diphone: {}, {}", first, second); - skip_next = true; - concatenated_waveform.extend(diphone_data); - continue; - }, - } - } - // Attempt to read a "begin" or "end" monophone. let mut read_results = if i == 0 { self.audiobank.get_begin_phoneme(speaker.as_str(), &phoneme)