GithubHelp home page GithubHelp logo

Use On .NET UWP about sherpa-onnx HOT 6 OPEN

studionexus-lk avatar studionexus-lk commented on June 11, 2024
Use On .NET UWP

from sherpa-onnx.

Comments (6)

csukuangfj avatar csukuangfj commented on June 11, 2024

Could you post any errors if it does not work for you?

from sherpa-onnx.

studionexus-lk avatar studionexus-lk commented on June 11, 2024

i added nuget package to uwp gui app, while running the app and click on syntisizye it thorws an error

System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'

using Windows.UI.Xaml.Controls;
using SherpaOnnx;
using Windows.Storage.Pickers;
using Windows.Storage;
using System;

namespace TEST
{
   
    public sealed partial class MainPage : Page
    {
        private OfflineTtsConfig config;

        public MainPage()
        {
            this.InitializeComponent();
            config = new OfflineTtsConfig();


        }
   private async void ModelBrowseButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            FileOpenPicker picker = new FileOpenPicker();
            picker.FileTypeFilter.Add(".onnx");
            StorageFile file = await picker.PickSingleFileAsync();
            if (file != null)
            {
                ModelTextBox.Text = file.Path;
            }
        }

        private void SynthesizeButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {

           
        
            config.Model.Vits.Model = ModelTextBox.Text;
            config.Model.Vits.Lexicon = LexiconTextBox.Text;
            config.Model.Vits.Tokens = TokensTextBox.Text;
            config.Model.Vits.DataDir = DataDirTextBox.Text;
 
            config.Model.Debug = DebugCheckBox.IsChecked == true ? 1 : 0;
            config.Model.Provider = "cpu";
           
            float speed = 1.0f / config.Model.Vits.LengthScale;
            int sid = int.Parse(SpeakerIdTextBox.Text);
            OfflineTts tts = new OfflineTts(config);
            OfflineTtsGeneratedAudio audio = tts.Generate(TextTextBox.Text, speed, sid);
            bool ok = audio.SaveToWaveFile(OutputFilenameTextBox.Text);

            if (ok)
            {
                ResultTextBlock.Text = $"Audio saved to {OutputFilenameTextBox.Text}";
            }
            else
            {
                ResultTextBlock.Text = $"Failed to save audio to {OutputFilenameTextBox.Text}";
            }
        }
    }
}

from sherpa-onnx.

csukuangfj avatar csukuangfj commented on June 11, 2024

could you give more error logs?

from sherpa-onnx.

studionexus-lk avatar studionexus-lk commented on June 11, 2024
  Name Value Type
$exception {"External component has thrown an exception."} System.Runtime.InteropServices.SEHException
  Name Value Type
  speed 1 float
  sid 2 int
  tts null SherpaOnnx.OfflineTts
  audio null SherpaOnnx.OfflineTtsGeneratedAudio
  ok false bool
  Name Value Type
TargetSite {IntPtr SherpaOnnxCreateOfflineTts(SherpaOnnx.OfflineTtsConfig ByRef)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
  Attributes Private | Static | HideBySig | PinvokeImpl System.Reflection.MethodAttributes
  CallingConvention Standard System.Reflection.CallingConventions
  ContainsGenericParameters false bool
  CustomAttributes Method System.Reflection.MemberInfo.get_CustomAttributes cannot be called in this context. System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData>
  ▶ DeclaringType {Name = "OfflineTts" FullName = "SherpaOnnx.OfflineTts"} System.Type {System.RuntimeType}
  IsAbstract false bool
  IsAssembly false bool
  IsConstructedGenericMethod Method System.Reflection.MethodBase.get_IsConstructedGenericMethod cannot be called in this context. bool

from sherpa-onnx.

csukuangfj avatar csukuangfj commented on June 11, 2024

tts | null | SherpaOnnx.OfflineTts

Could you find out why tts is null?

from sherpa-onnx.

csukuangfj avatar csukuangfj commented on June 11, 2024

By the way, are you able to run our provided examples on your system?

from sherpa-onnx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.