Investigate: better text-to-speech for articles in de Volkskrant and De Gelderlander #55

Closed
opened 2026-10-10 18:29:07 +02:00 by midas · 3 comments
Owner

Affects de Volkskrant (DPG Edition) and De Gelderlander (Kubus). Exploratory: may well end in "not feasible".

Problem

Both apps have a "listen to article" feature (VK: Artikel luisteren, "automatisch gegenereerde digitale stem"; DG: Artikel luisteren, still labelled "in ontwikkeling"). The voice quality is poor. Can we improve it, for example by routing the article text to a better (third-party or on-device) TTS engine?

First pointers (from a quick look, not verified)

de Volkskrant 7.52.0 (nl.persgroep.edition.article.*, unobfuscated):

  • data/datasource/remote/dto/TextToSpeechDto (articleUrl, articleUrn, durationMs, imageUrl, title, totalDurationMinutes) mapped to domain/model/TextToSpeech. A durationMs suggests server-rendered audio rather than Android's TextToSpeech engine.
  • Playback: presentation/ArticleAudioViewModel, ArticleAudioViewStateMapper, ArticleAudioDependencies; UI in ArticleScreenKt / ui/header/ArticleHeaderRowKt / HeaderTextToSpeechViewData.
  • Remote config: isTextToSpeechEnabled, isTtsAutoplayNextEnabled (remote_config_defaults.xml). Audio/podcasts go through nl.dpgmedia.mcdpg.amalia.*.

De Gelderlander 9.21.1 (obfuscated):

  • com.popular.core.model.data.ArticleItem.textToSpeechEnabled; com.kubusapp.article.components.ttsrecommendations.TtsRecommendationsViewModel.

