Pronounce de as dom...
Isn't it possible to tweak the TTS a little bit, by changing "de" to "dem" before it gets rendered by the tts, in order to have it pronounced right?
Yes, "dom" is the way to pronounce both "de" and "dem". The two words are actually merging into one in Swedish. Many people accept, with good reasons, "dom" instead of "de/dem" in written Swedish as well. (I would personally recommend new learners to write this way.)
Though, Swedish speakers in Finland may have a different view of this.
I don't really disagree. But this professor of Swedish makes a good case for abandoning the distinction (link in Swedish): http://www.svd.se/kultur/skriftspraket-moget-for-att-infora-dom_3845622.svd