Q:

How can you make OS X's say command speak IPA characters?

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.

A:

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

