Skip to content

Added Audio Profile sample - #1538

Merged
happyhuman merged 19 commits into
masterfrom
audio_profile
Jul 12, 2018
Merged

Added Audio Profile sample#1538
happyhuman merged 19 commits into
masterfrom
audio_profile

Conversation

@happyhuman

Copy link
Copy Markdown
Contributor

No description provided.

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

Copy link
Copy Markdown
ContributorAuthor

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

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

# Copyright 2018 Google Inc. All Rights Reserved.

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done

@happyhuman

Copy link
Copy Markdown
ContributorAuthor

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

@nnegreynnegrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM



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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@nnegreynnegrey left a comment

Copy link
Copy Markdown
Contributor

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 tswastJuly 12, 2018 21:11
@happyhuman
happyhuman merged commit c545880 into masterJul 12, 2018
@happyhumanhappyhuman changed the title [DO NOT MERGE] Added Audio Profile sampleAdded Audio Profile sampleJul 12, 2018

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

Copy link
Copy Markdown
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
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
chalmerlowe pushed a commit that referenced this pull request Apr 7, 2026
* add argparse so that the samples can be run as a
a standalone script
```python python samples/snippets/storage_transfer_manager_upload_chunks_concurrently.py --bucket_name <bucket_name> --source_filename <path/to/file> --destination_blob_name <GCS_object_name>
```
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@happyhuman@dizcology@nnegrey@googlebot