Azure Cognitive Servislerin Speech Servisi İle Speech-To-Text Yapmak

Install-Package Microsoft.CognitiveServices.Speech
var speechConfig = SpeechConfig.FromSubscription("your key1 or key2", "resourcelocation");
using var audioConfig = AudioConfig.FromMicrophoneInput("micropoheneid"); using var recognizer = new SpeechRecognizer(speechConfig, "tr-TR", audioConfig); while(true)
{
var result = await recognizer.RecognizeOnceAsync(); Console.Out.WriteLineAsync($"Offset={result.OffsetInTicks} Text={result.Text}"); }
SynchronizedCollection<string> utterences = new SynchronizedCollection<string>(); await recognizer.StartContinuousRecognitionAsync(); 
recognizer.Recognized += (s, e) => { string resultAsText = e.Result.Text;
if (!isRecognitionCancelled)
{
utterences.Add(resultAsText); } Console.Out.WriteLineAsync($"Offset={e.Result.OffsetInTicks}
Text={e.Result.Text}");
if(resultAsText.ToLower().Contains("dikteyi kapat"))
{
recognizer.StopContinuousRecognitionAsync(); } };
https://gist.github.com/anilkay/0f0dce5cd9b7237ab8983bed21b87be5
ffmpeg -i deneme.mp3 -acodec pcm_u8 -ar 22050 deneme.wav
using var audioConfig = AudioConfig.FromWavFileInput("path/to/deneme.wav");
SynchronizedCollection<string> utterences = new SynchronizedCollection<string>(); recognizer.SessionStopped += (s, e) => 
{
Console.WriteLine("Dinleme Sonlandı.");
Random random = new Random(); if (utterences.Count > 0)
{
File.WriteAllLinesAsync("transcript" + random.Next(0, 1000) + ".txt", utterences); utterences.Clear(); } };

--

--

--

Computer Engineer,Sociologist, CSE Master Student

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
anıl kaynar

anıl kaynar

Computer Engineer,Sociologist, CSE Master Student

More from Medium

Out of intense complexities… individuals and indices

Honestly trying out Microsoft Edge & Bing

ICE Placements Talk — Analytics Domain(On-Campus)

Parallel Computing In Climate Research and Model