Skip to content

Drupal 8 module to integrate with Amazon Polly Text to Speech

License

Notifications You must be signed in to change notification settings

mindbet/Read-to-Me

Repository files navigation

Read to Me

Read to Me enables site owners to easily generate spoken versions of text articles using Amazon Polly text-to-speech service.

For more information on Amazon Polly, including sample voices, see: https://aws.amazon.com/polly/

Features

  • Convert any article to an audio script
  • Edit the script as necessary
  • Convert the script to audio with Amazon Polly.
  • Amazon Polly converts your text to an MP3 file, which is stored on Amazon S3.
  • The completed audio version is attached to your article as a media entity.

Requirements

To use the service:

Installation

  • Install the Read to Me module as you would install any Drupal 8 module.
  • The Media and Media Library modules (part of Drupal core) are required.
  • Also, download and install Drupal module media_entity_audio:
  • Link: https://www.drupal.org/project/media_entity_audio
  • Use this composer command to load the Amazon Polly PHP SDK:
    • composer require "aws/aws-sdk-php": "^3.18"
  • Enable the Read to Me module.
  • In the settings page /admin/config/read-to-me/settings, enter your Amazon AWS Access Key ID and your AWS Secret Access Key.
  • Also enter the name of the S3 bucket that you created
  • See topic "Amazon notes" below for additional info on Amazon set-up.

Amazon credentials

Choosing voices

English voice choices

  • If your Drupal site's default language is something other English, this module will load voices for that language. Not every Drupal language choice will have Polly voices available.

Voice choices for Italian

Usage

The module will add two tabs to the standard Drupal node edit form.

They are Script and Audio.

Script Tab

The Script tab allows you to convert your body copy to a plain text script.

You can use the Copy button to copy the contents of the body field into the script field, removing the HTML formatting in the process.

Before conversion

Convert body text to audio script

After conversion

Convert body text to audio script

Audio Tab

The Audio tab allows you to send the script to Amazon Polly. Polly will create an MP3 file which is saved on Amazon S3. This module will create a media entity from that MP3 and attach it the node.**

Generate audio version

Result

Here is final article with the audio player added.

Node display

Media Entity

The generated audio file is added to the media library.

It can be removed or swapped with other media items in the library.

The media_entity_audio module allows the media entity to have a remote audio file (in the S3 bucket) as a source.

Node edit form

Amazon notes

Road map

  • Enable site users to send a link to the generated audio to their mobile devices.

Credit

Text of the sample article from Wikipedia

https://en.wikipedia.org/wiki/Luciano_Pavarotti

About

Drupal 8 module to integrate with Amazon Polly Text to Speech

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages