Add C# and JavaScript (wasm) API for MatchaTTS models (#1682)

This commit is contained in:
Fangjun Kuang
2025-01-05 15:08:19 +08:00
committed by GitHub
parent 1ef9e5ee3a
commit 3eced3e7ee
26 changed files with 677 additions and 88 deletions

View File

@@ -0,0 +1,44 @@
/// Copyright (c) 2025 Xiaomi Corporation (authors: Fangjun Kuang)
using System.Runtime.InteropServices;
namespace SherpaOnnx
{
[StructLayout(LayoutKind.Sequential)]
public struct OfflineTtsMatchaModelConfig
{
public OfflineTtsMatchaModelConfig()
{
AcousticModel = "";
Vocoder = "";
Lexicon = "";
Tokens = "";
DataDir = "";
NoiseScale = 0.667F;
LengthScale = 1.0F;
DictDir = "";
}
[MarshalAs(UnmanagedType.LPStr)]
public string AcousticModel;
[MarshalAs(UnmanagedType.LPStr)]
public string Vocoder;
[MarshalAs(UnmanagedType.LPStr)]
public string Lexicon;
[MarshalAs(UnmanagedType.LPStr)]
public string Tokens;
[MarshalAs(UnmanagedType.LPStr)]
public string DataDir;
public float NoiseScale;
public float LengthScale;
[MarshalAs(UnmanagedType.LPStr)]
public string DictDir;
}
}

View File

@@ -11,6 +11,7 @@ namespace SherpaOnnx
public OfflineTtsModelConfig()
{
Vits = new OfflineTtsVitsModelConfig();
Matcha = new OfflineTtsMatchaModelConfig();
NumThreads = 1;
Debug = 0;
Provider = "cpu";
@@ -21,5 +22,7 @@ namespace SherpaOnnx
public int Debug;
[MarshalAs(UnmanagedType.LPStr)]
public string Provider;
public OfflineTtsMatchaModelConfig Matcha;
}
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>.net6</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>

View File

@@ -4,7 +4,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<OutputType>Library</OutputType>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>net6.0;net45;net40;net35;net20;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net45;net40;net35;net20;netstandard2.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;linux-arm64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64</RuntimeIdentifiers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>sherpa-onnx</AssemblyName>

View File

@@ -3,7 +3,7 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<OutputType>Library</OutputType>
<TargetFrameworks>net6.0;net45;net40;net35;net20;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net45;net40;net35;net20;netstandard2.0</TargetFrameworks>
<RuntimeIdentifier>{{ dotnet_rid }}</RuntimeIdentifier>
<AssemblyName>sherpa-onnx</AssemblyName>
<Version>{{ version }}</Version>