private void HandleSoundVisualizer3x3ItemDoubleClicked(object sender, VisualizerIndexEventArgs e) { ieaSelectedFormantSpecification = formantSpecificationMatrix[e.XIndex][e.YIndex].Copy(); ShowIEASelectedFormantSpecification(); GenerateNextIteration(e.XIndex, e.YIndex); EvaluateAll(); }
private void wordToSoundMappingEditor_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (speechSynthesizer != null) { int selectedIndex = e.RowIndex; if ((selectedIndex >= 0) && (selectedIndex < speechSynthesizer.WordToSoundMappingList.Count)) { WordToSoundMapping wordToSoundMapping = speechSynthesizer.WordToSoundMappingList[selectedIndex]; if (editorFormantSpecification == null) { editorFormantSpecification = new FormantSpecification(speechSynthesizer.FundamentalFrequency, speechSynthesizer.SamplingFrequency); editorPlayButton.Enabled = true; } editorFormantSpecification.FormantSettingsList = new List <FormantSettings>(); foreach (string soundName in wordToSoundMapping.SoundNameList) { FormantSpecification specification = speechSynthesizer.SpecificationList.Find(s => s.Name == soundName).Copy(); foreach (FormantSettings settings in specification.FormantSettingsList) { editorFormantSpecification.FormantSettingsList.Add(settings.Copy()); } } } } }
private void editorRandomizeButton_Click(object sender, EventArgs e) { if (editorFormantSpecification == null) { editorFormantSpecification = new FormantSpecification(speechSynthesizer.FundamentalFrequency, speechSynthesizer.SamplingFrequency); } if (editorFormantSpecification.FormantSettingsList.Count == 0) { FormantSettings formantSettings = new FormantSettings(); editorFormantSpecification.FormantSettingsList.Add(formantSettings); } int selectedIndex = formantSpecificationListBox.SelectedIndex; if (formantSpecificationListBox.SelectedIndex < 0) { selectedIndex = 0; } editorFormantSpecification.FormantSettingsList[selectedIndex].Randomize(randomNumberGenerator); ShowFormantSpecification(selectedIndex); insertEndPointSilenceButton.Enabled = true; endPointSilenceDurationLabel.Enabled = true; endPointSilenceDurationTextBox.Enabled = true; editorPlayButton.Enabled = true; clearButton.Enabled = true; setUnvoicedButton.Enabled = true; }
private void clearButton_Click(object sender, EventArgs e) { editorFormantSpecification = null; ShowFormantSpecification(-1); formantSettingsEditor.Clear(); editorSpeechVisualizer.SetSound(null); editorPlayButton.Enabled = false; endPointSilenceDurationLabel.Enabled = false; insertEndPointSilenceButton.Enabled = false; endPointSilenceDurationTextBox.Enabled = false; }
private void assignCurrentSoundButton_Click(object sender, EventArgs e) { editorFormantSpecification = formantSpecificationMatrix[1][1].Copy(); ShowFormantSpecification(0); editorFormantSpecification.GenerateSettingsSequence(); FormantSpeechSynthesizer speechSynthesizer = new FormantSpeechSynthesizer(); WAVSound sound = speechSynthesizer.GenerateSound(editorFormantSpecification); editorSpeechVisualizer.SetSound(sound); // soundNameTextBox.Text = ""; // soundEditorVisualizer.ClearHistory(); // soundEditorVisualizer.SetSound(sound); }
private void addToSynthesizerButton_Click(object sender, EventArgs e) { FormantSpecification addedFormantSpecification = editorFormantSpecification.Copy(); addedFormantSpecification.Name = soundNameTextBox.Text; // 20161025: This is needed to avoid incorrect transitions when the sound is later concatenated // with other sounds: addedFormantSpecification.FormantSettingsList.Last().TransitionStart = 1.0; speechSynthesizer.SpecificationList.Add(addedFormantSpecification); speechSynthesizer.SpecificationList.Sort((a, b) => a.Name.CompareTo(b.Name)); ShowSpeechSynthesizer(); }
private void EvaluateAll() { FormantSpeechSynthesizer speechSynthesizer = new FormantSpeechSynthesizer(); for (int iX = 0; iX < formantSpecificationMatrix.Count; iX++) { for (int iY = 0; iY < formantSpecificationMatrix[0].Count; iY++) { FormantSpecification formantSpecification = formantSpecificationMatrix[iX][iY].Copy(); formantSpecification.GenerateSettingsSequence(); WAVSound sound = speechSynthesizer.GenerateSound(formantSpecification); soundVisualizer3x3.SetSound(sound, iX, iY); } } }
private void synthesizerSpecificationListBox_SelectedIndexChanged(object sender, EventArgs e) { int selectedSpecificationIndex = synthesizerSpecificationListBox.SelectedIndex; if (selectedSpecificationIndex >= 0) { editorFormantSpecification = speechSynthesizer.SpecificationList[selectedSpecificationIndex].Copy(); ShowFormantSpecification(0); editorFormantSpecification.GenerateSettingsSequence(); WAVSound sound = speechSynthesizer.GenerateSound(editorFormantSpecification); editorSpeechVisualizer.SetSound(sound); editorPlayButton.Enabled = true; SoundPlayer soundPlayer = new SoundPlayer(); sound.GenerateMemoryStream(); sound.WAVMemoryStream.Position = 0; // Manually rewind stream soundPlayer.Stream = null; soundPlayer.Stream = sound.WAVMemoryStream; soundPlayer.PlaySync(); } }
private void GenerateNewSpeechSynthesizer() { speechSynthesizer = new FormantSpeechSynthesizer(); speechSynthesizer.StorePitch = true; FormantSpecification longSilenceSpecification = new FormantSpecification(speechSynthesizer.FundamentalFrequency, speechSynthesizer.SamplingFrequency); longSilenceSpecification.Name = "="; FormantSettings longSilenceSettings = new FormantSettings(); longSilenceSettings.SetSilence(LONG_SILENCE_SOUND_DURATION); longSilenceSpecification.FormantSettingsList.Add(longSilenceSettings); speechSynthesizer.SpecificationList.Add(longSilenceSpecification); FormantSpecification shortSilenceSpecification = new FormantSpecification(speechSynthesizer.FundamentalFrequency, speechSynthesizer.SamplingFrequency); shortSilenceSpecification.Name = "-"; FormantSettings shortSilenceSettings = new FormantSettings(); shortSilenceSettings.SetSilence(SHORT_SILENCE_SOUND_DURATION); shortSilenceSpecification.FormantSettingsList.Add(shortSilenceSettings); speechSynthesizer.SpecificationList.Add(shortSilenceSpecification); }
private void GenerateNextIteration(int xIndex, int yIndex) { double relativeModificationRange = double.Parse(relativeModificationRangeTextBox.Text); List <int> modifiableFormantSettingsIndexList = new List <int>(); for (int ii = 0; ii < modificationScopeDropDownButton.DropDownItems.Count; ii++) { ToolStripMenuItem item = (ToolStripMenuItem)modificationScopeDropDownButton.DropDownItems[ii]; if (item.Checked) { modifiableFormantSettingsIndexList.Add(ii); } } Boolean modifySinusoids = modifySinusoidsToolStripMenuItem.Checked; Boolean modifyVoicedFraction = modifyVoicedFractionToolStripMenuItem.Checked; Boolean modifyDuration = modifyDurationToolStripMenuItem.Checked; Boolean modifyTransitionStart = modifyTransitionStartToolStripMenuItem.Checked; Boolean modifyAmplitudeVariation = modifyAmplitudeVariationToolStripMenuItem.Checked; Boolean modifyPitchVariation = modifyPitchVariationToolStripMenuItem.Checked; FormantSpecification centerSpecification = formantSpecificationMatrix[xIndex][yIndex].Copy(); formantSpecificationMatrix[1][1] = centerSpecification.Copy(); for (int iX = 0; iX < formantSpecificationMatrix.Count; iX++) { for (int iY = 0; iY < formantSpecificationMatrix[0].Count; iY++) { if (!((iX == 1) && (iY == 1))) // if ((iX != 1) || (iY != 1)) { FormantSpecification modifiedSpecification = centerSpecification.Copy(); modifiedSpecification.Modify(randomNumberGenerator, modifiableFormantSettingsIndexList, relativeModificationRange, modifySinusoids, modifyVoicedFraction, modifyDuration, modifyTransitionStart, modifyAmplitudeVariation, modifyPitchVariation); formantSpecificationMatrix[iX][iY] = modifiedSpecification.Copy(); } } } }
private void HandleSoundVisualizer3x3ItemClicked(object sender, VisualizerIndexEventArgs e) { ieaSelectedFormantSpecification = formantSpecificationMatrix[e.XIndex][e.YIndex].Copy(); ShowIEASelectedFormantSpecification(); }