
Sherpa ONNX for Vintage Story
Adds Sherpa ONNX support to Vintage Story. Easy to use, supporting most common operating systems.
Description
<h1 style="text-align: center;">Sherpa ONNX for Vintage Story</h1> <p style="text-align: center;">That's right, <a href="https://github.com/k2-fsa/sherpa-onnx"><span style="color: #2880b9;">Sherpa ONNX</span></a> is now in Vintage Story for use by any modders with crazy schemes involving text-to-voice models!<br />This library includes all compiled natives across all relevant operating systems, ensuring that your mod is cross-platform and ready for large servers.</p> <p style="text-align: center;"> </p> <p style="text-align: center;"><strong><span style="background-color: #e74c3c;">WARNING: THIS IS A MOD LIBRARY | FOR USE AS A DEPENDENCY.<br /><span style="background-color: #f1c40f;">IF YOU'RE A NORMAL USER, DON'T DOWNLOAD THIS UNLESS ANOTHER MOD TOLD YOU TO.<br />THIS IS NOT A MOD, JUST SOMETHING THAT MAKES MODS WORK.</span></span></strong></p> <h2 style="text-align: left;">Supported Architectures:</h2> <ul> <li style="text-align: left;">Windows x86</li> <li style="text-align: left;">Linux x86 (Linux ARM not supported by the game, and won't be supported by this mod at the moment)</li> <li style="text-align: left;">MacOS (x86 + Apple Silicon/ARM)</li> </ul> <h2 style="text-align: left;">How to use:</h2> <p style="text-align: left;">First, add this mod as a dependency to your mod.</p> <pre class="language-javascript"><code>"dependencies": { "game": "*", "vssherpaonnx": "*" }</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">Then, directly download the mod and extract <em>VintagestoryAPI.dll</em> onto the root (or src, or whatever you use) folder of your mod.<br />Once that's done, edit your CSProj to include the following:</p> <pre class="language-javascript"><code><ItemGroup> <Reference Include="vssherpaonnx"> <HintPath>$(MSBuildProjectDirectory)\vssherpaonnx.dll</HintPath> <Private>false</Private> </Reference> </ItemGroup></code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">Then, include the API in any files that need it.</p> <pre class="language-csharp"><code>using VSSherpaOnnx;</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;"> </p> <p style="text-align: left;">You can now save a reference (store a variable) to the resolved Sherpa assemblies via:</p> <pre class="language-cpp"><code>var sherpaAsm = VSSherpaOnnxSystem.EnsureSherpaReady(api);</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">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:</p> <pre class="language-csharp"><code>var offlineTtsType = sherpaAsm.GetType("SherpaOnnx.OfflineTts", throwOnError: true);</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">Finally, here are some helper/debug print functions:</p> <pre class="language-csharp"><code>static string VSSherpaOnnxSystem.GetResolvedRid() static string VSSherpaOnnxSystem.GetResolvedNativeDirectory() static string VSSherpaOnnxSystem.GetManagedWrapperPath()</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">Do <strong>not</strong> attempt to call the following manually:</p> <pre class="language-csharp"><code>LoadFromAssemblyPath NativeLibrary.Load</code></pre> <p style="text-align: left;"> </p> <p style="text-align: left;">Have fun!</p> <p style="text-align: left;"> </p> <p style="text-align: left;"> </p> <p style="text-align: left;"> </p> <p style="text-align: center;">This mod is brought to you by...</p> <p style="text-align: center;"><img src="https://github.com/HugoCortell/vs_rptts/blob/main/media/coopinvite.png?raw=true" alt="" width="643" height="178" /></p> <p style="text-align: center;"><a href="https://discord.gg/XggWcvAqG9" target="_blank" rel="noopener">The Unofficial Vintage Story Modding Co-op, click here to join.</a><br />As modders, we can help each other make even better stuff. Plus, we have dedicated channels for better organization.</p>
Ratings & reviews
Sign in to leave a rating or comment.
