コード例 #1
0
        private void insertEndPointSilenceButton_Click(object sender, EventArgs e)
        {
            int             selectedIndex          = formantSpecificationListBox.SelectedIndex;
            FormantSettings initialSilenceSettings = new FormantSettings();
            double          duration = double.Parse(endPointSilenceDurationTextBox.Text);

            initialSilenceSettings.SetSilence(duration);
            editorFormantSpecification.FormantSettingsList.Insert(0, initialSilenceSettings);
            FormantSettings finalSilenceSettings = new FormantSettings();

            finalSilenceSettings.SetSilence(duration);
            // Generate the transition to the final silence period:
            FormantSettings lastFormantSettings         = editorFormantSpecification.FormantSettingsList.Last();
            double          lastFormantSettingsDuration = lastFormantSettings.Duration;

            if (lastFormantSettingsDuration < duration)
            {
                lastFormantSettings.TransitionStart = 0;
            }
            else
            {
                double startFraction = 1 - (duration / lastFormantSettingsDuration);
                lastFormantSettings.TransitionStart = startFraction;
            }
            // Then add the final silence:
            editorFormantSpecification.FormantSettingsList.Add(finalSilenceSettings);
            ShowFormantSpecification(selectedIndex + 1);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        private void formantSpecificationListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedFormantSettingsIndex = formantSpecificationListBox.SelectedIndex;

            if (selectedFormantSettingsIndex < editorFormantSpecification.FormantSettingsList.Count)
            {
                FormantSettings formantSettings = editorFormantSpecification.FormantSettingsList[selectedFormantSettingsIndex];
                formantSettingsEditor.SetFormantSettings(formantSettings);
            }
        }
コード例 #4
0
        private void ieaFormantSettingsListListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ieaSelectedFormantSpecification == null)
            {
                return;
            }
            int             selectedIndex = ieaFormantSettingsListListBox.SelectedIndex;
            FormantSettings ieaSelectedFormantSettings = ieaSelectedFormantSpecification.FormantSettingsList[selectedIndex];

            ieaFormantSettingsEditor.SetFormantSettings(ieaSelectedFormantSettings);
        }
コード例 #5
0
        private void formantSpecificationListBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int selectedIndex = formantSpecificationListBox.SelectedIndex;
            int selectedFormantSettingsIndex = formantSpecificationListBox.SelectedIndex;

            if (selectedFormantSettingsIndex < editorFormantSpecification.FormantSettingsList.Count)
            {
                FormantSettings formantSettings       = editorFormantSpecification.FormantSettingsList[selectedFormantSettingsIndex];
                FormantSettings copiedFormantSettings = formantSettings.Copy();
                editorFormantSpecification.FormantSettingsList.Insert(selectedFormantSettingsIndex + 1, copiedFormantSettings);
                ShowFormantSpecification(selectedIndex + 1);
            }
        }
コード例 #6
0
        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);
        }