Category : text-to-speech

I’m trying to synthesize a text to a .wav file. This works like expected. Except that it’s not available until a very long time after creation. File file = // file in temp directory tts.synthesizeToFile("This is an example text", null, file, null); and then using this file to create a MediaPlayer: MediaPlayer player1 = MediaPlayer.create(context, ..

Read more

I am working with TextToSpeech in Android and following a tutorial, I implemented in a Demo as shown below class MainActivity : AppCompatActivity(), TextToSpeech.OnInitListener { private var tts: TextToSpeech? = null //Variable for text to speech private lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) //Initialize the Text to ..

Read more

When following tutorials, "this" is used for context however, "Context! was expected" is the error that pops up. I also tried getActivity(), which gave an unresolved reference. A third option I tried, was Activity which gave the error, " Classifier ‘Activity’ does not have a companion object, and thus must be initialized here" current code ..

Read more