Click here to Skip to main content
15,886,787 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Can you give me a timbre preverser pitch algorithm?
It can be C++ or C# or any language just give me or tell me how to create one.

I need it for an own TTS engine.

What I have tried:

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
using System.Speech.Synthesis;
using System.Speech.AudioFormat;
 
 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        List<string> all_lines_List = new List<string>();
 
        private void Read_Click(object sender, EventArgs e)
        {
            if(comboBox1.SelectedItem!=null)
            {
                button1.Enabled = false;
 
                
                SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();
 
                ReadOnlyCollection<InstalledVoice> InstalledVoices = speech_synthesizer.GetInstalledVoices();
                
 

                speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());
                //speech_synthesizer.SelectVoice("MSMary");  
               
                speech_synthesizer.SetOutputToDefaultAudioDevice();
                //PromptBuilder builder = new PromptBuilder();
                //builder.AppendSsmlMarkup("<say-as interpret-as = \"chs\"> chair </say-as>");

                //speech_synthesizer.AddLexicon(new Uri("C:\\W7\\Spelling.pls"), "application/pls");
                
                speech_synthesizer.Volume = 100;
                speech_synthesizer.Rate = 0;
 
                PromptBuilder builder = new PromptBuilder();
                builder.AppendText("This is sample output to a WAVE file.", PromptEmphasis.Strong);
                builder.AppendSsmlMarkup("<say-as interpret-as = \"WAVE\"> chair </say-as>");
 
                speech_synthesizer.Speak(builder);
 
                speech_synthesizer.Speak(richTextBox2.Text);
 
                //speech_synthesizer.RemoveLexicon(new Uri("C:\\W7\\Spelling.pls"));
                button1.Enabled = true;                
 
                System.Media.SystemSounds.Asterisk.Play();
 
                Application.DoEvents();
            
            }
            else
            {
                System.Media.SystemSounds.Hand.Play();
                MessageBox.Show("Please, Select a Voice.");
            }
 

           
        }
 
        private void Save_Without_Reading_Click(object sender, EventArgs e)
        {
                      
            if (comboBox1.SelectedItem != null)
            {
                SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();
 
                speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());
                
                speech_synthesizer.SetOutputToDefaultAudioDevice();
 
                speech_synthesizer.Volume = 100;
                speech_synthesizer.Rate = 0;
 
                speech_synthesizer.SetOutputToWaveFile(comboBox1.SelectedItem.ToString() + " - Speech.wav", new SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
 
                speech_synthesizer.Speak(richTextBox2.Text);
                System.Media.SystemSounds.Asterisk.Play();                
 
            }
            else
            {
                System.Media.SystemSounds.Hand.Play();
                MessageBox.Show("Please, Select a Voice.");
            }
 
            
        }        
Posted
Updated 27-Jun-16 7:55am
Comments
Sergey Alexandrovich Kryukov 27-Jun-16 13:42pm    
Sorry, algorithms of such complexity is not something which can be possibly "given". Given — in what sense?

It looks like you are using System.Speech.Synthesis.SpeechSynthesizer. If so, how is that related to your "own TTS"? (If it's really yours, I'm sorry for my mistake.)

—SA
Roland-HE-C# 27-Jun-16 15:27pm    
This is a sample from my first try but the sapi quality is insuffucient for me so I will start a new project after when I get a timbre preverser pitch algorithm.
Sergey Alexandrovich Kryukov 27-Jun-16 15:29pm    
I perfectly understand. This code fragment is just irrelevant to the problem, which is quite difficult.
—SA
Roland-HE-C# 27-Jun-16 15:33pm    
On the internet I found a simple pitch shifter c++ code earlier but its quality is bad and basic.

1 solution

Well, you start by reading these[^] then start writing your own algorithm code.

No, you're not going to find anyone that will just "give you" their hard work.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Jun-16 14:08pm    
Fair enough, a 5.
—SA
Roland-HE-C# 27-Jun-16 15:31pm    
Your're right but I did a try to get one from someone.
I've read some posts before my question but I wrote that I accept tips too if nobody gives algorithm to me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900