Skip to content
Javier Godoy Núñez edited this page Dec 17, 2024 · 1 revision

📖 Index

  1. Introduction
  2. Real-World Application Scenario 🛠️
  3. Technical Overview
  4. Key Components
  5. Real-World Benefits 🌍

1. Introduction

The Guggiana Project is a comprehensive solution designed to automate and enhance the process of converting textual content into high-quality, multilingual audio files. It leverages AWS services such as Polly, Step Functions, and DynamoDB, alongside the AWS Cloud Development Kit (CDK), to create an efficient, scalable, and customizable text-to-speech (TTS) pipeline.

This project is particularly suited for applications requiring audio content generation in multiple languages, such as e-learning platforms, news websites, and accessibility tools for visually impaired users.


2. Real-World Application Scenario 🛠️

Scenario: Enhancing Accessibility for News Websites

Imagine a news website that publishes articles daily in multiple languages. To improve accessibility for visually impaired users and cater to a global audience, the website needs to:

  • Convert articles into audio files in multiple languages.
  • Provide a seamless experience for users to access these audio files.
  • Ensure scalability to handle high traffic and a large volume of articles.

With the Guggiana Project, this can be achieved efficiently:

  1. Article Input: News articles are ingested into the system via URLs.
  2. Language Translation: Content is translated into multiple languages using AWS Translate.
  3. Audio Generation: High-quality audio files are generated using AWS Polly's neural voices.
  4. Storage and Access: Audio files are stored in S3 buckets and made accessible via signed URLs.
  5. Scalability: The system scales automatically to handle increased demand.

This not only enhances accessibility but also broadens the website's reach to a global audience, including those who prefer auditory content.


3. Technical Overview

Framework and Language

  • Framework: AWS CDK (Cloud Development Kit)
  • Language: TypeScript and Node.js

Core AWS Services

Service Purpose
AWS Polly Converts text to speech with neural voice support.
AWS Translate Translates content into multiple languages.
AWS Step Functions Orchestrates the workflow of content processing and audio generation.
AWS S3 Stores generated audio files.
AWS DynamoDB Maintains metadata and tracks the status of content processing tasks.

4. Key Components

Workflow Overview

  1. Content Ingestion: Articles are fetched and parsed from provided URLs.
  2. Translation: Content is translated into supported languages.
  3. Text-to-Speech: Translated content is converted into audio using AWS Polly.
  4. Audio Merging: Multiple audio segments are merged into a single file.
  5. Storage and Retrieval: Final audio files are uploaded to S3 and accessible via signed URLs.

Key Modules

Module Description
Content Table Tracks content metadata and processing status.
Tasks Table Manages individual tasks in the workflow.
Polly Workflow Orchestrates the TTS and translation tasks using AWS Step Functions.
Pre-Translation Lambda Prepares content for translation by AWS Translate.
Polly Listener Lambda Listens for Polly task completion and updates the database.
Merge Files Lambda Merges multiple audio segments into a single file.

5. Real-World Benefits 🌍

For Businesses

  • Increased Accessibility: Makes content accessible to visually impaired users.
  • Global Reach: Supports multiple languages for a broader audience.
  • Cost Efficiency: Pay-as-you-go model with AWS services ensures cost optimization.

For Developers

  • Scalability: Handles a high volume of content effortlessly.
  • Customizability: Modular design allows easy customization and extension.
  • Automation: Reduces manual effort through end-to-end automation.

Code Example: TTS Workflow

const buildPollyWorkflow = (
  stack: Stack,
  bucket: Bucket,
  preTranslateLambda: NodejsFunction,
  prePollyLambda: NodejsFunction,
  mergeFilesLambda: NodejsFunction,
  pollyWaitLambda: NodejsFunction,
  pollyListenerLambda: NodejsFunction
) => {
  const stateMachineRole = new Role(stack, `${stack.stackName}StateMachineRole`, {
    assumedBy: new ServicePrincipal('states.amazonaws.com'),
  });

  const languagesStateTemplate = {
    StartAt: `AvoidTranslateEN`,
    States: {
      AvoidTranslateEN: {
        Type: 'Choice',
        Choices: [
          {
            Not: {
              Variable: '$.language.translate',
              StringEquals: 'en',
            },
            Next: `PreTranslate`,
          },
        ],
        Default: `PrePolly`,
      },
      PreTranslate: {
        Type: 'Task',
        Resource: 'arn:aws:states:::lambda:invoke',
        Parameters: {
          FunctionName: preTranslateLambda.functionArn,
          'Payload.$': '$',
        },
        Next: `ParallelTranslation`,
      },
    },
  };

  return new StateMachine(stack, `${stack.stackName}ContentToSpeechStateMachine`, {
    definitionBody: DefinitionBody.fromString(JSON.stringify(languagesStateTemplate)),
    role: stateMachineRole,
  });
};

🌟 Why Use Guggiana?

  • 🚀 Automates TTS and translation workflows.
  • 🌐 Enhances accessibility and global reach.
  • 💡 Built with cutting-edge AWS technologies.

This project is a robust solution for organizations aiming to deliver high-quality audio content to diverse audiences.