Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/115: Add Microsoft Azure Text to speech capability #403

Merged
merged 78 commits into from
May 18, 2023
Merged

Conversation

Sidsector9
Copy link
Member

@Sidsector9 Sidsector9 commented Mar 6, 2023

Description of the Change

Closes #115

How to test the Change

  1. Visit /wp-admin/admin.php?page=language_processing&tab=azure_text_to_speech.
  2. Setup the endpoint and key.
  3. Select post types which should support this feature.
  4. Select a voice.

Screenshot 2023-03-31 at 2 20 41 PM

  1. Add a new Post/Page, whichever has support for the feature.
  2. The feature will be "on" by default if the post type supports it.

Screenshot 2023-03-31 at 2 22 37 PM

  1. Save the post and

classifai mylocal_wp-admin_post php_post=581 action=edit

  1. New controls such as Refresh and Preview will be visible. Refresh can be used if you decide to change the voice.
  2. Go to the frontend, the post will have a play button added using the_content filter.

Screenshot 2023-03-31 at 2 26 14 PM

Changelog Entry

Added - Text to Speech capability using Microsoft Azura Text to Speech

Credits

Props @jeffpaul @Sidsector9

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@Sidsector9 Sidsector9 requested review from a team, dkotter and jeffpaul as code owners March 6, 2023 04:21
@Sidsector9 Sidsector9 marked this pull request as draft March 6, 2023 04:58
@jeffpaul jeffpaul added this to the 1.9.0 milestone Mar 6, 2023
@jeffpaul jeffpaul modified the milestones: 1.9.0, 2.0.0 Mar 14, 2023
@Sidsector9 Sidsector9 marked this pull request as ready for review March 31, 2023 08:45
@Sidsector9 Sidsector9 requested a review from dkotter May 10, 2023 16:26
.github/workflows/lint.yml Outdated Show resolved Hide resolved
includes/Classifai/Helpers.php Outdated Show resolved Hide resolved
@dkotter
Copy link
Collaborator

dkotter commented May 16, 2023

@Sidsector9 Just a couple small things left I flagged. Then we'll need to update the README file with details on this new feature and this should be good to go

@Sidsector9
Copy link
Member Author

@Sidsector9 Is this still an issue?
@dkotter no it's not, I tested it on a fresh installation.

@Sidsector9
Copy link
Member Author

@dkotter I have updated the README by referring to the existing documentation. I couldn't confirm the steps with my own Azure account as I've exhausted the trial. Can you confirm this with the 10up account?

@jeffpaul jeffpaul mentioned this pull request May 17, 2023
16 tasks
@dkotter dkotter merged commit fe9062e into develop May 18, 2023
@dkotter dkotter deleted the feat/115 branch May 18, 2023 22:05
@rickalee
Copy link

@dkotter @Sidsector9 If we wanted to generate audio versions for all past posts, what would be the best method to achieve that? Don't see a quick method to generate via hook we could use for a custom CLI script.

@dkotter
Copy link
Collaborator

dkotter commented May 22, 2023

@rickalee At the moment, we don't have a built-in way to handle this in bulk. We do have existing WP-CLI integrations, as well as integrations with WordPres core's bulk action handling, which we should look to implement that here (I've opened #460 to track this).

That said, if you're looking to do this on your own before those changes are made, there's two approaches you could fairly easily take:

  1. We did add a custom REST endpoint that is used to generate speech. You can write a script that iterates over multiple items and hits this endpoint for each item: example.com/wp-json/classifai/v1/synthesize-speech/POSTID
  2. You can copy the code from that REST endpoint instead. Same idea as above, you would iterate over multiple items and run something like:
$save_post_handler = new SavePostHandler();
foreach ( $post_ids as $post_id ) {
	$attachment_id = $save_post_handler->synthesize_speech( $post_id );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate Azure Text to Speech for "read-to-me" functionality on blog posts
6 participants