Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

speech api with sample content bytes is not encoded to ASCII string before being sent over the wire #2519

Copy link
Copy link

Description

@INRIX-Avilay-Parekh
Issue body actions

When using the package as under with python3.5 -

with open('linear.wav', 'rb') as f:
    data = f.read()

s = client.sample(data, None, encoding=Encoding.LINEAR16, sample_rate=16000)
texts = client.sync_recognize(s)

Throws an error that it is not possible to convert the byte stream to JSON.

In speech/google/cloud/speech/client.py#240 the following line encodes the bytes in base64 but the return type of b64encode is still bytes.

audio = {'content': b64encode(_to_bytes(sample.content))}

If this is changed to the following, the API behaves as expected -

audio = {'content': b64encode(_to_bytes(sample.content)).decode('ascii')}
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: speechIssues related to the Speech-to-Text API.Issues related to the Speech-to-Text API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.