EdgeTTS.Framework 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package EdgeTTS.Framework --version 1.0.3                
NuGet\Install-Package EdgeTTS.Framework -Version 1.0.3                
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="EdgeTTS.Framework" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EdgeTTS.Framework --version 1.0.3                
#r "nuget: EdgeTTS.Framework, 1.0.3"                
#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 EdgeTTS.Framework as a Cake Addin
#addin nuget:?package=EdgeTTS.Framework&version=1.0.3

// Install EdgeTTS.Framework as a Cake Tool
#tool nuget:?package=EdgeTTS.Framework&version=1.0.3                

EdgeTTS.Framework

24/11更新: 支持额外加密参数 Sec-MS-GEC


Fork来自 https://github.com/Loskh/EdgeTTS.Net, 本Fork版本支持.Net Framework

icon是我自己画的

如何使用

var etts = new EdgeTTSClient();
var result = etts.SynthesisAsync("这是一个测试", "zh-CN-XiaoyiNeural").Result;
if (ms.Code != ResultCode.Success)
{
    Console.WriteLine("生成失败");
    return;
}
var path = "test.mp3";
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.Write(result.Data.ToArray());
fs.Close();
w.Dispose();
fs.Dispose();
//Path 是生成的tts文件

额外加密参数

目前中国大陆使用EdgeTTS需要额外参数, 参见 issue: 403 error is back/need to implement Sec-MS-GEC token

如何使用

var etts = new EdgeTTSClient();
//需要额外添加 可以获得额外加密参数的网址
etts.Sec_MS_GEC_UpDate_Url = "http://123.207.46.66:8086/api/getGec";
//剩下的和前面一样
var result = etts.SynthesisAsync("这是一个测试", "zh-CN-XiaoyiNeural").Result;
if (ms.Code != ResultCode.Success)
{
    Console.WriteLine("生成失败");
    return;
}
var path = "test.mp3";
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.Write(result.Data.ToArray());
fs.Close();w.Dispose();fs.Dispose();

额外的加密参数网址 (Sec-MS-GEC)

目前只能通过抓包Edge来获得该参数, 而且每600秒过期. 有许多大佬制作了API免费给大家用, 谢谢他们.

http://123.207.46.66:8086/api/getGec

by @learnin9

https://edge-sec.myaitool.top/?key=edge

by @BG5T

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 107 11/11/2024
1.0.3 94 11/7/2024
1.0.2 98 11/7/2024 1.0.2 is deprecated because it has critical bugs.
1.0.1 597 5/25/2023
1.0.0 179 5/25/2023

额外加密参数 Sec-MS-GEC