Text to speech?

I know that this functionality is deprecated so I would like to ask if there is any way to integrate an OS-native TTS into supercollider.

The Mac OS X “say” command can be invoked with the unixCmd method and with the right arguments can output to an AIFF file. Something like "say -o something.aiff something".unixCmd(action: {/*some code to process the output file */})

Great, that works somehow! Is there a way to import the sound directly to the sc server? I am interested in using it in a live-coding context so I wouldn’t prefer to work with audio files (if possible).

I don’t think so, because the say command interacts directly with the audio device, but maybe you can use Blackhole or something to create a virtual output that you reroute to a virtual input that you can then monitor from inside scsynth?

Thanks, I figured it out somehow. I use actually the jack server on Linux which makes it possible (I don’t know how it can work in Mac OS X).

I reboot the sc server with a third input bus channel:

s.options.numInputBusChannels = 3
s.reboot

Then I route the PulseAudio JACK Sink to the in_3 of supercollider while disconnecting it from the system.

The synth that does the routing inside sc:

(
SynthDef(\tts_bus, {
	var sig;
	sig = Pan2.ar(In.ar(\in.kr(4)), \pan.kr(0), \amp.kr(0).dbamp);
	Out.ar(\out.kr(0), sig);
}).add;
)

~tts_bus_on = Synth(\tts_bus);

Then I can invoke various ttf apps from sc:

"espeak \"test 1 2 3 \"".unixCmd
"echo \"test 1 2 3\" | festival --tts".unixCmd