Git Product home page Git Product logo

cordova-plugin-tts-advanced's Introduction

Hi ๐Ÿ‘‹, I'm Sebastiaan

A passionate full stack developer from Groningen, the Netherlands

๐Ÿ‘จโ€๐Ÿ’ป All of my projects are available at Enkodo

๐Ÿ’ฌ Ask me about angular, sql, node

๐Ÿ“ซ How to reach me sebastiaan[@]enkodo.nl

๐Ÿ“„ Know about my experience on codersrank

Connect with me:

sebastiaanpasma

Languages and Tools:

angular appwrite bash blender chartjs css3 docker electron express figma firebase git illustrator ionic jasmine javascript laravel linux mariadb mysql nginx nodejs opencv php postman pytorch reactnative sass sketch sqlite tensorflow typescript webpack

cordova-plugin-tts-advanced's People

Contributors

alparslanahmed avatar anagrath avatar andrewmilson avatar hypery2k avatar maolion avatar nenahov avatar nosz avatar p4bl1t0 avatar saqimtiaz avatar spasma avatar vilicvane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cordova-plugin-tts-advanced's Issues

getVoices() unexpected behavior

If I call TTS.getVoices().then( function(x) { alert(JSON.stringify(x)); } );, I get some unexpected stuff:

  • Android: nothing happens, .then() is never called.
  • iOS: app force-closes.

Aside: what is the purpose of this function? I was hoping to get something back I could use to call speak() with an explicit voice specified. It's not documented in the README, so maybe I just shouldn't be calling it! ;)

Why is category removed from TTS.IOptions?

Category has been removed from TTS.IOptions in commit fafba8c.

Why is this change?

The category option is a flag required to mute TTS when the mute mode is turned on on the iPhone.

    NSString* category = [options objectForKey:@"category"];

    [[AVAudioSession sharedInstance] setActive:NO withOptions:0 error:nil];
    if ([category isEqualToString:@"ambient"]) {
        [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient
                                         withOptions:0 error:nil];
    } else {
        [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
                                         withOptions:AVAudioSessionCategoryOptionDuckOthers error:nil];
    }

Thank you,

App crashes with admittedly dumb inputs (numeric identifier)

Due to a dumb bug on my end, I was passing "identifier: 1" to this plugin (numeric value, not string), and this causes the app to crash on iOS.

