Say i want to use the microphone of my smartphone to input text in my terminal, using the google voice2speech engine. How would i do?
I would first listen to the output of google-voice-typing
, (but how?) and then redirect to stdin
.
Is there a simple way with adb
commands?
You can use AndroidViewClient/culebra to
#! /usr/bin/env python3
from com.dtmilano.android.viewclient import ViewClient
helper = ViewClient.view_client_helper()
# mic in voice search widget
obj_ref = helper.until.find_object(body={
'clazz': 'android.widget.ImageButton',
'clickable': True,
'desc': 'Voice Search'
})
response = helper.ui_device.wait(oid=obj_ref.oid)
helper.ui_object2.click(oid=response['oid'])
print('Speak now...')
helper.ui_device.wait_for_window_update()
# text in search results
obj_ref = helper.until.find_object(body={
'res': 'com.google.android.googlequicksearchbox:id/googleapp_srp_search_box_text',
'clazz': 'android.widget.TextView'
})
response = helper.ui_device.wait(oid=obj_ref.oid)
print('Text:')
print(helper.ui_object2.get_text(oid=response['oid']).text)
The output would be like this
Speak now...
Text:
this is another example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.