In terminal on OS X, if you type “say” and hit return the command doesn’t exit and any subsequent things typed in (followed by return) are said by the system. How can this kind of effect be achieved?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you type
catand hit return, the command doesn’t exit and any subsequent things typed in, followed by a return, are printed on the screen (instead of being converted to speech through the speakers, as withsay). So, the easy bit is reading lines until EOF; you can usefgets()for that, easily enough, orgetline().The text-to-speech conversion will be done through calls provided by Apple. You may need to use Objective C to get at the interfaces sensibly, in which case you may also need to use some other input function or convert the string into an appropriate Objective C construct.
The
/usr/bin/saycommand uses the libraries:The combination of AudioToolBox, AudioUnit and CoreAudio will provide the text-to-speech services.