Skip to main content

Lesson 11 of 12

Module 6 Practice

Practice what you have learned about AI audio and video generation.

15 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Practice: Text-to-Speech with Python

Practice: Text-to-Speech with Python
# Practice: generate speech from text using a free Python library
# Install: pip install pyttsx3

import pyttsx3

def create_audio_content():
    """
    Practice creating text-to-speech audio for different use cases.
    """
    engine = pyttsx3.init()

    # Adjust voice properties for different contexts
    use_cases = [
        {
            "context": "Podcast introduction",
            "text": "Welcome to today's episode. We are discussing how Generative AI is changing content creation for creators like you.",
            "rate": 145,  # Slightly slower than normal for podcasts
            "volume": 0.9,
        },
        {
            "context": "Accessibility narration",
            "text": "Image description: A chart showing monthly sales data. The highest sales were in December with 4500 units. The lowest were in February with 1200 units.",
            "rate": 135,  # Slower and clearer for accessibility
            "volume": 1.0,
        },
        {
            "context": "Tutorial narration",
            "text": "Step one. Open your terminal. Step two. Type pip install openai and press Enter. Step three. Wait for the installation to complete.",
            "rate": 130,  # Slower for instructions
            "volume": 0.9,
        },
    ]

    for use_case in use_cases:
        print(f"Context: {use_case['context']}")
        print(f"Text: '{use_case['text'][:60]}...'")
        engine.setProperty('rate', use_case['rate'])
        engine.setProperty('volume', use_case['volume'])
        engine.say(use_case['text'])
        engine.runAndWait()
        print("Played successfully.")
        print()

    print("Practice complete!")
    print("Notice how changing the rate and volume affects how natural the speech sounds.")

create_audio_content()
Diagram
Loading diagram…

Practice Diagram

Key Takeaways from Module 6

  • AI voice generation creates natural-sounding speech from text, used in accessibility, podcasting, and customer service
  • Speech-to-text converts spoken audio to text, used in transcription, voice assistants, and captions
  • AI music generation creates original music from text descriptions, used for content creation and game audio
  • AI video generation creates video from text or images, currently limited to short clips
  • Major risks include voice cloning for fraud, deepfake video for disinformation, and non-consensual synthetic media
  • Always verify surprising audio or video of public figures through reliable sources

Key Takeaways

  • Practice what you have learned about AI audio and video generation.
  • AI voice generation creates natural-sounding speech from text, used in accessibility, podcasting, and customer service
  • Speech-to-text converts spoken audio to text, used in transcription, voice assistants, and captions
  • AI music generation creates original music from text descriptions, used for content creation and game audio

Finished this lesson?

0 of 12 in Module 6
Sign in to save progress

Topics in This Module

0/12 done