public override WAVSound GenerateWordSequence(List <string> wordList, List <double> silenceList) { List <WAVSound> wordSoundList = new List <WAVSound>(); foreach (string word in wordList) { WAVSound wordSound = GenerateWord(word); if (wordSound != null) { wordSoundList.Add(wordSound); } } if (silenceList.Count > wordList.Count) { while (silenceList.Count > wordList.Count) { silenceList.RemoveAt(silenceList.Count - 1); } // The silence list must not be longer than the wordlist. } WAVSound wordSequenceSound = null; if (wordSoundList.Count > 0) { wordSequenceSound = WAVSound.Join(wordSoundList, silenceList); } // WAVSound wordSequenceSound = WAVSound.Join(wordSoundList, silenceList); return(wordSequenceSound); }
public override WAVSound GenerateWord(string word) { int wordIndex = wordToSoundMappingList.FindIndex(m => m.Word == word); WAVSound wordSound = null; if (wordIndex >= 0) { WordToSoundMapping wordToSoundMapping = wordToSoundMappingList[wordIndex]; List <WAVSound> wavSoundList = new List <WAVSound>(); foreach (string soundName in wordToSoundMapping.SoundNameList) { FormantSpecification formantSpecification = SpecificationList.Find(s => s.Name == soundName); if (formantSpecification != null) { formantSpecification.GenerateSettingsSequence(); WAVSound sound = GenerateSound(formantSpecification); wavSoundList.Add(sound); } } if (wavSoundList.Count > 0) { wordSound = WAVSound.Join(wavSoundList, null); } } return(wordSound); }