diff --git a/polly/Gemfile b/polly/Gemfile new file mode 100644 index 0000000..3e721bc --- /dev/null +++ b/polly/Gemfile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# gem "rails" +gem "aws-sdk-polly" +gem 'pry' +gem 'nokogiri' \ No newline at end of file diff --git a/polly/Gemfile.lock b/polly/Gemfile.lock new file mode 100644 index 0000000..69e494c --- /dev/null +++ b/polly/Gemfile.lock @@ -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 diff --git a/polly/main.rb b/polly/main.rb new file mode 100644 index 0000000..2d98f21 --- /dev/null +++ b/polly/main.rb @@ -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 \ No newline at end of file