dlutton/flutter_tts

Fluttertts not working in ios

Opened this issue ┬╖ 2 comments

ЁЯРЫ Bug Report

Expected behavior

I want fluttertts to speak all words and sentences.
But fluttertts is only speaking dot, comma, exclamatory dot or some other symbols

Reproduction steps

Configuration

flutter_tts: ^4.0.2

Platform:
ios 17.2

Code sample is

import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tts/flutter_tts.dart';

class Transliterate extends StatefulWidget {
final String _storyID;
final String o_text;
final FlutterTts flutterTts ;

Transliterate(this._storyID, this.flutterTts, String o_text) : o_text = o_text;

@OverRide
_TransliterateState createState() => _TransliterateState();
}

enum TtsState { playing, stopped, paused, continued}

class _TransliterateState extends State {
CollectionReference stry = FirebaseFirestore.instance.collection('stories');
String? txt;
String? language;
double volume = 0.5;
double pitch = 1.0;
double rate = 0.5;

TtsState ttsState = TtsState.stopped;

get isPlaying => ttsState == TtsState.playing;
get isStopped => ttsState == TtsState.stopped;
get isPaused => ttsState == TtsState.paused;
get isContinued => ttsState == TtsState.continued;

Future _speak() async {
await widget.flutterTts.setVolume(volume);
await widget.flutterTts.setSpeechRate(rate);
await widget.flutterTts.setPitch(pitch);

//for testing
// FlutterTts flut = FlutterTts();
// String text = "рдПрдХрд╛ рдЬрдВрдЧрд▓рд╛рдд рдПрдХ рдЫреЛрдЯрдВ рдЬрд▓рд╛рд╢рдп рд╣реЛрддрдВ рддреНрдпрд╛рдордзреНрдпреЗ рдПрдХ рдмреЗрдбреВрдХ рд░рд╛рд╣рдд рд╣реЛрддрд╛ рддреНрдпрд╛рд▓рд╛ рдПрдХрдЯреЗрдкрдгрд╛ рдЬрд╛рдгрд╡рдд рд╣реЛрддрд╛ рддреНрдпрд╛рд╕рд╛рдареА.";
// await flut.setLanguage("mr-IN");
// await flut.setVolume(0.5);
// await flut.setSpeechRate(0.5);
// await flut.setPitch(1);
// await flut.speak(text);
// print(text);

if (language == "Gujarati") widget.flutterTts.setLanguage("gu-IN");
if (language == "Bengali") widget.flutterTts.setLanguage("bn-IN");
if (language == "Telugu") widget.flutterTts.setLanguage("te-IN");
if (language == "Marathi") widget.flutterTts.setLanguage("mr-IN");
print(language);
await widget.flutterTts.awaitSpeakCompletion(true);
var result = await widget.flutterTts.speak(txt!);
if (result == 1) setState(() => ttsState = TtsState.playing);

}

Future _stop() async {
var result = await widget.flutterTts.stop();
if (result == 1) setState(() => ttsState = TtsState.stopped);
}

Future _pause() async {
var result = await widget.flutterTts.pause();
if (result == 1) setState(() => ttsState = TtsState.paused);
}

te-IN not working in version flutter_tts: 4.0.2 & flutter version 3.22.3