Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Audio Profile sample #1538

Merged
merged 19 commits into from
Jul 12, 2018
Merged

Added Audio Profile sample #1538

merged 19 commits into from
Jul 12, 2018

Conversation

happyhuman
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 21, 2018
@happyhuman
Copy link
Contributor Author

@nnegrey , @dizcology Can you please review this PR?

@happyhuman happyhuman changed the title Added Audio Profile sample [DO NOT MERGE] Added Audio Profile sample Jun 22, 2018
@@ -0,0 +1,69 @@
#!/usr/bin/env python

# Copyright 2018 Google Inc. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google LLC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but it is also Google Inc in every other file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new files, I've been told we make the effort to update them, but on older files we just leave them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,32 @@
# Copyright 2018, Google, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google LLC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


import argparse

from google.cloud import texttospeech_v1beta1 as texttospeech
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to right between line 31/32. (Just learned this myself)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

from google.cloud import texttospeech_v1beta1 as texttospeech


# [START tts_synthesize_text]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update region tag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.



# [START tts_synthesize_text]
def synthesize_text(text, output, effects_profile_id):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def synthesize_text_with_audio_profile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"""Synthesizes speech from the input string of text."""
client = texttospeech.TextToSpeechClient()

input_text = texttospeech.types.SynthesisInput(text=text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also support ssml?

@dizcology Should there be a 2nd snippet for ssml support?



def test_audio_profile(capsys):
if os.path.exists(OUTOUT):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably do the clean-up after it runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@happyhuman
Copy link
Contributor Author

@nnegrey , @dizcology when you have time, can you please finalize your review of this PR?

Copy link
Contributor

@nnegrey nnegrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -7,7 +7,7 @@ Google Cloud Text-to-Speech API Python Samples
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/README.rst


This directory contains samples for Google Cloud Text-to-Speech API. The `Google Cloud Text-to-Speech API`_ enables you to generate and customize synthesized speech from text or SSML.
This directory contains samples for Google Cloud Text-to-Speech API. The `Google Cloud Text To Speech API`_ enables you to generate and customize synthesized speech from text or SSML.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch this one back I think.


# Note: you can pass in multiple effects_profile_id. They will be applied
# in the same order they are provided.
audio_config = texttospeech.types.AudioConfig(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have a comment about what some of the effects_profile_ids are.

out.write(response.audio_content)
print('Audio content written to file "%s"' % output)

# [END tts_synthesize_text_with_audio_profile]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could delete the new line.

Copy link
Contributor

@nnegrey nnegrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 nit but LGTM

@happyhuman happyhuman requested a review from tswast July 12, 2018 21:11
@happyhuman happyhuman merged commit c545880 into master Jul 12, 2018
@happyhuman happyhuman changed the title [DO NOT MERGE] Added Audio Profile sample Added Audio Profile sample Jul 12, 2018

assert ('Audio content written to file "%s"' % OUTPUT) in out
assert os.path.exists(OUTPUT)
os.remove(OUTPUT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use pytest's temp file for this.

@happyhuman happyhuman deleted the audio_profile branch July 16, 2018 22:45
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request Apr 9, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request May 13, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request May 13, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request May 13, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request May 20, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
busunkim96 pushed a commit to googleapis/python-texttospeech that referenced this pull request May 20, 2020
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
msampathkumar pushed a commit that referenced this pull request Nov 10, 2022
* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
msampathkumar pushed a commit that referenced this pull request Nov 10, 2022
* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Sep 22, 2023
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Sep 22, 2023
…rm/python-docs-samples#1538)

* Added Audio Profile sample

* Adjusted the row lengths

* Adjusted the row length

* Fixed Import orders

* Fixed print statement

* Debugging the unit test

* Fixed the unit test

* Some fixes per Noah's suggestions.

* Renamed the function name in the test.

* Multilined the long line.

* Fixed the misspelling

* Fixed the long line

* Forcing the CicleCi to build again

* Changing Inc to LLC

* Updated library version.

* Generated README.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants