Remove old "diphones" param, add (unused) syllables param

This commit is contained in:
Brandon Thomas committed 2016-10-28 00:01:57 -04:00
1 parent 63d6b3257f
commit 22d77a7c95
2 files changed
+14 -29

No files matched your search

+11 -10
View File
@@ -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]);
+3 -19
View File
@@ -22,8 +22,8 @@ pub type WavBytes = Vec<u8>;
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<f32>,
pub speed: Option<f32>,
@@ -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<i16>,
speaker: &Speaker,
word: &str,
use_diphones: bool,
_use_syllables: bool,
monophone_padding_start: Option<u16>,
monophone_padding_end: Option<u16>,
polyphone_padding_end: Option<u16>) -> 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)