Speech to ear speaker?
Is there away to use the text to speak so that it outputs to the ear speaker and not the speaker phone?
@dwildbore , hi I used the example below from the Pythonista docs. I am using apple Airpods on iPad 12.5' 2nd gen. The sound worked fine for me. When the AirPods in, the speech came though them and after removal the sound come out of the speaker. I didn't have a wired pair of earphones handy to see if it worked differently or not.
import speech import time def finish_speaking(): # Block until speech synthesis has finished while speech.is_speaking(): time.sleep(0.1) # US English: speech.say('Hello World', 'en_US') finish_speaking() # Spanish: speech.say('Hola mundo', 'es_ES') finish_speaking() # German: speech.say('Hallo Welt', 'de_DE') finish_speaking()
I should have clarified. I mean like the speaker used during a phone call that you hold up to your ear. Good to know the ear pods work tho, i'm hoping to get a pair! thanks!
In case anyone is wondering I got it working:
from objc_util import *
AVAudioSession = ObjCClass('AVAudioSession')
audioSession = AVAudioSession.sharedInstance()
oldCategory = audioSession.category()
speech.say('hello') #like a phone call
speech.say('hello again') # speaker phone