C
C#2y ago
AIphAir

❔ Google Cloud STT API C#

using Google.Cloud.Speech.V1;
using System;

namespace SpeechToTextApiDemo
{
public class Program
{
public static void Main(string[] args)
{
var speech = SpeechClient.Create();
var config = new RecognitionConfig
{
Encoding = RecognitionConfig.Types.AudioEncoding.Flac,
SampleRateHertz = 16000,
LanguageCode = LanguageCodes.English.UnitedKingdom
};
var audio = RecognitionAudio.FromStorageUri("gs://cloud-samples-tests/speech/brooklyn.flac");

var response = speech.Recognize(config, audio);

foreach (var result in response.Results)
{
foreach (var alternative in result.Alternatives)
{
Console.WriteLine(alternative.Transcript);
}
}
}
}
}
using Google.Cloud.Speech.V1;
using System;

namespace SpeechToTextApiDemo
{
public class Program
{
public static void Main(string[] args)
{
var speech = SpeechClient.Create();
var config = new RecognitionConfig
{
Encoding = RecognitionConfig.Types.AudioEncoding.Flac,
SampleRateHertz = 16000,
LanguageCode = LanguageCodes.English.UnitedKingdom
};
var audio = RecognitionAudio.FromStorageUri("gs://cloud-samples-tests/speech/brooklyn.flac");

var response = speech.Recognize(config, audio);

foreach (var result in response.Results)
{
foreach (var alternative in result.Alternatives)
{
Console.WriteLine(alternative.Transcript);
}
}
}
}
}
The tutorial is telling me to run the code in shell using
dotnet run
dotnet run
command how do I run this?
4 Replies
AIphAir
AIphAirOP2y ago
AIphAir
AIphAirOP2y ago
the app is called 'Program.cs'
Omnissiah
Omnissiah2y ago
i don't get where is the problem (except that maybe you could keep the battery at <100%) did you execute dotnet run? you have to be in the directory where the csproj is
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server