Back to NxLabs

NxLabs / Vintage Story

S

Sherpa ONNX for Vintage Story

YBy YangWenLi

Adds Sherpa ONNX support to Vintage Story. Easy to use, supporting most common operating systems.

Description

Sherpa ONNX for Vintage Story

That's right, <span style="color: #2880b9;">Sherpa ONNX</span> is now in Vintage Story for use by any modders with crazy schemes involving text-to-voice models!
This library includes all compiled natives across all relevant operating systems, ensuring that your mod is cross-platform and ready for large servers.

&nbsp;

<span style="background-color: #e74c3c;">WARNING: THIS IS A MOD LIBRARY | FOR USE AS A DEPENDENCY.
<span style="background-color: #f1c40f;">IF YOU'RE A NORMAL USER, DON'T DOWNLOAD THIS UNLESS ANOTHER MOD TOLD YOU TO.
THIS IS NOT A MOD, JUST SOMETHING THAT MAKES MODS WORK.</span></span>

Supported Architectures:

  • Windows x86
  • Linux x86 (Linux ARM not supported by the game, and won't be supported by this mod at the moment)
  • MacOS (x86 + Apple Silicon/ARM)

How to use:

First, add this mod as a dependency to your mod.

<pre class="language-javascript">"dependencies": { "game": "", "vssherpaonnx": "" }</pre>

&nbsp;

Then, directly download the mod and extract&nbsp;VintagestoryAPI.dll onto the root (or src, or whatever you use) folder of your mod.
Once that's done, edit your CSProj to include the following:

<pre class="language-javascript">&lt;ItemGroup&gt; &lt;Reference Include="vssherpaonnx"&gt; &lt;HintPath&gt;$(MSBuildProjectDirectory)\vssherpaonnx.dll&lt;/HintPath&gt; &lt;Private&gt;false&lt;/Private&gt; &lt;/Reference&gt; &lt;/ItemGroup&gt;</pre>

&nbsp;

Then, include the API in any files that need it.

<pre class="language-csharp">using VSSherpaOnnx;</pre>

&nbsp;

&nbsp;

You can now save a reference (store a variable) to the resolved Sherpa assemblies via:

<pre class="language-cpp">var sherpaAsm = VSSherpaOnnxSystem.EnsureSherpaReady(api);</pre>

&nbsp;

That's all there is. You can now use Sherpa ONNX as you wish. You can use the code for RPTTS as an example, or look at the example below:

<pre class="language-csharp">var offlineTtsType = sherpaAsm.GetType("SherpaOnnx.OfflineTts", throwOnError: true);</pre>

&nbsp;

Finally, here are some helper/debug print functions:

<pre class="language-csharp">static string VSSherpaOnnxSystem.GetResolvedRid() static string VSSherpaOnnxSystem.GetResolvedNativeDirectory() static string VSSherpaOnnxSystem.GetManagedWrapperPath()</pre>

&nbsp;

Do not attempt to call the following manually:

<pre class="language-csharp">LoadFromAssemblyPath NativeLibrary.Load</pre>

&nbsp;

Have fun!

&nbsp;

&nbsp;

&nbsp;

This mod is brought to you by...

The Unofficial Vintage Story Modding Co-op, click here to join.
As modders, we can help each other make even better stuff. Plus, we have dedicated channels for better organization.

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.