Giter Club home page Giter Club logo

texttospeechplugin's Introduction

Text To Speech Plugin for Xamarin and Windows

Simple and elegant way of performing Text To Speech across Xamarin.iOS, Xamarin.tvOS, Xamarin.macOS Xamarin.Android, Windows, and Xamarin.Forms projects.

Setup

Build status:

I have been working on Plugins for Xamarin for a long time now. Through the years I have always wanted to create a single, optimized, and official package from the Xamarin team at Microsoft that could easily be consumed by any application. The time is now with Xamarin.Essentials, which offers over 50 cross-platform native APIs in a single optimized package. I worked on this new library with an amazing team of developers and I highly highly highly recommend you check it out.

Additionally, Xamarin.Essentials is now included in & .NET MAUI.

Due to the functionality being included "in the box" I have decided to officially archive this repo.

Platform Support

Platform Version
Xamarin.iOS iOS 7+
Xamarin.Android API 10+
Windows 10 UWP 10+
Xamarin.Mac All
Xamarin tvOS All

Features

  • Speak back text
  • Pitch
  • Volume
  • Speak Rate
  • Locale/Language of Speech
  • Gather all available languages to speak in

Usage

Simple Text

await CrossTextToSpeech.Current.Speak("Text to speak");

Advanced speech API

/// <summary>
/// Speack back text
/// </summary>
/// <param name="text">Text to speak</param>
/// <param name="crossLocale">Locale of voice</param>
/// <param name="pitch">Pitch of voice (All 0.0 - 2.0f)</param>
/// <param name="speakRate">Speak Rate of voice (All) (0.0 - 2.0f)</param>
/// <param name="volume">Volume of voice (0.0-1.0)</param>
/// <param name="cancelToken">Cancel the current speech</param>
public async Task Speak(string text, CrossLocale crossLocale = null, float? pitch = null, float? speakRate = null, float? volume = null, CancellationToken cancelToken = default(CancellationToken))

CrossLocale I developed the CrossLocale struct mostly to support Android, but is nice because I added a Display Name.

You can query a list of current support CrossLocales on the device:

/// <summary>
/// Get all installed and valide lanaguages
/// </summary>
/// <returns>List of CrossLocales</returns>
public Task<IEnumerable<CrossLocale>> GetInstalledLanguages()

Each local has the Language and Display Name. The Country code is only used in Android. If you pass in null to Speak it will use the default.

Implementation

  • iOS: AVSpeechSynthesizer
  • Android: Android.Speech.Tts.TextToSpeech
  • Windows: SpeechSynthesizer + Ssml support for advanced playback

Windows Phone You must add ID_CAP_SPEECH_RECOGNITION permission

Branches

Main branch is always the current development beta branch. This means that all new work can be done off this branch. For each release of a stable NuGet package a new release branch will be created so any additional hot fixes could be done off of that branch.

License

Under MIT, see LICENSE file.

texttospeechplugin's People

Contributors

alfredmyers avatar aritchie avatar jamesmontemagno avatar manhducit avatar nexxuno avatar smstuebe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

texttospeechplugin's Issues

Calling CrossTextToSpeech.Current.Dispose() prevents it from reinitialzing

Maybe I'm expecting different behavior, but here is what I came across. I'm more than happy to fix the bug and create a pull request, but I wanted to make sure I was using it correctly.

Bug Information

Version Number of Plugin: 3.0.1.0
Device Tested On: Android Device (custom hardware)
Simulator Tested On: N/A
Version of VS: VS 2017
Version of Xamarin: Xamarin.Android projects v8.0.99.67
Versions of other things you are using:

Steps to reproduce the Behavior

CrossTextToSpeech.Current.Dispose();
await CrossTextToSpeech.Current.Speak("Some text");

Expected Behavior

System speaks "Some text"

Actual Behavior

Error is thrown

