{"id":28705525,"url":"https://github.com/lsafonso/tts-aws-lambda-polly","last_synced_at":"2026-07-05T17:31:48.667Z","repository":{"id":297978799,"uuid":"998474969","full_name":"lsafonso/tts-AWS-Lambda-Polly","owner":"lsafonso","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-19T09:24:02.000Z","size":568,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-28T01:08:38.681Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsafonso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-08T17:27:22.000Z","updated_at":"2025-07-19T09:24:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"070150f1-6f55-46c0-8e90-03a1fc59eeb7","html_url":"https://github.com/lsafonso/tts-AWS-Lambda-Polly","commit_stats":null,"previous_names":["lsafonso/ttf-fontend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lsafonso/tts-AWS-Lambda-Polly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsafonso%2Ftts-AWS-Lambda-Polly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsafonso%2Ftts-AWS-Lambda-Polly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsafonso%2Ftts-AWS-Lambda-Polly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsafonso%2Ftts-AWS-Lambda-Polly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsafonso","download_url":"https://codeload.github.com/lsafonso/tts-AWS-Lambda-Polly/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsafonso%2Ftts-AWS-Lambda-Polly/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35163846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-14T14:39:08.696Z","updated_at":"2026-07-05T17:31:48.663Z","avatar_url":"https://github.com/lsafonso.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Link to the page\nhttps://my-tts-app-frontend.s3.eu-north-1.amazonaws.com/index.html\n\n\n## How It Works\n\n![image](https://github.com/user-attachments/assets/05b825d1-c0a8-4849-a030-9243882ac769)\n\nThis is a simple serverless Text-to-Speech (TTS) web app built with:\n\n- **React + Vite** for the frontend UI  \n- **AWS API Gateway** (HTTP API) to expose a `/synthesize` endpoint  \n- **AWS Lambda** (Node.js) as the backend integration  \n- **Amazon Polly** to perform the actual speech synthesis  \n- **S3 + CloudFront** to host the React build with CDN  \n\n---\n\n### 1. User Interface (React + Vite)\n\n1. The user types or pastes text into the **TextInput** component.  \n2. They pick a voice (Joanna, Matthew, etc.) in the **VoiceSelector**.  \n3. They adjust **Speech Rate**, **Pitch**, and choose **Standard** vs **Neural** voices in **SpeechControls**.  \n4. Clicking **Generate Speech** fires a `POST /synthesize` call to the deployed API.\n\n---\n\n### 2. HTTP API (API Gateway)\n\n- Receives the JSON payload:\n  ```json\n  {\n    \"text\": \"Hello world!\",\n    \"voiceId\": \"Joanna\",\n    \"engine\": \"neural\",\n    \"outputFormat\": \"mp3\",\n    \"speechRate\": \"1.0\",\n    \"pitch\": \"0\"\n  }\n\n---\n\n### 3. Serverless Function (Lambda)\n\n1. **Parse the event**  \n   Extracts `text`, `voiceId`, `engine`, `outputFormat`, `speechRate`, and `pitch` from the incoming payload.\n\n2. **Call Amazon Polly**  \n   Uses the AWS SDK v3:\n   ```ts\n   import { PollyClient, SynthesizeSpeechCommand } from \"@aws-sdk/client-polly\";\n\n   const client = new PollyClient({ region: \"eu-north-1\" });\n   const command = new SynthesizeSpeechCommand({\n     Text: text,\n     VoiceId: voiceId,\n     Engine: engine,\n     OutputFormat: outputFormat,\n     SpeechRate: speechRate,\n     Pitch: pitch,\n   });\n   const pollyResponse = await client.send(command);\n\n3. Return HTTP response\n```json\n   {\n    \"statusCode\": 200,\n    \"isBase64Encoded\": true,\n    \"headers\": {\n      \"Content-Type\": \"audio/mpeg\",\n      \"Access-Control-Allow-Origin\": \"*\"\n    },\n    \"body\": \"\u003cBASE64_AUDIO_STRING\u003e\"\n  }\n```\n---\n\n## Preview\n\u003cimg width=\"1363\" alt=\"Screenshot 2025-06-08 at 19 32 12\" src=\"https://github.com/user-attachments/assets/4476e8b5-06e8-418a-a81f-c4ae57ee7a00\" /\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsafonso%2Ftts-aws-lambda-polly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsafonso%2Ftts-aws-lambda-polly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsafonso%2Ftts-aws-lambda-polly/lists"}