Skip to content

Commit

Permalink
docs(text_to_speech): copy code example to top-level README
Browse files Browse the repository at this point in the history
[pr #3506]
  • Loading branch information
abedolinger authored and quartzmo committed Jun 19, 2019
1 parent f9b2d2d commit 01a340f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -996,17 +996,16 @@ $ gem install google-cloud-text_to_speech
#### Preview

```rb
require "google/cloud/text_to_speech/v1"

text_to_speech_client = Google::Cloud::TextToSpeech::V1.new

input = {text: "Hello, world!"}
voice = {language_code: "en-US"}
audio_config = {audio_encoding: Google::Cloud::Texttospeech::V1::AudioEncoding::MP3}
response = text_to_speech_client.synthesize_speech input, voice, audio_config
File.open "hello.mp3", "w" do |file|
file.write response.audio_content
end
require "google/cloud/text_to_speech"

text_to_speech_client = Google::Cloud::TextToSpeech.new
text = "test"
input = { text: text }
language_code = "en-US"
voice = { language_code: language_code }
audio_encoding = :MP3
audio_config = { audio_encoding: audio_encoding }
response = text_to_speech_client.synthesize_speech(input, voice, audio_config)
```

### Cloud Translation API (GA)
Expand Down

0 comments on commit 01a340f

Please sign in to comment.