Skip to content

Commit

Permalink
polly code example
Browse files Browse the repository at this point in the history
  • Loading branch information
omenking committed Apr 7, 2024
1 parent beb10d7 commit 142567a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
8 changes: 8 additions & 0 deletions polly/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"

# gem "rails"
gem "aws-sdk-polly"
gem 'pry'
gem 'nokogiri'
50 changes: 50 additions & 0 deletions polly/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.3.0)
aws-partitions (1.909.0)
aws-sdk-core (3.191.6)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-polly (1.82.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
coderay (1.1.3)
jmespath (1.6.2)
method_source (1.0.0)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86-linux)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)

PLATFORMS
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux

DEPENDENCIES
aws-sdk-polly
nokogiri
pry

BUNDLED WITH
2.5.6
18 changes: 18 additions & 0 deletions polly/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'aws-sdk-polly'
require 'pry'

client = Aws::Polly::Client.new

resp = client.synthesize_speech({
engine: "standard",
output_format: "mp3",
sample_rate: "8000",
text: "All Gaul is divided into three parts",
text_type: "text",
voice_id: "Joanna",
})

File.open('sample.mp3', 'w') do |file|
data = resp.audio_stream.read
file.write data
end

0 comments on commit 142567a

Please sign in to comment.