views:

22

answers:

1

Hi,

I want to translate text to audio on osx similar as done here: http://developer.apple.com/library/mac/#samplecode/CocoaSpeechSynthesisExample/Introduction/Intro.html . After the sound is finished playing I would like to save it to a buffer for further use in openAL, is that possible?

The only way I see right now is to save the speech as an .aiff and then parse it again for openAL, it would be super great if there was a way which does not involve saving to the harddrive first. (I am also open for a carbon alternative)

+1  A: 

Since Mac OS X 10.6, you can use the Speech Synthesis Manager to speak into a specific audio device.

Peter Hosey
hmm okay, that gives me more options for sure, can the audio device be a simple data buffer though?
No; it must be a device. There are also options for specifying a file URL (same as with NSSpeechSynthesizer) or an ExtAudioFile. Documentation for the latter: http://developer.apple.com/mac/library/documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/ But that won't let you speak into a buffer, either. There appears to be no way to do that. You could create a small RAM disk (using Disk Arbitration to mount it invisibly) and save the file there.
Peter Hosey
another idea, could I redirect the audio to my microphone and simply capture that using openAL?
I think you can only direct it to an output device. Even if you could direct it to one of the input devices, the user would probably hate that if they happen to be voice-chatting with it. Also, there's no guarantee that there is an input device (or an output device, for that matter).
Peter Hosey