Problem/Motivation

AI Media makes images, SVGs and, experimentally, videos. Sites also want spoken clips: an intro, a pronunciation, a short announcement. The AI module has a text to speech operation with real providers (OpenAI, Gemini, ElevenLabs), and core ships an Audio media type.

Proposed resolution

  • An Audio generator: the text is read aloud by the text to speech provider and saved into a media type with the Audio file source. Off by default, like Video; turned on in the generators table.
  • The text field is "Text to speak", with its own help; a generator may now name its field.
  • Options: the model, the voice the model lists (the site sets the default and may show the choice), and the format: mp3, wav or aac.
  • A sound or video result shows a player where an image shows its preview, and its link reads "Open in a new tab".
  • Only an image is asked for alt and title; other media types ask AI for the name alone, one call less per generation.
  • Kernel tests, and an e2e scenario on Add media with the Echo provider, which speaks too.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ✅ Automated unit/functional testing coverage
  • ✅ Developer Documentation support
  • ❌ User Guide Documentation support
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ✅ Update Release Notes
  • ✅ Release

User interface changes

Add media > Audio, Generate with AI, after a generation in Gin: the AI name, the text, the player and the facts line.

 the name, the Text to speak field, Generate again, the review note, the audio player and the Open in a new tab link

The Options with Format and Voice shown:

 Format radios MP3, WAV, AAC and a Voice select, the summary reading Options (MP3, Onyx)

API changes

  • The AiMediaGenerator attribute takes optional field_title and field_help.
  • AiMediaMetadata::values() takes the targets to fill; the default is all of them.

Data model changes

  • ai_media.settings gains generators.audio and editor_options.audio, with a voice option.

Release notes snippet

  • Added the Audio generator: speech read from the text with the text to speech provider, in a voice the model lists.

AI-Generated: Yes

Issue fork ai_media-3634447

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

  • rajab natshah committed b4b97ca9 on 1.0.x
    feat: #3634447 Add an Audio generator: speech read from the text with...
rajab natshah’s picture

Issue summary: View changes
Status: Active » Fixed
Issue tags: +ai_media-1.0.0-rc1

✅ Released ai_media-1.0.0-rc1

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.