I've used portaudio from Python on OS X before for doing this kind of audio manipulation.
the command say is pretty interesting though