Exception occured in TTS.Speak for direction text.: Object reference not set to an instance of an object.: at Plugin.TextToSpeech.TextToSpeech.Speak (System.Nullable`1[T] cancelToken) [0x000b0] in C:\projects\texttospeechplugin\src\TextToSpeech.Plugin.Android\TextToSpeech.cs:150
11-04 13:14:46.015 E/HockeyApp(16533): at Plugin.TextToSpeech.TextToSpeech+d__11.MoveNext () [0x001ab] in C:\projects\texttospeechplugin\src\TextToSpeech.Plugin.Android\TextToSpeech.cs:91

Code snippet

Believe the issue is here where "textToSpeech" is null

var result = textToSpeech.IsLanguageAvailable(locale);

And in dispose it makes "textToSpeech" null, but doesn't set "initalized" back to false

Screenshots

N/A

[Feature Request] Allow pause between two sentences.

Hi James,

This is awesome plug-in, really simple and clean.
What I want to request is to allow a variable pause between two phrases.

Use case: I need to implement a read-aloud section (a paragraph of 3-10 lines) with pauses at some place.

What happens right now is, the plug-in reads the para is a somewhat "symmetrical" pattern.
I know there is a speakRate option however it is applied uniformly to the entire paragraph

Wouldn't it be nice, if you can come up with a small internal parser which reads some token like [3S] or ^2^ which would let the speaker engine pause momentarily.

For example:
var LongText = "Dorothy is a young girl who lives with her Aunt Em and Uncle Henry and her little dog Toto on a farm in the Kansas prairies. ^2^ One day, Dorothy and Toto are caught up in a cyclone that deposits her farmhouse into Munchkin Country in the magical Land of Oz. "

CrossTextToSpeech.Current.Speak(LongText,
pitch: (float)1.2,
speakRate: (float)1,
volume: (float)1.5,
crossLocale: locale);

as in the above example the speaker engine would wait for 2 seconds before speaking the second sentence.

Hope this is achievable and I am not asking too much. ๐Ÿ‘

Error with TTS engine on progress listener

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

https://gist.github.com/EmilAlipiev/37cac6fa6c10ebdb1ad1cd5ecae75a98#file-gistfile1-txt

Version Number of Plugin: 3.3.2
Device Tested On: on different devices in production
Simulator Tested On:
Version of VS: 2017 latest update
Version of Xamarin: 2.5.0.280555
Versions of other things you are using:

Steps to reproduce the Behavior

Simple call like below
await Plugin.TextToSpeech.CrossTextToSpeech.Current.Speak(textToSpeech, crossLocale: Settings.CurrentLocale, cancelToken: ct);

Expected Behavior

Actual Behavior

I am seeing exceptions in my app center as in the link. Do you have any idea what could be the reason? I dont have any steps to reproduce as I only see in the exception logs on production for some devices. I logged information only if device has Supported and it is always IsSupported=true

This functionality is not implemented in the portable version of this assembly

I just created a new Cross Platform Xamarin Project. I added the Xam.Plugins.TextToSpeech plugin to the solution which added it to the core project and all the platform projects (Droid, IOS, WPF & UWP). The project compiles fine and I am able to use the Plugin in the Android project and it works. I am however getting the above exception. This functionality is not implemented in the portable version of the assembly when I run the UWP project in the simulator. I've tried removing the nuget package from the UWP project then adding it back. I did this for individual project and then again for the entire solution, cleaning the project, deleting all the files under bin, rebuilding all several times but still get the same error. To investigate this I looked in the bin folders of the various projects to confirm which version of the plugin dll is being deployed for each project and what I found is that the same plugin dll which is deployed to the core project is what is deployed to the UWP and WPF projects. Same size, same timestamp. The one deployed to the android project is larger. I confirmed this several times after uninstalling and reinstalling the nuget package, cleaning and rebuilding all.

I was able to work around it by poking into the nuget package itself and copying the correct plugin dll to the bin\x86\debug folder to overwrite the stub dll and for it to actually work to the bin\x86\debug\AppX folder. This way the correct dll was deployed to the simulator and it worked.

However I know if I rebuilt the project again same thing would happen. The second thing I noticed in the package is that there is also no folder for WPF in the lib folder. All I saw were monoandroid71, netstandard1.0, netstandard2.0, uap10.0.15063, xamarinios10, xamarinmac20 and xamarintvos10. No WPF and what is deployed in the debug folder of the wpf project is the same stub dll deployed in the core project.

Is this a bug or am I doing something wrong.

Version Number of Plugin: 4.0.0.77
Device Tested On:
Simulator Tested On: Visual Studio 2017 UWP Simulator
Version of VS: Community 2017, 15.8.5
Version of Xamarin: 4.11.0.776
Versions of other things you are using:

Add Xam.Plugins.TextToSpeech to cross platform solution

Calling CrossTextToSpeech.Current should return the platform specific implementation of the ITextToSpeech interface,

Calling CrossTextToSpeech.Current throws exception "This functionality is not implemented in the portable version of this assembly....."

Mvx.RegisterSingleton(CrossTextToSpeech.Current);

[Bug] Long text on android fails

Bug

Version Number of Plugin: Latest 2.0.0
Device Tested On: Android
Simulator Tested On: Android

Expected Behavior

All length of text that is passes

Actual Behavior

Fails silently

Steps to reproduce the Behavior

Send a long string over the limit.

[Help Needed and Feature Request] Choosing the speech engine and locale

Please fill out either the bug or feature request section and remove whatever section you are not using.

Feature Request:

I don't know if this can be done or not. If it can be done, please guide me.
But, it would be nice to be able to choose the Speech Engine and a locale of our choice.

I found that locale can be set, but I couldn't get it working. I wanted to set "en_IN" as the locale to be used. how do I do that?

TextToSpeechPlugin not working on Android

In Xamarin Forms the plugin is working on Windows Phone, and Desktop.
On Android, it fails with Null Exception Java Class not Found. (Debugging is turned off, I have no other diagnostics save the exception.)

I am using the simple call:

await CrossTextToSpeech.Current.Speak("Text to speak");

No Arabic text to speech on Android

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.0.0
Device Tested On: Samsung Galaxy S7 Edge
Simulator Tested On: Visual Studio Emulator for Android, Similar to Samsung Galaxy S5, Sony Experia Z

Expected Behavior

Should say Arabic words in Text to Speech functionality

Actual Behavior

Not saying Arabic words. It doesn't say anything, just a very short beep. I haven't tried it on iOS yet so not sure if it works there or not.

Steps to reproduce the Behavior

I used the following code in a Xamarin.Forms project class:

Plugin.TextToSpeech.Abstractions.CrossLocale locale = new Plugin.TextToSpeech.Abstractions.CrossLocale();
locale.Language = "ar";
locale.Country = "eg";
Plugin.TextToSpeech.CrossTextToSpeech.Current.Speak("ู‡ูŠุง ุจู†ุง ู†ู„ุนุจ", false, locale);

Please note that I tried it with and without setting the locale language and country variables.

Thank you very much

TextToSpeech Doesn't Work Inside the OnSleep Method inside the App.xaml.cs

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: v3.0.1
Device Tested On: Android
Simulator Tested On: Android
Version of VS: Visual Studio 2017 Community
Version of Xamarin: Lastest
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

The text to speech will work inside the App.xaml.cs OnSleep() method

Actual Behavior

It doesn't work after I put inside the OnSleep() method

Code snippet

protected override void OnSleep()
{
    // Handle when your app sleeps
    CrossTextToSpeech.Current.Speak("My Text To Speech Sample");    
}
### ScreenShot
none


[Feature Request] Allow getVoices( ) and setVoice( ) on Android

The title is fairly self-explanatory, I think. Eventually I want to be able to use alternate voices, and while it looks like I might be able to sneak it in through the existing crossLocale parameter (given the Android docs, assuming API 20+), I'd have to wrangle with it a bit to get there.

Would there be interest if I forked out a branch to try implementing that myself?

  • Eric F.

No sound on actual iOS devices, but working on simulators

Bug Information

No sound on physical iPhone 7 running IOS 11.4.1

Version Number of Plugin: 4.1.0.1-beta (and prior release version as well)
Device Tested On: iPad and iPhone, Working on iPad, not iPhone. Could be iOS 11.4.1 issue.
Simulator Tested On: iPad and iPhone 7 version 11.4

Version of VS: VS for Mac 7.6
Version of Xamarin: Xamarin.IOS 11.14

Steps to reproduce the Behavior

Installed nuget package and created simple app to play text to speech.

Code snippet

CrossTextToSpeech.Current.Speak("blah")

[Feature Request] llow custom TTS Engine on Android

Copied from: jamesmontemagno/Xamarin.Plugins#194

Feature Request:

Android allows a TTS Engine (string) to be passed in to the TextToSpeech constructor, it would be nice to have an additional flag for Android to set the package name that is part of the constructor:

See documentation: [Docs](http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#TextToSpeech%28android.content.Context, android.speech.tts.TextToSpeech.OnInitListener, java.lang.String%29)

Modification to allow a TTS engine selection. For Android, generally done through the constructor.


    public void Init()
    {
        Console.WriteLine("Current version: " + (int)global::Android.OS.Build.VERSION.SdkInt);
        Android.Util.Log.Info("CrossTTS", "Current version: " + (int)global::Android.OS.Build.VERSION.SdkInt);

        textToSpeech = new Android.Speech.Tts.TextToSpeech(Application.Context, this,<<TTS ENGINE>>);
    }

Idea would just to have a string on the Android implementation that can be set and modified.

After Dispose, TextToSpeech doesnt work

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: latest stable
Device Tested On: UWP local
Simulator Tested On: Any Android Emulator
Version of VS: 2017
Version of Xamarin: 2.5
Versions of other things you are using:

Steps to reproduce the Behavior

using the latest stable, If I use it as blow, it throws the attached exception, I am not sure if I am not supposed to use using,

Expected Behavior

not to throw exception

Actual Behavior

UWP:
https://gist.github.com/EmilAlipiev/dc443b20f442fc482c9750a4f7a2bdfa

Android:
https://gist.github.com/EmilAlipiev/ebcda35b693afe79b58c3d8d2383689b

Code snippet


using (cts = new System.Threading.CancellationTokenSource())
                using (var current = Plugin.TextToSpeech.CrossTextToSpeech.Current)
                {
                    ct = cts.Token;
                    await current.Speak(textToSpeech, crossLocale: Helpers.Settings.CurrentLocale, cancelToken: ct);
                }

Screenshotst

[Documentation request] Update repo to reflect "queue" replacing "cancellationToken"

Obviously you're hard at work on this one! Good timing, by me; it's an excellent fit for my project.

But Intellisense is leaving me rather puzzled, because the method signature it has for Speak() isn't the same as the method signature for the version you've got up here in /src.

I'm trying to write a wrapper for your code which will let me integrate its timings with the rest of the app, so the question of how I access cancellations is of interest to me. And I can work with either - but I gotta have the information on what's up! The docstring is (IMO) not as helpful as it could be... do you mean "True if you want to chain them together, false if you want the new one to cancel the current one"?

Does that imply that you're unifying Task and non-Task cancellation options into that simple boolean? Not a bad idea, although in that case a convenience function of "TTS.StopSpeaking" which cancels without starting a fresh one (possibly with the use of playSilentUtterance, at least on that platform) might be a nice feature to at least pencil in.

(Currently I'm restricted to Android-only but I'm trying to use as many cross-platform components as possible. Amusingly, I arrived at your TTS and Rendy Del Rosario's Device Motion via entirely separate search paths. Both are lovely!)

Cheers,

  • Eric F.

iOS background Speak not speaking

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin:3.3.2
Device Tested On: iphone 6, samsung s7
Simulator Tested On:
Version of VS: 2017
Version of Xamarin: latest stable
Versions of other things you are using:

Steps to reproduce the Behavior

Call ITextToSpeech.Speak from background

Expected Behavior

Actual Behavior

In iOS it doesn't play anything even with "audio" set in background modes of info.plist. In android it works.

Code snippet

Screenshotst

how to get Locales synchronously? Breaking change from version 2 to 3

I need to get Locales synchronously because I am running in a method synchronously in following order

  • get locale
  • do speech
    This was working fine in version 2 but in version 3, It returns a task and I dont understand the reason why I cant run it as synchronously , I tried all the possible methods to wait for result but it looks like it doesnt work. Both below simply should work but when I debug, they dont execute, it seems like getting deadlock. Can you please advise?

var crosslocales = Plugin.TextToSpeech.CrossTextToSpeech.Current.GetInstalledLanguages().GetAwaiter().GetResult();

 private static CrossLocale currentLocale;

        public static CrossLocale CurrentLocale
        {
            get
            {
                if (currentLocale.DisplayName == null)
                {
                    getLocale().Wait();
                }

                return currentLocale;
            }
            set { currentLocale = value; }
        }

        private static async Task getLocale()
        {

            var crosslocales = await Plugin.TextToSpeech.CrossTextToSpeech.Current.GetInstalledLanguages();

            if (crosslocales?.Count() > 0)
                currentLocale = crosslocales.Where(c => c.Language == Helpers.Settings.CurrentCultureInfo.TwoLetterISOLanguageName && (c.Language + "-" + c.Country) == Helpers.Settings.CurrentCultureInfo.Name).SingleOrDefault();
        }

Crash during text to speech init

Bug Information

Version Number of Plugin: 3.0.1
Device Tested On: Lenovo Tab 2 A10-70F
Version of VS: Vs2017 15.3.4
Version of Xamarin: 4.6.3.4, android 7.4.3.1
Versions of other things you are using:

Steps to reproduce the Behavior

Calling TextToSpeech.Speak("") early in software init to avoid delay of first notification

Expected Behavior

Nothing

Actual Behavior

Crash. Note logs are from hockeyapp on release so line numbers are incorrect

Xamarin caused by: android.runtime.JavaProxyThrowable: System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Plugin.TextToSpeech.TextToSpeech.SetDefaultLanguageNonLollipop () [0x00066] in :0
at Plugin.TextToSpeech.TextToSpeech.SetDefaultLanguage () [0x00000] in :0
at Plugin.TextToSpeech.TextToSpeech.Speak (System.Nullable1[T] cancelToken) [0x000eb] in <add0f2db5790433ba58e1776e2a78e01>:0 at Plugin.TextToSpeech.TextToSpeech+<Speak>d__11.MoveNext () [0x001ab] in <add0f2db5790433ba58e1776e2a78e01>:0 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object at Plugin.TextToSpeech.TextToSpeech.SetDefaultLanguageNonLollipop () [0x00066] in <add0f2db5790433ba58e1776e2a78e01>:0 at Plugin.TextToSpeech.TextToSpeech.SetDefaultLanguage () [0x00000] in <add0f2db5790433ba58e1776e2a78e01>:0 at Plugin.TextToSpeech.TextToSpeech.Speak (System.Nullable1[T] cancelToken) [0x000eb] in :0
at Plugin.TextToSpeech.TextToSpeech+d__11.MoveNext () [0x001ab] in :0 <---

Code snippet

Xamarin.Forms.Forms.Init(this,bundle);
// Lots of init here

// Manual pre-init text to speech
var textToSpeech = CrossTextToSpeech.Current;

// Workaround to pre-init the text-to-speech. This causes a longer inital load but makes the reaction to the first event much faster
textToSpeech.Speak("");

App app = new App();
LoadApplication(app);

Cancellation Throws exception

Bug Information

Version Number of Plugin: 3.0.1
Device Tested On: Sony Xperia, Samsung S5
Simulator Tested On:
Version of VS: 2017
Version of Xamarin: 2.4.x
Versions of other things you are using:

Steps to reproduce the Behavior

When I try to cancel using code below; it throws 2 different exception as links below

  public CancellationTokenSource cts { get; set; } = new CancellationTokenSource();
        public System.Threading.CancellationToken ct { get; set; } = default(System.Threading.CancellationToken);

ct = cts.Token;

 await Plugin.TextToSpeech.CrossTextToSpeech.Current.Speak(texttospeak, crossLocale: Helpers.Settings.CurrentLocale, cancelToken: ct);

calling this OnDisappearing function of the page.

 if (ct.CanBeCanceled)
                cts.Cancel();

Expected Behavior

Actual Behavior

1st exception
https://gist.github.com/EmilAlipiev/c9fa5d63f01b279efb39a0c3ef9963ee

2nd exception
https://gist.github.com/EmilAlipiev/b42af633bb7237d0168a8d89d4d980ef

Code snippet

Screenshotst

The speech speed is same

Bug Information

CrossTextToSpeech.Current.Speak( "text", null, null, 0.1f );
CrossTextToSpeech.Current.Speak( "text", null, null, 2.0f );
the both sound similar. no change into the speed

Version Number of Plugin: 3.2.1
Device Tested On: Huawei X2, Samsung Galaxy Tab 2, Huawei P10
Simulator Tested On: none
Version of VS: 2017 ( 15.5.6 )
Version of Xamarin: 4.8.0
Versions of other things you are using:

Steps to reproduce the Behavior

CrossTextToSpeech.Current.Speak( "text", null, null, 0.1f );
...
CrossTextToSpeech.Current.Speak( "text", null, null, 2.0f );

Expected Behavior

To change the speech speed.

Actual Behavior

There is no change into the speech speed.

Code snippet

CrossTextToSpeech.Current.Speak( "text", null, null, 0.1f );
...
CrossTextToSpeech.Current.Speak( "text", null, null, 2.0f );

TextToSpeechPlugin Volume not changing

The following call is executing, but the plugin returns full volume when I set it to zero.

        await CrossTextToSpeech.Current.Speak(s,
            crossLocale: null,
            pitch: 0,
            speakRate: null,
            volume: 0,
            cancelToken: default(CancellationToken));

"s" is a String. Have I got the syntax right?

 Plugin version 3.1.1
 Visual Studio 15.5.5
 Tested on Desktop Windows Version 1709
      Lumia Windows 1607
      Acer Windows 1703
      Droid Turbo Android Version 6.0

No sound when passed a string. Android Live Player.

Bug Information

Version Number of Plugin:
Device Tested On: Samsung SM-G925F Player
Version of VS: Community 2017 (15.6.1)
Version of Xamarin: 2.5.0.280555

Steps to reproduce the Behavior

        CrossTextToSpeech.Current.Speak("Hello, I can speak.");

Expected Behavior

Hear the words

Actual Behavior

Silence

Code snippet

        CrossTextToSpeech.Current.Speak("Hello, I can speak.");

Screenshotst

Recording

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin:
Device Tested On:
Simulator Tested On:

Expected Behavior

Actual Behavior

Steps to reproduce the Behavior

Feature Request:

Does this plugin also record speech and convert to text?

Text with exaclty MaxSpeechInputLength characters will fail silently

Bug Information

Version Number of Plugin: >= v3.0.1
Simulator Tested On: Oreo AVD
Version of VS: 15.6.2

Steps to reproduce the Behavior

Craft a text with exactly MaxSpeechInputLength characters and call Speek()

Expected Behavior

should synthesize text

Actual Behavior

Does not synthesize text nor does it throw exception

Pause, Play, Rewind Functions?

I've searched for quite a wile to see if these functions are already built into this amazing TTS plugin. I have not been able to find its implementation anywhere. Is this something that can be done with this current plugin? And if not, would the creator consider adding this functionality or suggest a way I can get a similar result?
Thanks

The plugin always detects that TextToSpeech has not been initialized yet when calling GetInstalledLanguages() for the first time

When calling GetInstalledLanguages() for the first time, the plugin always detects that the TextToSpeech has not been initialized yet leading to a wrong list of installed languages with a lot of languages which does not supported by TextToSpeech.

  • Root cause:
    The "initialized = true;" line in OnInit() method is put bellow the line "initTcs.TrySetResult(true);".

  • Solution:
    Re-order the two lines above.
    I have created a pull request to provide fixes for this issue. Please help me review and accept the merge
    request.

Bug Information

Version Number of Plugin: v3.2.1
Device Tested On: Asus - Android OS 6.0
Simulator Tested On: Genymotion - Google Nexus 4.4.4
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

Crash after upgrade to 3.1.1 and later with android

Bug Information

from plugin verson 3.1.1 my app immediately crashes with unhandled exception
Plugin.Text To Speech.Abstractions.Text To Speech.Speak not found.

Version Number of Plugin: 3.1.1 and later
Device Tested On: Moto4
Simulator Tested On: none
Version of VS: 2017 15.5.7 community
Version of Xamarin: 2.5.0.280555
Versions of other things you are using:
android 7.0

Steps to reproduce the Behavior

see code snippet

Expected Behavior

using version 3.0.1 is working fine

Actual Behavior

Method is not entered. Excepction will not be caught, app crasshes completly

Code snippet

button with simple method:

        private async void StartAudio(object sender, System.EventArgs e)
        {
            try
            {
                await CrossTextToSpeech.Current.Speak("Test");
            }
            catch (Exception xxx)
            {
                await DisplayAlert("error", xxx.Message, "ok");
            }
        }

Screenshotst

Error in ios

When i call to Speak in iOS throw:

Foundation.MonoTouchException: Objective-C exception thrown. Name: com.apple.coreaudio.avfaudio Reason: required condition is false: IsFormatSampleRateAndChannelCountValid(format)

This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation

Hi @jamesmontemagno

I am getting following error while executing await CrossTextToSpeech.Current.Speak(text);. Am I missing anything?

System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
at Plugin.TextToSpeech.CrossTextToSpeech.get_Current () [0x00012]

Crosslocale doesn't seem to be working

Version Number of Plugin: 2.0.0
Device Tested On: Sony Experia z3 android 6.0.1

I tried to set as below and tested with german and spanish languages but everytime, I get English accent. I compared language and displayname from the avilable list and they are set correctly for both languages.
I expect native speech. Do I understand this wrong? Do i do something wrong?

  var crosslocale = new Plugin.TextToSpeech.Abstractions.CrossLocale()
            {
                 Language = CurrentCultureInfo.TwoLetterISOLanguageName,
                  DisplayName = CurrentCultureInfo.DisplayName,
                   
            };

 Plugin.TextToSpeech.CrossTextToSpeech.Current.Speak(text, crossLocale: crosslocale)

Crashes sometimes occur in case of cancellation when several requests are pending

Crashes sometimes occur in case of cancellation when several requests are pending.

Following update corrects the issue:
In the Speak(...) function (TextToSpeech.Plugin.iOS/TextToSpeech.cs line 50), just after:
await semaphore.WaitAsync(cancelToken);
Add:
cancelToken.ThrowIfCancellationRequested();

(Before calling: await SpeakUtterance(speechUtterance, cancelToken);)

Bug Information

Version Number of Plugin: 3.0.1
Device Tested On: iPhone 6 (11.1)
Simulator Tested On:
Version of VS: 2015 (14.0.25431.01 update 3)
Version of Xamarin: 4.7.10.33
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

Suggestion: Please add Pause/Resume functionality

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin:
Device Tested On:
Simulator Tested On:
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

iOS speech pitch, rate, and volume do not affect speech output

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 3.0.1
Device Tested On: iPhone 5s iOS 11 beta 2
Simulator Tested On: iPhone 7 iOS 10.3.2
Version of VS: 7.0.1 macOS
Version of Xamarin: 6.3
Versions of other things you are using:

Steps to reproduce the Behavior

Installed nuget package for my app Scanco Warehouse 100. Downloaded current master repo and ran it.

Expected Behavior

Pitch, rate, and volume options should affect the speech.
Android functions as expected.

Actual Behavior

Changing pitch, rate, and volumne has no effect on the speech in iOS.

Code snippet

Screenshot

Text with exaclty MaxSpeechInputLength characters will fail silently

Bug Information

Version Number of Plugin: >= v3.0.1
Simulator Tested On: Oreo AVD
Version of VS: 15.6.2

Steps to reproduce the Behavior

Craft a text with exactly MaxSpeechInputLength characters and call Speek()

Expected Behavior

should synthesize text

Actual Behavior

Does not synthesize text nor does it throw exception

Cannot await void on Speak()

Bug

Version Number of Plugin: 2.0.0
Device Tested On: OnePlus Two
Simulator Tested On: -

Expected Behavior

being able to await Speak()

Actual Behavior

cantawaitvoid

Steps to reproduce the Behavior

Add the plugin version 2.0.0 from nuget
Make an async method and use Speak() like in the getting started:
await CrossTextToSpeech.Current.Speak("Text to speak");

It's really weird, as i can see on the source here on github, that ITextToSpeech Speak() returns a Task, however when i check the code it says void:
cantawaitvoid2

Any help is appreciated! I might just be failing ;)

Android crashes when Locale not found. Default as English?

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 3.0.1
Device Tested On: Sony Xperia Z3 Android 6.0.1
Simulator Tested On:
Version of VS: 2017
Version of Xamarin: Latest
Versions of other things you are using:

Steps to reproduce the Behavior

If I understand correctly we have to query for selected locale in android as in the given sample

           ```
         languageButton.Text = selected;

			if (Device.RuntimePlatform == Device.Android)
				locale = locales.FirstOrDefault(l => l.ToString() == selected);
			else
				locale = new CrossLocale { Language = selected };//fine for iOS/WP
So in UWP and IOS, it is enough to pass language code.  

### Expected Behavior

Is there a possibility to use have default as English, in any case, if CrossLocales is null or queried CrossLocale  not found. I believe this was behavior in earlier version. 

### Actual Behavior

I had mistake and CrossLocale was returning nothing in Android, application was doing nothing (i didnt event get exception. 

### Code snippet

### Screenshotst


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.