5

I have about 200 lines of Beowulf which a few friends of mine and I rendered into International Phonetic Alphabet about a year and a half ago. At the time, one of the tools we used to check the pronunciations back was OS X's say command.

Here's the first six lines according to the Klaeber edition of the poem converted into IPA, which I know for certain say can read out properly, because I've run it myself on the MacBook from which I am typing this very question:

hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum
ˈðeːodˌkyniŋɡɑ θrymː jeˈfruːnon
huː ðɑ æðelɪŋɡɑs ˈelːen ˈfremːedon!
oft ʃyld ʃefiŋ ˈʃæɑðenɑ θræːɑtum,
ˈmɑniɣum mæjθum ˈmeːodusetlə ovˈtæːax,
'ejzudə eːorɑs, syðːɑnærest wæːɑrð

Now, try as I might, I can not get it to read out any of the above lines properly any more. I've tried all of the English-speaking voices (pre 10.5 voices are hilarious), but the voices I am sure worked before, such as Fiona and Kate, now seem to ignore the IPA characters completely.

These are the somewhat un-DRY-y test commands I've used this time around:

say --rate=150 --voice=Fiona "/hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum/"
say --voice=Fiona "/hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum/"
say --rate=150 --voice=Fiona "hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum"
say --voice=Fiona "hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum"
say --voice=Fiona hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum
say --voice=Fiona /hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum/

But they all skip over the IPA characters entirely except for æ, which is sometimes pronounced. ɣ certainly never makes it into the synthesis any more, which it definitely did last time.

Am I missing something, or is it possible that for some reason they removed the IPA feature in a recent update? I'm pretty sure it was Mavericks that we were using, but it could've been Snow Leopard.

  • Guessing references to World War II quotes are frowned upon in questions, @ncdownpat. ;) – Benjamin Nolan Sep 21 '14 at 3:23
  • I've been thinking about this a bit more, and I did blank my laptop and re-install OS X from scratch at the beginning of this year. I suppose it's possible that there was something in Leopard or Snow Leopard which supported this feature which has been removed in a later version, like X11 was removed between 10.6 and 10.7. Would be a shame, though. It's starting to look like I may be better off writing my own hooks into the TTS engine to speak Old English. :/ – Benjamin Nolan Sep 21 '14 at 23:10
7

Here's a Ruby script that takes a string of Unicode IPA text and converts it to OS X's say command phonetic syntax.

Slap this Ruby code into a file—let's call it ipa2say.rb. Make the file executable (i.e. chmod u+x ipa2say.rb). Execute the executable, piping some IPA text to it. Out will come some ASCII phonetic text.

Then run say with the [[inpt PHON]] directive.

So, an example. Let's say you want to say the IPA text "ˌɪntərˈnæʃənəl fəˈnɛtɪk ˈælfəˌbɛt fəˈrɛvər". From the command line:

echo "ˌɪntərˈnæʃənəl fəˈnɛtɪk ˈælfəˌbɛt fəˈrɛvər" | ./ipa2say.rb

It will spit out:

IXntrnAESnl fAXnEHtIXk AElfbEHt frEHvr

You then run: say "[[inpt PHON]]IXntrnAESnl fAXnEHtIXk AElfbEHt frEHvr"

Here's the script.

#!/usr/bin/ruby -w

map =   {       'æ' => 'AE',
                'eɪ' => 'EY',
                'ɑ' => 'AO',
                'əˈ' => 'AX',
                'i' => 'IY',
                'ɛ' => 'EH',
                'ɪ' => 'IH',
                'aɪ' => 'AY',
                'ɪ' => 'IX',
                'ɑ' => 'AA',
                'u' => 'UW',
                'ʊ' => 'UH',
                'ʌ' => 'UX',
                'oʊ' => 'OW',
                'aʊ' => 'AW',
                'ɔɪ' => 'OY',
                'b' => 'b',
                'ʧ' => 'C',
                'd' => 'd',
                'ð' => 'D',
                'f' => 'f',
                'g' => 'g',
                'h' => 'h',
                'ʤ' => 'J',
                'k' => 'k',
                'l' => 'l',
                'm' => 'm',
                'n' => 'n',
                'ŋ' => 'N',
                'p' => 'p',
                'r' => 'r',
                's' => 's',
                'ʃ' => 'S',
                't' => 't',
                'θ' => 'T',
                'v' => 'v',
                'w' => 'w',
                'j' => 'y',
                'z' => 'z',
                'ʒ' => 'Z',
                'ɜ' => '',
                ' ' => ' ',
                'ˈ' => ''
        }

text = ARGF.read

substring = ''

text.split("").each do |c|

    substring << c

    if substring.length == 2
        if map.has_key? substring
            print map[ substring ]
        else
            front = substring[0]
            if map.has_key? front
                print map[ front ]
            end
            back = substring[1]
            if map.has_key? back
                print map[ back ]
            end
        end

        substring = ''
    end
end
  • 3
    This is awesome, although it's worth noting that [[inpt PHON]] is only supported on voices which were in OS X prior to 10.6. It's mildly annoying, as they're much lower quality than the modern voices, and it would be nice to be able to feed the data into Fiona, for instance. Oh well! – Benjamin Nolan Mar 11 '15 at 18:33
  • Yeah it doesn't work with the newer voices. – adib Aug 14 '15 at 7:29
  • I found this list of the pre-10.6 voices: alvinalexander.com/blog/post/mac-os-x/… The non-gimmicky ones are: Agnes, Kathy, Princess, Vicki, Victoria, Bruce, Fred, Junior, Ralph. I've not checked which of those actually works with IPA yet. – tobych May 9 '16 at 23:17
1

Try brackets/slashes around each word if it doesn't work with a phrase. This doesn't work:

say "/hwæt we ˈɡɑːrˌdenɑ in ˈjæːɑrdɑɣum/"

But this seems to:

say "/hwæt/ /we/ /ˈɡɑːrˌdenɑ/ /in/ /ˈjæːɑrdɑɣum/"

Square brackets work also:

say "[huː] [ðɑ] [æðelɪŋɡɑs] [ˈelːen] [ˈfremːedon]"

Good luck!

(Edited because I re-read and saw that you tried the slashes surrounding the whole phrase.)

  • 1
    Hmm… I'm not sure it's actually reading it as IPA. It sounds like it's skipping all the non-English characters when I run those commands. If I do say -v Alex "/hwæt/ /we/ /ˈɡɑːrˌdenɑ/ /in/ /ˈjæːɑrdɑɣum/", it says "Weh wiardena yeardaou" >.< Thanks for trying, though. :) – Benjamin Nolan Oct 22 '15 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.