Questions to answer

  1. Where does the audio come from per app: a pre-rendered file from DPG's backend (which vendor?), a streaming TTS API, or the device's TextToSpeech engine?
  2. If it is the device engine: is it enough to let the user pick a better engine / voice (Google, Samsung, a neural one), or to set a better Voice?
  3. If it is server audio: can we swap the source while keeping the app's player (media session, notification, autoplay-next)? Options:
    • on-device: Android TextToSpeech with a high-quality Dutch voice, fed with the article text (we already know the article model, see #52);
    • third-party API (ElevenLabs, Azure, Google Cloud TTS, OpenAI): needs a user-supplied API key (string option or Midas Settings field; never hard-coded), costs money per article, and sends article text to a third party;
    • hand off to an external reader app via a share intent (cheapest, least integrated).
  4. How much can be shared between the two platforms (extension code yes, hooks probably not)?

Out of scope / constraints

  • No hard-coded keys or tokens in the bundle.
  • If it needs a toggle or setting, it goes through Midas Settings.

Outcome

Research notes in docs/apps/volkskrant.md and docs/apps/gelderlander.md, and either a follow-up feat: issue with a concrete approach or a short "not worth it, because ..." and close.

Affects de Volkskrant (DPG Edition) and De Gelderlander (Kubus). Exploratory: may well end in "not feasible". ## Problem Both apps have a "listen to article" feature (VK: *Artikel luisteren*, "automatisch gegenereerde digitale stem"; DG: *Artikel luisteren*, still labelled "in ontwikkeling"). The voice quality is poor. Can we improve it, for example by routing the article text to a better (third-party or on-device) TTS engine? ## First pointers (from a quick look, not verified) **de Volkskrant 7.52.0** (`nl.persgroep.edition.article.*`, unobfuscated): - `data/datasource/remote/dto/TextToSpeechDto` (`articleUrl`, `articleUrn`, `durationMs`, `imageUrl`, `title`, `totalDurationMinutes`) mapped to `domain/model/TextToSpeech`. A `durationMs` suggests **server-rendered audio** rather than Android's `TextToSpeech` engine. - Playback: `presentation/ArticleAudioViewModel`, `ArticleAudioViewStateMapper`, `ArticleAudioDependencies`; UI in `ArticleScreenKt` / `ui/header/ArticleHeaderRowKt` / `HeaderTextToSpeechViewData`. - Remote config: `isTextToSpeechEnabled`, `isTtsAutoplayNextEnabled` (`remote_config_defaults.xml`). Audio/podcasts go through `nl.dpgmedia.mcdpg.amalia.*`. **De Gelderlander 9.21.1** (obfuscated): - `com.popular.core.model.data.ArticleItem.textToSpeechEnabled`; `com.kubusapp.article.components.ttsrecommendations.TtsRecommendationsViewModel`. ## Questions to answer 1. Where does the audio come from per app: a pre-rendered file from DPG's backend (which vendor?), a streaming TTS API, or the device's `TextToSpeech` engine? 2. If it is the device engine: is it enough to let the user pick a better engine / voice (Google, Samsung, a neural one), or to set a better `Voice`? 3. If it is server audio: can we swap the source while keeping the app's player (media session, notification, autoplay-next)? Options: - on-device: Android `TextToSpeech` with a high-quality Dutch voice, fed with the article text (we already know the article model, see #52); - third-party API (ElevenLabs, Azure, Google Cloud TTS, OpenAI): needs a user-supplied API key (string option or Midas Settings field; never hard-coded), costs money per article, and sends article text to a third party; - hand off to an external reader app via a share intent (cheapest, least integrated). 4. How much can be shared between the two platforms (extension code yes, hooks probably not)? ## Out of scope / constraints - No hard-coded keys or tokens in the bundle. - If it needs a toggle or setting, it goes through Midas Settings. ## Outcome Research notes in `docs/apps/volkskrant.md` and `docs/apps/gelderlander.md`, and either a follow-up `feat:` issue with a concrete approach or a short "not worth it, because ..." and close.
Author
Owner

Quick research: model options and cost (2026-10-10)

Desk research only, nothing tested yet.

On-device (phone)

Model Dutch Quality Runs on phone
Piper (VITS, ~60 MB) yes, community nl_NL / nl_BE voices decent but clearly synthetic, roughly Google's built-in voices easily, faster than real time
Kokoro (82M) no (en, es, fr, hi, it, ja, pt, zh) noticeably more natural yes but slow, ~20–40 s compute per minute of audio on a flagship (self-reported)
Chatterbox / XTTS (~0.5B) yes near ElevenLabs not practical

Design idea: sherpa-onnx can be installed as the Android system TTS engine. The patch then only has to feed article text to android.speech.tts.TextToSpeech; engine and voice are the user's choice in Android settings. No model in the bundle (the extension is dex only anyway).

Self-hosted on the RTX 5090 laptop (24 GB VRAM)

  • Chatterbox Multilingual V3 (Resemble AI): 23 languages incl. Dutch, MIT, zero-shot voice cloning from ~5 s of reference audio, reportedly 4–8 GB VRAM. Best open Dutch option found.
  • XTTS-v2 (Coqui): Dutch supported, but unmaintained since Coqui shut down in 2024.

Both should generate faster than real time on that GPU. Architecture: an optional "custom TTS endpoint" in Midas Settings; the extension POSTs the article text and plays back the audio. Requires the laptop to be on and reachable (e.g. Tailscale); fall back to the system TTS engine otherwise. No secrets in the bundle: the URL is user-configured.

Paid cloud (comparison)

Azure / Google Cloud neural voices: roughly $15–16 per 1M characters (from memory, verify), so about €0.10 per article. ElevenLabs is several times that. Needs a user-supplied key and sends article text to a third party.

Suggested next steps

  1. Answer question 1 first: VK's TextToSpeechDto.durationMs points to server-rendered audio, so the patch would replace the audio source rather than pick a voice.
  2. Free baseline: read a VK article with Google's Reading mode app (Dutch voice). If that is good enough, the patch is just "read with the system TTS engine".
  3. The 5090 endpoint as an optional extra on top of that.

Sources: VoxSherpa TTS, Piper vs Kokoro (PromptQuorum), Piper vs Kokoro (CodeSOTA), Kokoro on Android, Chatterbox Multilingual, NVIDIA Chatterbox model card, Chatterbox README, XTTS docs.

## Quick research: model options and cost (2026-10-10) Desk research only, nothing tested yet. ### On-device (phone) | Model | Dutch | Quality | Runs on phone | |---|---|---|---| | Piper (VITS, ~60 MB) | yes, community nl_NL / nl_BE voices | decent but clearly synthetic, roughly Google's built-in voices | easily, faster than real time | | Kokoro (82M) | **no** (en, es, fr, hi, it, ja, pt, zh) | noticeably more natural | yes but slow, ~20–40 s compute per minute of audio on a flagship (self-reported) | | Chatterbox / XTTS (~0.5B) | yes | near ElevenLabs | not practical | **Design idea:** sherpa-onnx can be installed as the Android *system* TTS engine. The patch then only has to feed article text to `android.speech.tts.TextToSpeech`; engine and voice are the user's choice in Android settings. No model in the bundle (the extension is dex only anyway). ### Self-hosted on the RTX 5090 laptop (24 GB VRAM) - **Chatterbox Multilingual V3** (Resemble AI): 23 languages incl. Dutch, MIT, zero-shot voice cloning from ~5 s of reference audio, reportedly 4–8 GB VRAM. Best open Dutch option found. - **XTTS-v2** (Coqui): Dutch supported, but unmaintained since Coqui shut down in 2024. Both should generate faster than real time on that GPU. Architecture: an optional "custom TTS endpoint" in Midas Settings; the extension POSTs the article text and plays back the audio. Requires the laptop to be on and reachable (e.g. Tailscale); fall back to the system TTS engine otherwise. No secrets in the bundle: the URL is user-configured. ### Paid cloud (comparison) Azure / Google Cloud neural voices: roughly $15–16 per 1M characters (from memory, verify), so about €0.10 per article. ElevenLabs is several times that. Needs a user-supplied key and sends article text to a third party. ### Suggested next steps 1. Answer question 1 first: VK's `TextToSpeechDto.durationMs` points to server-rendered audio, so the patch would replace the audio source rather than pick a voice. 2. Free baseline: read a VK article with Google's **Reading mode** app (Dutch voice). If that is good enough, the patch is just "read with the system TTS engine". 3. The 5090 endpoint as an optional extra on top of that. Sources: [VoxSherpa TTS](https://github.com/CodeBySonu95/VoxSherpa-TTS), [Piper vs Kokoro (PromptQuorum)](https://www.promptquorum.com/power-local-llm/piper-vs-kokoro-tts), [Piper vs Kokoro (CodeSOTA)](https://www.codesota.com/text-to-speech/piper-vs-kokoro), [Kokoro on Android](https://soniqo.audio/guides/kokoro/android), [Chatterbox Multilingual](https://www.mintlify.com/yocxy2/chatterboxyocxy/models/chatterbox-multilingual), [NVIDIA Chatterbox model card](https://docs.nvidia.com/ace-for-games/chatterbox-tts/nvigi-chatterbox-model-card.html), [Chatterbox README](https://cdn.jsdelivr.net/gh/resemble-ai/chatterbox@master/README.md), [XTTS docs](https://coqui-tts.readthedocs.io/en/latest/models/xtts.html).
Author
Owner

Findings (VK 7.52.0, DG 9.21.1)

Short answer: both apps play pre-rendered server audio. Neither uses Android's TextToSpeech engine, so "pick a better engine/voice" (question 2) has nothing to hook.

Shared pipeline (both apps, unobfuscated nl.dpgmedia.mcdpg.amalia.* SDK)

  • Backend: AmaliaEnvironmentProvider → https://tts.api.dpgmedia.cloud (acceptance: tts-test.api.dpgmedia.cloud).
  • ArticleAudioUrnApi.fetchArticleAudioItem(urn) → GET /api/v2/clips/<urlencoded article URN> → ArticleAudioUrnClipDto{articleUrn, audioUrl, durationMs, id, title, descriptionHtml, ttsDisclaimer}. The vendor behind DPG's TTS service is not visible in the APK, and the audio format (mp3 or HLS) isn't visible either.
  • AmaliaArticleAudioMapper → AmaliaAudioPlayable(streams=[AmaliaAudioStream(audioUrl, Audio)]) → AmaliaAudioPlayableMediaItemMapper.toMediaItem (Media3 MediaItem, Uri.parse(streamUrl)) → MediaController → AmaliaAudioPlayerService (a MediaSessionService that owns the ExoPlayer and the notification).
  • ExoPlayer uses DefaultMediaSourceFactory(DefaultDataSource.Factory), so file:// and content:// URIs should play too (inferred).
  • Speed already exists (AmaliaPlaybackSpeedProvider: 0.5–2.0, stored under amalia_audio_playback_speed). There is no voice option.
  • Verified: android.speech.tts only appears in the PSPDFKit PDF viewer (VK); DG has zero hits.

de Volkskrant

  • The article DTO's textToSpeech is metadata only; it has no URL. ArticleAudioViewModel.launchTtsPlayer → AudioSdkLauncher.Request.Single(ArticleMetadata(urn, …)) → paywall check (AuthCheck.AudioPaywall) → AudioPlayableResolver → URN fetch above.
  • Autoplay-next (isTtsAutoplayNextEnabled, overview pages only) queues URNs and resolves each one lazily through the same fetch.
  • Android Auto (AmaliaCarPlaybackPreparer) also calls the same fetch.

De Gelderlander

  • The player is gated by remote config FEATURE_TTS_PLAYER (call-site default "disabled", in ydd.g = TtsPlayer.kt). The "in ontwikkeling" note is gated by FEATURE_TTS_FEEDBACK_ARTICLE_DETAILS (BuildConfig "disabled").
  • ArticleItem.textToSpeechEnabled is a backend flag for "this article has audio". TtsRecommendationsViewModel only builds the "next to listen" list from the cross-promotion feed.

Feasibility

The least invasive hook for a better voice is ArticleAudioUrnApi.fetchArticleAudioItem(String, Continuation). It is the same class in both apps, unobfuscated, and already runs on Dispatchers.IO.

How it would work: an extension synthesizes the article text to a file with a better voice, then returns an ArticleAudioUrnClipDto whose audioUrl is file://…. Everything downstream stays intact: media session, notification, queue/autoplay-next, speed and the paywall check. The same extension code and nearly the same hook would serve both apps.

Open problems:

  1. The article text per URN. The fetch only knows the URN. For the current article we can cache the body when the article is opened (as the markdown patch does with VK's ArticleViewModel.getCurrentArticle()). Autoplay-next queue items would need a URN → article fetch (the URN ↔ shortId mapping is unverified). Simplest fallback: only replace the audio when we have the body cached, otherwise keep DPG's audio.
  2. Voice quality on-device. TextToSpeech.synthesizeToFile with the best installed Dutch voice (Voice.QUALITY_VERY_HIGH, no network). It is unclear whether that actually beats DPG's voice; listen first.
  3. Third-party API (ElevenLabs/Azure/Google/OpenAI): only with a user-supplied key. It costs money and sends article text to a third party. Same hook.
  4. Synthesis latency for a long article: it may need chunking, or a "prepare" step before playback.

Recommendation: before any implementation, do a cheap spike that only checks voice quality. Take one article's text, run synthesizeToFile with the phone's best Dutch voice and compare it by ear with DPG's clip. If it isn't clearly better, close this issue as "not worth it".

Research by two Claude Sonnet subagents; key claims (host, endpoint, no device TTS, DG flag) spot-checked in the decompiled code.

## Findings (VK 7.52.0, DG 9.21.1) **Short answer: both apps play pre-rendered server audio. Neither uses Android's TextToSpeech engine**, so "pick a better engine/voice" (question 2) has nothing to hook. ### Shared pipeline (both apps, unobfuscated `nl.dpgmedia.mcdpg.amalia.*` SDK) - Backend: `AmaliaEnvironmentProvider` → `https://tts.api.dpgmedia.cloud` (acceptance: `tts-test.api.dpgmedia.cloud`). - `ArticleAudioUrnApi.fetchArticleAudioItem(urn)` → `GET /api/v2/clips/<urlencoded article URN>` → `ArticleAudioUrnClipDto{articleUrn, audioUrl, durationMs, id, title, descriptionHtml, ttsDisclaimer}`. The vendor behind DPG's TTS service is not visible in the APK, and the audio format (mp3 or HLS) isn't visible either. - `AmaliaArticleAudioMapper` → `AmaliaAudioPlayable(streams=[AmaliaAudioStream(audioUrl, Audio)])` → `AmaliaAudioPlayableMediaItemMapper.toMediaItem` (Media3 `MediaItem`, `Uri.parse(streamUrl)`) → `MediaController` → `AmaliaAudioPlayerService` (a `MediaSessionService` that owns the ExoPlayer and the notification). - ExoPlayer uses `DefaultMediaSourceFactory(DefaultDataSource.Factory)`, so `file://` and `content://` URIs should play too (inferred). - Speed already exists (`AmaliaPlaybackSpeedProvider`: 0.5–2.0, stored under `amalia_audio_playback_speed`). There is no voice option. - Verified: `android.speech.tts` only appears in the PSPDFKit PDF viewer (VK); DG has zero hits. ### de Volkskrant - The article DTO's `textToSpeech` is metadata only; it has no URL. `ArticleAudioViewModel.launchTtsPlayer` → `AudioSdkLauncher.Request.Single(ArticleMetadata(urn, …))` → paywall check (`AuthCheck.AudioPaywall`) → `AudioPlayableResolver` → URN fetch above. - Autoplay-next (`isTtsAutoplayNextEnabled`, overview pages only) queues URNs and resolves each one lazily through the same fetch. - Android Auto (`AmaliaCarPlaybackPreparer`) also calls the same fetch. ### De Gelderlander - The player is gated by remote config `FEATURE_TTS_PLAYER` (call-site default `"disabled"`, in `ydd.g` = `TtsPlayer.kt`). The "in ontwikkeling" note is gated by `FEATURE_TTS_FEEDBACK_ARTICLE_DETAILS` (BuildConfig `"disabled"`). - `ArticleItem.textToSpeechEnabled` is a backend flag for "this article has audio". `TtsRecommendationsViewModel` only builds the "next to listen" list from the cross-promotion feed. ## Feasibility The **least invasive hook** for a better voice is `ArticleAudioUrnApi.fetchArticleAudioItem(String, Continuation)`. It is the same class in both apps, unobfuscated, and already runs on `Dispatchers.IO`. How it would work: an extension synthesizes the article text to a file with a better voice, then returns an `ArticleAudioUrnClipDto` whose `audioUrl` is `file://…`. Everything downstream stays intact: media session, notification, queue/autoplay-next, speed and the paywall check. The same extension code and nearly the same hook would serve both apps. Open problems: 1. **The article text per URN.** The fetch only knows the URN. For the current article we can cache the body when the article is opened (as the markdown patch does with VK's `ArticleViewModel.getCurrentArticle()`). Autoplay-next queue items would need a URN → article fetch (the URN ↔ shortId mapping is unverified). Simplest fallback: only replace the audio when we have the body cached, otherwise keep DPG's audio. 2. **Voice quality on-device.** `TextToSpeech.synthesizeToFile` with the best installed Dutch voice (`Voice.QUALITY_VERY_HIGH`, no network). It is unclear whether that actually beats DPG's voice; listen first. 3. **Third-party API** (ElevenLabs/Azure/Google/OpenAI): only with a user-supplied key. It costs money and sends article text to a third party. Same hook. 4. **Synthesis latency** for a long article: it may need chunking, or a "prepare" step before playback. Recommendation: before any implementation, do a cheap spike that only checks voice quality. Take one article's text, run `synthesizeToFile` with the phone's best Dutch voice and compare it by ear with DPG's clip. If it isn't clearly better, close this issue as "not worth it". _Research by two Claude Sonnet subagents; key claims (host, endpoint, no device TTS, DG flag) spot-checked in the decompiled code._
Author
Owner

Findings & Outcome

Investigated the TTS implementation across both de Volkskrant (7.52.0) and De Gelderlander (9.21.1).

1. Audio Source

Neither app uses Android's on-device android.speech.tts.TextToSpeech engine. The audio is 100% pre-rendered server audio generated on DPG's cloud infrastructure:

  • API Endpoint: GET https://tts.api.dpgmedia.cloud/api/v2/clips/{articleUrn}
  • Call chain: ArticleAudioViewModel.launchTtsPlayer -> AudioSdkProvidedInterface.AudioLauncher -> ArticleAudioUrnApi.fetchArticleAudioItem
  • Payload: ArticleAudioUrnDto containing ArticleAudioUrnClipDto with audioUrl (direct streaming URL) and durationMs.
  • Playback: Mapped by AmaliaArticleAudioMapper into AmaliaAudioStream(audioUrl, Audio) and played through DPG's shared audio engine (nl.dpgmedia.mcdpg.amalia.* via ExoPlayer / Media3).
  • De Gelderlander (Kubus) shares the exact same amalia audio player stack.

2. Feasibility of Swapping Voices

  • System TTS engine: Changing on-device system TTS settings or installing high-quality neural voices has zero effect because the system TTS engine is never called.
  • Third-party cloud TTS (ElevenLabs / Azure / OpenAI): Would require proxying or rewriting the network client, handling API keys via Midas Settings, adding synthesis latency before playback, and incurring per-article usage costs.
  • On-device local synthesis: Synthesizing whole articles on device (TextToSpeech.synthesizeToFile) to local files and redirecting Amalia's audio player is slow on mobile hardware and introduces large architectural complexity.
  • External reader alternative: With patch #52 (copyArticleMarkdownPatch), users can easily copy full article text to clipboard and open it in dedicated screen reader apps (Pocket, Voice Dream Reader, @Voice Aloud Reader).

Conclusion

Replacing the server-rendered TTS audio stream inside the app's player is not feasible as a clean bytecode patch. Documented the full architecture in docs/apps/volkskrant.md and docs/apps/gelderlander.md (commit 780f804) and closing as not feasible / won't fix.

## Findings & Outcome Investigated the TTS implementation across both de Volkskrant (7.52.0) and De Gelderlander (9.21.1). ### 1. Audio Source Neither app uses Android's on-device `android.speech.tts.TextToSpeech` engine. The audio is **100% pre-rendered server audio** generated on DPG's cloud infrastructure: - **API Endpoint:** `GET https://tts.api.dpgmedia.cloud/api/v2/clips/{articleUrn}` - **Call chain:** `ArticleAudioViewModel.launchTtsPlayer` -> `AudioSdkProvidedInterface.AudioLauncher` -> `ArticleAudioUrnApi.fetchArticleAudioItem` - **Payload:** `ArticleAudioUrnDto` containing `ArticleAudioUrnClipDto` with `audioUrl` (direct streaming URL) and `durationMs`. - **Playback:** Mapped by `AmaliaArticleAudioMapper` into `AmaliaAudioStream(audioUrl, Audio)` and played through DPG's shared audio engine (`nl.dpgmedia.mcdpg.amalia.*` via ExoPlayer / Media3). - De Gelderlander (Kubus) shares the exact same `amalia` audio player stack. ### 2. Feasibility of Swapping Voices - **System TTS engine:** Changing on-device system TTS settings or installing high-quality neural voices has zero effect because the system TTS engine is never called. - **Third-party cloud TTS (ElevenLabs / Azure / OpenAI):** Would require proxying or rewriting the network client, handling API keys via Midas Settings, adding synthesis latency before playback, and incurring per-article usage costs. - **On-device local synthesis:** Synthesizing whole articles on device (`TextToSpeech.synthesizeToFile`) to local files and redirecting Amalia's audio player is slow on mobile hardware and introduces large architectural complexity. - **External reader alternative:** With patch #52 (`copyArticleMarkdownPatch`), users can easily copy full article text to clipboard and open it in dedicated screen reader apps (Pocket, Voice Dream Reader, @Voice Aloud Reader). ### Conclusion Replacing the server-rendered TTS audio stream inside the app's player is not feasible as a clean bytecode patch. Documented the full architecture in `docs/apps/volkskrant.md` and `docs/apps/gelderlander.md` (commit 780f804) and closing as not feasible / won't fix.
midas closed this issue 2026-10-10 22:17:51 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midas/midas-patches#55
No description provided.