

* Implements hook_module_implements_alter().The site started in 2006, but the AI was 'born' in 1988, when Rollo Carpenter saw how to make his machine learn. The following code will enable you to use your custom file stream wrapper,Īdd the code in your module file and add your custom code logic for your custom file stream wrapper in place. For Custom file stream wrapper Implementation Note: Supports core file streaming wrapper. you can also clone this media type multiple times and add the newly created media type's machine names as comma-separated values in "Google Text To Speech" module configuration page.

On enabling this module, new media type " google_text_to_speech" will be created, this media type can be used to convert the text to speech and save it as audio file. This module have dependency with Media module which is now part of Drupal core.

$gtts = \Drupal::service('google_text_to_speech.manager') Audio Encoding type can be LINEAR16, MP3 and OGG_OPUS with respective values 1,2,3. Voice Gender can be Male, Female and Neutral with respective values 1,2,3. You can also test the text to speech feature by setting some sample text in testing part of configuration form and by clicking download audio.įollowing code can be used in other modules to generate Audio from text You will get extra settings once you hit save configuration then configure other fields too. Now navigate to the admin extend page then enable the module and now Add the path of the uploaded JSON file in Google text to speech configuration page. Make sure it is protected and not accessible by web URL.Ĥ. Upload the Google API service credentials JSON file to the drupal codebase server by FTP or ssh to authenticate google client library using Google Authentication. You can use Run and then the below command in docker file.ģ. When using the official PHP images of Docker, install these PHP extensions by the below command. Install Php Extensions bcmath which is required for module features to work. Once the composer dependencies are installed, check /vendor folder you will have a new google/cloud-text-to-speech folder in it and that confirms dependencies installed.Ģ. From the Drupal root folder run the below commandĬomposer require drupal/google_text_to_speech:"1.3.0-alpha4" We recommend to install the module using composer, only then the dependent libraries will be installedġ. JSON credentials file will be provided by google once you have access to Google API service. Google cloud text to speech needs Google API service credentials to work.

This module saves output audio files as media entities. You can then convert the audio data into a playable audio file like an MP3. Text to Speech module uses Google Cloud Text-to-Speech library which allows you to convert words and sentences to audio data of natural human speech.
