Text to speech is different to Talkback. There is a question on this here
Text to speech is a voice synthesis tool that can be used by apps to convert text to speech. One of the Google provided apps called TalkBack uses this as a screen reader for those who may find it difficult to read or see the screen.
I think what you want to activate is TalkBack as a screen reader - this means if you wanted to do it via the emulator you would have to install TalkBack on your emulator. The answers here may be able to help you, either by downloading the APK from the store or by just opening Google Play from the emulator and installing it. I recommend you go through the tutorial before diving in, as TalkBack uses gestures to navigate. You might not have success as swipes tend to have "levels" (a programmatic adb swipe is different from a swipe with a finger physically on the screen for some odd reason) when it comes to accessibility.
I have found it much easier to test accessibility on real devices, as adb controls are limited. I am trying to improve the situation with my code, but it's slow going and TalkBack is far from perfect.
Update 1 Jun 2023
- Google API's are required for any speech synthesis on Android devices. Please check your emulator has Google API's - this is not a guarantee it will work though.
- I have released a developer and QA tool called the Android Ally - it allows developers to install and use TalkBack on devices and emulators without having to use the gestures or download it from the Play Store.