C# و Microsoft Speech.recognition والكلام.
-
28-09-2019 - |
سؤال
أنا جديد على C# وأنا جديد على الكلام. الإدراك. لقد بحثت لفترة طويلة عن البرامج التعليمية ، لكنني لم أجد الكثير ، حتى أنني لست متأكدًا مما إذا كنت قد قمت بتضمين كل شيء بشكل صحيح.
لقد قمت بتنزيل:
أنا أقوم برمجة المحلية ، ولدي Windows XP ، .NET Framework 3.5.
الآن أريد فقط أن أبدأ ببعض خطوط التعليمات البرمجية البسيطة ، مثل أن أقول "Hello World" أو قول كلمة واحدة أو كلمتين كمدخلات.
حاولت المتابعة ، وبالطبع لا يعمل:> خطأ:
لا يمكن العثور على "Typ- أو مساح الأسماء" CleareSynthesizer "(هل يستخدم direktive أو Assemblyverweis مفقود؟)"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
using System.Speech.Synthesis;
namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer foo = new SpeechSynthesizer();
foo.Speak("Test");
}
}
}
تعديل:
مرحبًا ، لقد جربت لك رمزًا ، لكن باستخدام PleinterLib ؛ لا يمكن العثور عليها:>
حسنًا الآن كتبت:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.SpeechLib;
namespace System.SpeechLib { }
namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }
لكني أحصل على خطأ في:
Numericupdown1 ، spvoice ، pleasevoicespeakflags ، textbox1 و timeout
المحلول
Project + إضافة مرجع ، .NET علامة التبويب ، حدد "System.speech".
قالب المشروع مسبقًا عدة مجموعات .NET. ولكن فقط منها شائعة ، مثل system.dll ، system.core.dll ، etcetera. عليك إضافة تلك "غير عادية" بنفسك.
نصائح أخرى
يمكنك تجربة هذا:
احصل على Interop.SpeechLib.dll
using SpeechLib;
private void ReadText(string readText)
{
int iCounter = 0;
while (Convert.ToInt32(numericUpDown1.Value) > iCounter)
{
SpVoice spVoice = new SpVoice();
spVoice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
spVoice.WaitUntilDone(Timeout.Infinite);
iCounter = iCounter + 1;
}
}