private static IEnumerable <string> SplitNotesByClicks(string rawNotes) { TaggedText taggedNotes = new TaggedText(rawNotes); List <String> splitByClicks = taggedNotes.SplitByClicks(); return(splitByClicks); }
public void SplitEmptyString() { var t = new TaggedText(""); var result = t.SplitByClicks(); Assert.IsNotNull(result, "Returned a null list."); Assert.IsFalse(result.Any(), "List contained results."); }
public void SplitEmptyString() { TaggedText t = new TaggedText(""); System.Collections.Generic.List <string> result = t.SplitByClicks(); Assert.IsNotNull(result, "Returned a null list."); Assert.IsFalse(result.Any(), "List contained results."); }
public void LeaveStringIntactWhenNoSplit() { const string sentence = "This has no clicks to split by."; var t = new TaggedText(sentence); var split = t.SplitByClicks(); Assert.IsTrue(split.Count == 1, "Split when there wasn't a click."); Assert.IsTrue(split[0].Equals("This has no clicks to split by."), "Didn't leave original string intact."); }
public void SplitStringsByClick() { const string sentence = "This is separated by a click.[afterclick]This is the next part."; TaggedText t = new TaggedText(sentence); System.Collections.Generic.List <string> split = t.SplitByClicks(); Assert.IsTrue(split.Count == 2, "Split into incorrect amount of strings."); Assert.IsTrue(split[0].Equals("This is separated by a click."), "First split incorrect."); Assert.IsTrue(split[1].Equals("This is the next part."), "Second split incorrect."); }
public void SplitStringsByClick() { const string sentence = "This is separated by a click.[afterclick]This is the next part."; var t = new TaggedText(sentence); var split = t.SplitByClicks(); Assert.IsTrue(split.Count == 2, "Split into incorrect amount of strings."); Assert.IsTrue(split[0].Equals("This is separated by a click."), "First split incorrect."); Assert.IsTrue(split[1].Equals("This is the next part."), "Second split incorrect."); }
public static void SaveStringToWaveFiles(string notesText, string folderPath, string fileNameFormat) { TaggedText taggedNotes = new TaggedText(notesText); List <String> stringsToSave = taggedNotes.SplitByClicks(); //MD5 md5 = MD5.Create(); for (int i = 0; i < stringsToSave.Count; i++) { String textToSave = stringsToSave[i]; String baseFileName = String.Format(fileNameFormat, i + 1); // The first item will autoplay; everything else is triggered by a click. String fileName = i > 0 ? baseFileName + " (OnClick)" : baseFileName; String filePath = folderPath + "\\" + fileName + ".wav"; SaveStringToWaveFile(textToSave, filePath); } }
public static void SaveStringToWaveFiles(string notesText, string folderPath, string fileNameFormat) { TaggedText taggedNotes = new TaggedText(notesText); List <string> stringsToSave = taggedNotes.SplitByClicks(); //MD5 md5 = MD5.Create(); for (int i = 0; i < stringsToSave.Count; i++) { string textToSave = stringsToSave[i]; string baseFileName = string.Format(fileNameFormat, i + 1); // The first item will autoplay; everything else is triggered by a click. string fileName = i > 0 ? baseFileName + " (OnClick)" : baseFileName; string filePath = folderPath + "\\" + fileName + ".wav"; switch (AudioSettingService.selectedVoiceType) { case VoiceType.ComputerVoice: ComputerVoiceRuntimeService.SaveStringToWaveFile(textToSave, filePath, AudioSettingService.selectedVoice as ComputerVoice); break; case VoiceType.AzureVoice: AzureRuntimeService.SaveStringToWaveFileWithAzureVoice(textToSave, filePath, AudioSettingService.selectedVoice as AzureVoice); break; case VoiceType.WatsonVoice: WatsonRuntimeService.SaveStringToWaveFile(textToSave, filePath, AudioSettingService.selectedVoice as WatsonVoice); break; default: break; } } }