|
I solved the problem with help from the website, I needed to add authorization into the url.
Thanks,
Michael
modified 5-Jan-17 9:18am.
|
|
|
|
|
I have created app that converts text to speech but whatever gender I select it speaks same voice!!!
SpeechSynthesizer ss;
private void Form1_Load(object sender, EventArgs e)
{
ss = new SpeechSynthesizer();
}
private void button1_Click(object sender, EventArgs e)
{
ss.Rate = SpeedTrackBar.Value;
ss.Volume = VolumeTrackBar.Value;
try
{
switch (comboBox1.SelectedIndex)
{
case 0:
ss.SelectVoiceByHints(VoiceGender.NotSet);
break;
case 1:
ss.SelectVoiceByHints(VoiceGender.Male);
break;
case 2:
ss.SelectVoiceByHints(VoiceGender.Female);
break;
case 3:
ss.SelectVoiceByHints(VoiceGender.Neutral);
break;
default:
break;
}
ss.SpeakAsync(textBox1.Text);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
ss.Pause();
}
private void button3_Click(object sender, EventArgs e)
{
ss.Resume();
}
private void button4_Click(object sender, EventArgs e)
{
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Rate = SpeedTrackBar.Value;
ss.Volume = VolumeTrackBar.Value;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Wave Files| *.wav";
sfd.ShowDialog();
ss.SetOutputToWaveFile(sfd.FileName);
ss.Speak(textBox1.Text);
ss.SetOutputToDefaultAudioDevice();
MessageBox.Show("Recording Completed..", "T2S");
}
|
|
|
|
|
You have a global variable speachsynthesizer (ss) that you configure on button1 then on the actual record button4 you create a new LOCAL variable speachsynthesizer of the same name (ss) that you do not configure but use that to speak the text.
|
|
|
|
|
The Record button is used to save text inside textBox!
I have replaced varibles from button1 and button4 with SpeechSynthesizer ss = new SpeechSynthesizer(); as global varible but still not working!!!!
|
|
|
|
|
|
If you now have two lines like this in your code, that's not correct. You only need to declare it once, in the Form_Load. So, you have a member variable called ss (that's a poor choice for a name - why not just call it speechSynthesizer), and in your Form_Load you have ss = new SpeechSynthesizer . That's it - that's the only place you should see the new Synthesizer() call.
This space for rent
|
|
|
|
|
Exactly. That's a bug in the language specification of C# which can cause bugs in the software which are very hard to find. Fortunately, ReSharper can issue a warning. And a well designed style guide should suggest different styles for fields vs. local variables.
|
|
|
|
|
I have the following code, but the class member "X" refuses to be serialized to the xml file:
[Serializable]
public class MyList : List<MyClass>
{
public string X = string.empty;
}
protected void Function()
{
MyList L = new MyList();
L.X = "String";
XmlSerializer serializer = new XmlSerializer(typeof(MyList));
StreamWriter Sw = new StreamWriter(Filename);
serializer.Serialize(Sw, L);
Sw.Dispose();
}
The member is simply absent from resulting the Xml file.
Is there anything I can do to force the serializer to serialize member "X" to the file?
Is there some reason it's not serializing "X"? Is it because the class derives from List<T>?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: The member is simply absent from resulting the Xml file. The member is a field, not a property.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
OH!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Looking at that, I had to wonder if you were trying C#6 property syntax and just forgot the => instead of = .
This space for rent
|
|
|
|
|
how to get the longest distance between equal number in the array using c#
|
|
|
|
|
Do you expect other's to write the code for you? It ain't work so here.
But it is quite simple. Give it a try:
Iterate over the array items using another iteration for each item looking for equal numbers. With equal numbers get the distance and check if it is larger than the previously detected maximum distance.
|
|
|
|
|
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
But without giving you any code, I'll tell you how I'd do it: I'd create a struct to hold each distinct value and a sorted list of indexes in the array. I'd then fill out a collection of such structs - one for each distinct value in the array - and traverse the collection when complete to find the largest difference in indexes.
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
any one work on sentiment analysis through google cloud library???please help
|
|
|
|
|
Member 12875047 wrote: please help
With what?
We have no idea what you have tried, what happened when you did, or what help you want from us.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Sentiment analysis indicates that your post is not to be taken seriously due to its lack of capitals, improper punctuation, tone, etc.
|
|
|
|
|
Here[^] you go.
This space for rent
|
|
|
|
|
Member 12875047 wrote: please help
Help on what ?
You gave a question a problem ?
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Hi, I'm creating a custom VScrollBar and I have problem getting the exact Y position of the thumb like the Windows.Forms.VScrollBar, I have searched online and I found some examples of custom scrollbars like:
How to skin scrollbars for Panels, in C#[^]
Custom Drawn Scrollbar[^]
The problem with these examples are that they don't get the exact top position of the thumb comparing to the windows scrollbar. I am getting a Top position that while scrolling becomes less than the real position
Doesn't anyone know how to calculate this?
|
|
|
|
|
Member 10498254 wrote: Doesn't anyone know how to calculate this? How are you calculating it?
|
|
|
|
|
I'm calculating it like this
decimal ratio = (decimal)((ClientRectangle.Height) - 2 * topButton.Height - ThumbSize()) / (Maximum - Minimum);
int thumbTopPosition = (int)((Value - Minimum) * ratio) + topButton.Height;
|
|
|
|
|
And what is wrong with the result?
|
|
|
|
|
the problem is that the Y position I get is smaller than the position of the Windows Scrollbar.
I tested my custom scrollbar with the Windows scrollbar with the same Maximum, Minimum, LargeChange and SmallChange, and when I get a Y position of 45 the other has a Y position little bit bigger than 45. The difference between the Y positions gets bigger as a set the Maximum value bigger.
|
|
|
|