Skip to content

New Text to Speech experiment - #888

Open
dkotter wants to merge 21 commits into
WordPress:developfrom
dkotter:feature/text-to-speech
Open

New Text to Speech experiment#888
dkotter wants to merge 21 commits into
WordPress:developfrom
dkotter:feature/text-to-speech

Conversation

@dkotter

@dkotter dkotter commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Note

This is dependent on changes coming to the OpenAI Provider (see PR 42) or Google Provider (see PR 31)

What?

Adds a new experiment, Text to Speech, that allows editors the ability to on-demand generate speech for a post, including the title and post content. This is then displayed as a player on the front-end or that can be turned off on a post by post basis.

Why?

Adding support for Text to Speech allows sites to provide their users with the ability to listen to content instead of having to read the content.

How?

  • Registers two new Abilities, ai/speech-generation and ai/speech-import. These can be used to generate speech from text and import that speech as an audio file into the Media Library
  • Add shared functionality across multiple classes that can take in some text content, chunk that content down (if needed, to stay under API limits. Note only works if the format is MP3) and send that content off to generate speech for. It then combines all the returned speech data into a single audio file which we import into the Media Library. This functionality is used both if someone directly uses the Abilities above and when audio generation is manually triggered in the admin
  • Add a REST endpoint that is used to track audio progress, allowing audio generation to happen via cron events. This allows longer running processes and processing of audio even if someone navigates away

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 4.8
Used for: Help with initial planning and implementation. Refinement, review and testing done by me

Testing Instructions

  1. Requires an AI Provider that supports Text to Speech. Easiest way to test for now is to download the OpenAI Provider plugin from this PR or Google Provider plugin from this PR
  2. Turn on the Text to Speech experiment
  3. Go to a post and find the Text to Speech sidebar panel. Click on the Generate Audio button
  4. Audio generation will take a bit but is run in the background via cron jobs. Easiest is to just stay on the page until it is done but you can navigate away and come back later
  5. Once finished, you should see an audio player render in that panel, along with a toggle to display the audio player on the front-end and a button to regenerate audio
  6. View the front-end and ensure the audio player shows there

Screenshots

Initial state of the Text to Speech panel in the editor sidebar State of the Text to Speech panel in the editor sidebar after audio has been generated Audio controls rendering on the front-end

Changelog Entry

Added - New experiment, Text to Speech, that allows you to generate audio for a specific post and then render audio controls on the frontend.

Open WordPress Playground Preview

dkotter added 17 commits July 16, 2026 15:04
…t to the AI Client to generate speech. Set up to be used for both Ability calls and background jobs
… Fires individual jobs, via cron, that will chunk content down and turn those into audio files, combining all files at the end
… a string of text or post content from a specific post ID
…nd imports it into the media library as an MP3 file
…he admin to make things look better. Add a better loading state and an icon to the button
@dkotter dkotter added this to the 1.3.0 milestone Jul 21, 2026
@dkotter dkotter self-assigned this Jul 21, 2026
@dkotter
dkotter requested a review from a team July 21, 2026 19:09
@dkotter dkotter added the [Status] Blocked Used to indicate unable to move forward label Jul 21, 2026
@dkotter
dkotter requested a review from jeffpaul as a code owner July 21, 2026 19:09
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.88571% with 211 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.43%. Comparing base (f0764fb) to head (b80097e).

Files with missing lines Patch % Lines
...udes/Experiments/Text_To_Speech/Text_To_Speech.php 63.15% 49 Missing ⚠️
...es/Experiments/Text_To_Speech/Speech_Generator.php 21.15% 41 Missing ⚠️
includes/Abilities/Speech/Generate_Speech.php 78.03% 29 Missing ⚠️
includes/Abilities/Speech/Import_Base64_Audio.php 83.92% 27 Missing ⚠️
...ncludes/Experiments/Text_To_Speech/Job_Manager.php 85.71% 25 Missing ⚠️
...des/Experiments/Text_To_Speech/REST_Controller.php 85.57% 15 Missing ⚠️
includes/helpers.php 71.42% 10 Missing ⚠️
...udes/Experiments/Text_To_Speech/Audio_Combiner.php 77.14% 8 Missing ⚠️
...des/Experiments/Text_To_Speech/Content_Chunker.php 89.18% 4 Missing ⚠️
includes/REST/Models_Controller.php 25.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #888      +/-   ##
=============================================
- Coverage      79.74%   79.43%   -0.32%     
- Complexity      2469     2648     +179     
=============================================
  Files            104      112       +8     
  Lines           9992    10867     +875     
=============================================
+ Hits            7968     8632     +664     
- Misses          2024     2235     +211     
Flag Coverage Δ
unit 79.43% <75.88%> (-0.32%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Blocked Used to indicate unable to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant