At the phoneme level, a text-to-speech system is usually tied to the phoneme set of the language a voice was built from. This is usually because modern speech synthesizers (MBROLA, Cepstral, AT&T, etc.) use recorded voice samples in a diphone database (sampling phoneme pairs from the recorded data). This allows them to sound more natural.
As a result of this, the phoneme set is restricted to the voice's language. Thus, handling IPA phonemes not in the target voice is one problem you need to solve in interpreting IPA phoneme strings.
This is further complicated as the underlying phoneme model is likely a simplistic one that does not model phoneme features (e.g. voiceless bilabial fricative) that can be mapped from one phoneme scheme to another.
The eSpeak text-to-speech engine comes close to this in that its model is based around phoneme features and it can support a large number of languages, but it has taken the choice of using a language per voice.
I am in the process of building the Cainteoir text-to-speech engine that will use phoneme features to model phonemes, providing transcription schemes to map to/from that model and separating language and voice. That is, each language and voice specify the phonemes they support, allowing a voice to speak different languages and each language to be used by multiple voices.
The other problem comes in identifying what text is IPA and what is not. This is complex as /jes/ could be IPA or could be jes in italics. Also, gin could be IPA or could be a word depending on context. This can be seen in the way different text-to-speech systems handle roman numerals (I, II, III, IV, V, ...): consider "Chapter I was the Chapter I was reading." and "Henry IV was placed on an IV drip."
Text-to-speech programs will often support SSML (Speech Synthesis Markup Language) that allows you to write <phoneme alphabet="ipa" ph="jes">yes</phoneme> to specify IPA phonemes. Different text-to-speech programs will handle this differently, for example Cepstral only supports their Arpabet-like phonemes.
UPDATE:
The text-to-speech engine will express phonemes in their own phoneme transcription scheme that expresses the phonemes the voice supports. For Cepstral this is based on Arpabet (the US voice uses the CMU pronunciation dictionary with lower case phonemes); for MBROLA this is based on SAMPA (with each voice supporting the corresponding language-based SAMPA phonemes and some additional phonemes); for eSpeak this is based on Kirshenbaum.
The problem then becomes (a) reading the IPA text and (b) mapping the phonemes to the phonemes supported by the voice. A lot of text-to-speech engines don't bother as they do not have the need to support this (dictionary entries are specified in the voice's phoneme transcription scheme).
The approach I am taking is to express a phoneme transcription scheme as a collection of text => features
mappings such as /s/ {vls,alv,frc}
(ipa: https://raw.github.com/rhdunn/cainteoir-engine/master/data/phonemes/ipa.phon, ascii-ipa: https://raw.github.com/rhdunn/cainteoir-engine/master/data/phonemes/ascii-ipa.phon).
The idea here is to store the phonemes internally as a sequence of feature groups, allowing transcription => features => transcription
. This then supports, for example, MBROLA voices reading Unicode-based IPA transcriptions. Here, each voice will have their own features => transcription
mapping that maps several feature groups to the same transcription. For example, an English voice could pronounce /r/ and /ɹ/ as /ɹ/ as {vcd,alv,trl}
and {vcd,alv,apr}
could map to the same phoneme /r/.
UPDATE 2:
Using ˌoʊkeɪˈhiːɹjəˌgoʊ as an example, the transcription for eSpeak is:
$ espeak -v en --ipa "[[,oUkeIh'i@j@g,oU]]"
ˌəʊkeɪhˈiəjəɡˌəʊ
for British English, and:
$ espeak -v en-US --ipa "[[,oUkeIh'i:rj@g,oU]]"
ˌoʊkeɪhˈiːrjəɡˌoʊ
for American English. You can also get it to output the MBROLA phonemes, e.g.:
$ espeak -v mb-de5-en --pho "[[,oUkeIh'i@j@g,oU]]"
@ w k E j h i: @ j @ g @ w
The MBROLA phonemes are actually listed one per line with duration and pitch contour information, but I have excluded that for brevity.
Therefore, eSpeak would need to map ˌoʊkeɪˈhiːɹjəˌgoʊ to ,oUkeIh'i:rj@g,oU
for the en-US voice, ,oUkeIh'i@j@g,oU
for the en voice and @ w k E j h i: @ j @ g @ w
for the MBROLA de5 voice.