add static to unmapped (word->phonemes)

This commit is contained in:
Brandon Thomas committed 2016-08-24 03:36:24 -04:00
1 parent 9f3b0b8059
commit 6c0c0118ff
3 files changed
+39 -1

No files matched your search

+27
View File
@@ -91,6 +91,33 @@ impl Audiobank {
Some(all_samples)
}
/**
* Get the miscellaneous sound effect file.
*/
pub fn get_misc(&self, name: &str) -> Option<Vec<i16>> {
if check_path(name).is_err() {
return None;
}
let path = self.audio_path.join("misc/")
.join(format!("{}.wav", name));
let mut reader = match WavReader::open(path) {
Err(_) => { return None; },
Ok(reader) => reader,
};
// TODO: Inefficient.
let mut all_samples = Vec::new();
let samples = reader.samples::<i16>();
for sample in samples {
all_samples.push(sample.unwrap());
}
Some(all_samples)
}
// TODO: This should be removed. We should cache the wav headers.
pub fn get_spec(&self, speaker: &str, word: &str) -> Result<WavSpec, SynthError> {
try!(check_path(speaker));
+6 -1
View File
@@ -43,7 +43,8 @@ impl VocabularyLibrary {
}
let dirname = try!(get_filename(&entry));
if ignorable_file(&dirname) {
if ignorable_file(&dirname) || ignorable_dir(&dirname) {
continue;
}
@@ -109,3 +110,7 @@ fn ignorable_file(filename: &str) -> bool {
filename.starts_with("_") || filename.ends_with("_")
}
fn ignorable_dir(filename: &str) -> bool {
filename == "misc"
}
+6
View File
@@ -69,6 +69,12 @@ impl Synthesizer {
match self.arpabet_dictionary.get_polyphone(word) {
None => {
// TODO: ERROR (maybe add static based on word length!)
match self.audiobank.get_misc("record_static") {
None => {},
Some(waveform_data) => {
concatenated_waveform.extend(waveform_data);
},
}
continue;
},
Some(polyphone) => {