PTI.Microservices.Library.AzureSpeech 7.0.0.1

dotnet add package PTI.Microservices.Library.AzureSpeech --version 7.0.0.1
NuGet\Install-Package PTI.Microservices.Library.AzureSpeech -Version 7.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PTI.Microservices.Library.AzureSpeech" Version="7.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PTI.Microservices.Library.AzureSpeech --version 7.0.0.1
#r "nuget: PTI.Microservices.Library.AzureSpeech, 7.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PTI.Microservices.Library.AzureSpeech as a Cake Addin
#addin nuget:?package=PTI.Microservices.Library.AzureSpeech&version=7.0.0.1

// Install PTI.Microservices.Library.AzureSpeech as a Cake Tool
#tool nuget:?package=PTI.Microservices.Library.AzureSpeech&version=7.0.0.1

PTI.Microservices.Library.AzureSpeech

This is part of PTI.Microservices.Library set of packages

The purpose of this package is to facilitate the calls to Azure Speech APIs, while maintaining a consistent usage pattern among the different services in the group

Examples:

Translate Continuous Speech

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
await azureSpeechService.TranslateContinuousSpeechAsync("en-US", "es", "es-MX-HildaRUS");

Assess Pronunciation

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
var result = await azureSpeechService.AssessPronunciationFromDefaultMicrophone("This NuGet package is the best out there!");

Get Text From Audio Stream

Stream audioFile = File.Open(@"C:\Temp\TestAudio.wav", FileMode.Open);
AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
var result = await azureSpeechService.GetTextFromAudioStreamAsync(audioFile);

TalkToAsByteArray

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
MemoryStream memoryStream = new MemoryStream();
var result = await azureSpeechService.TalkToStreamAsync("Hello Pocahontas!",
   outputStream: memoryStream);
memoryStream.Position = 0;
File.WriteAllBytes(@"C:\Temp\TestAudio.wav", memoryStream.ToArray());
memoryStream.Close();

Speak

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
var result = await azureSpeechService.TalkToDefaultSpeakersAsync("This is an audio generated from tests");

Create Audio Stream

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
var (result, outputStream) = await azureSpeechService.CreateAudioStreamAsync("This is an audio generated from tests");

SSML

AzureSpeechService azureSpeechService =
   new AzureSpeechService(null, this.AzureSpeechConfiguration, new CustomHttpClient(new CustomHttpClientHandler(null)));
SSMLMessage message = new SSMLMessage()
{
    lang = "en-US",
    version = 1.0M,
    voice = new speakVoice()
    {
        expressas = new expressas()
        {
            style = "cheerful",
            Value = "This is a test voice using the SSML language"
        },
        name = "Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)",
        prosody = new speakVoiceProsody[]
        {
            new speakVoiceProsody()
            {
                pitch="-50.00%",
                Value="This is an example of pitch being changed in a whole paragraph."
            },
            new speakVoiceProsody()
            {
                rate="-60.00%",
                Value="This is an example of rate being changed in a whole paragraph."
            },
            new speakVoiceProsody()
            {
                volume="-50.00%",
                Value="This is an example of volume being changed in a whole paragraph."
            },
            new speakVoiceProsody()
            {
                volume="loud",
                Value="This is an example of volume being changed in a whole paragraph, but using Constant"
            }
        }
    }
};
var result = await azureSpeechService.TalkToDefaultSpeakersWithSSML(message);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on PTI.Microservices.Library.AzureSpeech:

Package Downloads
PTI.Microservices.Library.AudibleTwitter

Cloud Services library designed to be consumed in Microservices

PTI.Microservices.Library.AudibleWeather

Cloud Services library designed to be consumed in Microservices

PTI.Microservices.Library.AudibleBook

Cloud Services library designed to be consumed in Microservices

PTI.Microservices.Library.AudibleComputerVision

Cloud Services library designed to be consumed in Microservices

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.0.1 353 11/14/2022
7.0.0 498 11/12/2022
2.0.0-preview 325 7/9/2021