In case this is at all useful, I tested other (potentially dumb) inputs:

  • Android:
    • No locale: plays voice (system default) ๐Ÿ†—
    • Invalid locale, no identifier: plugin error callback with message "length=1; index=1". โ“
    • Invalid identifier: plays voice (locale default) ๐Ÿ†—
  • iOS
    • No locale: plays voice (system default) ๐Ÿ†—
    • Invalid locale, no identifier: plays voice (system default) ๐Ÿ†—
    • Invalid identifier: plays voice (system default, not locale default) (related: #9) โ“
    • Numeric identifier: app crashes ๐Ÿ’ฅ

Problem when trying to install plugin

When I try to install the plugin using the command: cordova plugin add cordova-plugin-tts-2

It gives an error:

npm ERR! 404  'cordova-plugin-tts-2' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

However, the following command works: npm i cordova-plugin-tts-advanced

TTS openInstallTts Plugin CDVTTS does not respond to method call openInstallTts (iOS)

Hi there,

I made a button called: Install voices, which when clicked on android goes to the correct page to select a voice.
However, this button gives the following errors when clicked on iOS:

To Native Cordova ->  TTS openInstallTts TTS1400231065 ["options": []]
Error: Plugin CDVTTS does not respond to method call openInstallTts:.
Ensure plugin method exists and uses @objc in its declaration

I need this working on iOS since the only voice a user can at this point select is the default Xander voice (dutch). This means that the user needs to have the option to install other dutch voices in their phone.

Looking at the native Objective C code, this method does not seem to exist yet for iOS.
I'm going to try and find out how I can open this specific settings page in iOS native and see if I can help make this functionality for the plugin since I need it for our next version of our app.

I have little to no experience in Objective C so I made a stackoverflow post here:
https://stackoverflow.com/questions/66919691/how-can-i-open-the-install-voices-settings-page-in-objective-c-ios

waiting for stop event.

Hey,

apparently when I do:

TTS.stop().then(() => {
          this.isTalking = false;
          console.log('stopped');
        }).catch((reason: any) => {
          this.isTalking = false;
          console.log(reason);
        });

The then and catch are not being called...
The stop is being called though, so I think I'lll just remove the .then and set it to false after calling stop.

It is nice to have a callback to know whether it stopped or errored out for some reason though.

How do I use this with typescript and ionic?

Dear spasma,

I would like to use your plugin since it supports voice.
However, I'm unable to figure out which typescript plugin to import because I can't seem to find any type declarations other than in the readme.

Are we supposed to add this typescript ourselves somewhere?

I would like to use this inside of ionic, ionic-native has wrapper typescript for the cordova-plugin-tts.
But this is not available for cordova-plugin-tts-advanced...

I'll go ahead and try to create a index.d.ts file and make a pull request, see if that works...
If you would also like to help me out on this issue I would very much appreciate it.

then not called on Android

As it says, then() is not called after successful speak() on Android 7.0 (what I tested with). It works on iOS.

Pitch doesn't work anymore since the last update of Google Speech Services

I get the impression that the bug is generated once the voice package is downloaded and cached. I have tested in 3 mobile phones: Samsung A21, Oppo reno7, and a Motorola. Pitch changes only works on Android studio Emulator.

Is there are any solution for this?

You can try using this plugin for a couple of minutes then turn off your mobile, turn on and then the bug will occur

Name is the same as identifier when fetching voices (Android)

Hey,

I'm trying to implement an ion-select where the user is able to select which voice they want to use inside of the app.
However, both the name and identifier of a voice is the same in android. Normally you would see voice 1 or voice 2 on android as name of the voice when you look in the settings for switching voices. But this is returning the same data as the identifier.

This way users will have a hard time figuring out which voice is which, because these strings look quite tedious instead of having an actual name for the voice.

There is also no "default" property for the voices. This way I'm unable to set the ion-select to the default value of the device.

I haven't tested this on iOS yet.

EDIT: I just tested this on iOS, and there it does seem to show a correct name, but still not a default property.

Voice on samsung is slow

On the other devices it works, but on samsung the voice is very slow, I don't know if it is because maybe it uses Samsung TTS and not Google TTS.

Voice not selected by language/locale on iOS

On iOS, voice selection works OK when I include a valid "identifier" from getVoices(), e.g.

TTS.speak({
    text:"sample text", cancel:true, pitch:1, locale:"en-IN", identifier:"com.apple.ttsbundle.Rishi-compact"
}).then(...); // en-IN voice heard, as expected.

But when I call speak() with locale only (no identifier), it seems it uses the system language always, regardless of which locale I specify.

TTS.speak({
   text:"sample text", cancel:true, pitch:1, locale:"en-IN"
}).then(...); // System/default voice is heard, not en-IN voice.

Looking over logic in CDVTTS.m, seems this might not be by design.

  • Tested on iPhone 12 mini
  • Android working OK
  • My workaround is to select the first identifier from getVoices() with a matching locale/language. (This works OK.)

Cancel consistency problems

Hey, I don't know if anyone is still looking at this but I am having issues with the cancel argument. From what I understand, if cancel is set to true then the text argument will interrupt any other text that is currently being spoken. What I have found is that this doesn't happen consistently. Right now I have some code to speak a number every time it changes until they get to a goal number.
Every time the number changes this is run where pickedNumber is the new number:
TTS.speak({text: pickedNumber+' ', rate: listSpeeds.selectionData[0].TTSRate, cancel: true});

Every time the pickedNumber reaches the goal number this is run:
TTS.speak({text: "Complete", rate: TTSRate, cancel: true});

What I have found is that the pickedNumber text does interrupt other text statements, but the "Complete" text does not interrupt the pickedNumber text. I have tried initializing the pickedNumber variable as a string, setting PickedNumber to a number+" ", using the String(pickedNumber) in the text argument, have the text argument be " "+pickedNumber+" ", and have another speak with a text: " " to try to interrupt. Nothing has made "Complete" consistently interrupt the pickedNumber.

If anyone has any insight to this or any tips, let me know. Thank you.

After upgrade to Android 12 on Samsung some languages not working

After I upgraded my Samsung A41 from Android 11 to 12 many languages produces ERR_UNKNOWN
when using TTS.speak function. I used to be able to listen to e.g. with Spanish, Chinese, Dutch, German.
Some still do work, e.g. French, Arabic, English, Portuguese.
I have no clue why some work and some do not anymore.

Unable to get the supported voices

I am trying to fetch all the supported voices using the code provided below:

this.platform.ready().then((source) => {
      this.tts.getVoices().then(voices => {
        console.log(voices);
      }, error => {
        console.log(error);
      });
});

I am just not getting anything. Any help is greatly appreciated.

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.