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

SpeechClient.php guesses based on file extensions #446

Closed
adziuk opened this issue Apr 11, 2017 · 5 comments
Closed

SpeechClient.php guesses based on file extensions #446

adziuk opened this issue Apr 11, 2017 · 5 comments
Assignees
Labels
api: speech Issues related to the Speech-to-Text API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@adziuk
Copy link

adziuk commented Apr 11, 2017

The functions determineSampleRate and determineEncoding attempt to guess sample rate and encoding from the file extension. This is susceptible to incorrect naming of files, additionally, The Cloud Speech Servers support examining the file header and extracting information from them. Additional checking on the client side is unnecessary, and likely to drift from the server.

@jdpedrie jdpedrie added the api: speech Issues related to the Speech-to-Text API. label Apr 12, 2017
@dwsupplee
Copy link
Contributor

We actually do rely on the server to parse FLAC headers for us. Only AMR and AMR_WB are assumed because it is my understanding those must have sample rates of 8000/16000 (respectively).

/cc @pbogle I believe we spoke briefly about assuming the encoding type off of the file type and the sample rate based off of whether it is AMR/AMR_WB. Is this still okay for us to do, or would you prefer we make no assumptions?

@adziuk
Copy link
Author

adziuk commented Apr 12, 2017

@pbogle
Copy link

pbogle commented Apr 12, 2017

In virtually all cases, please do not implement argument validation or configuration guessing on the client.

The server already validates all arguments, and where possible determines the file type (e.g. FLAC or WAV) and audio parameters by inspecting the file headers, which is more reliable and comprehensive than what the client is doing.

Attempting to do this on the client creates inconsistencies with the server logic and in some cases defeats it, resulting in unnecessary errors to the user.

Even for AMR and AMB_WB It is fragile to set the sample rate based on current constraints in the server because those could change in future versions. (If I told you otherwise, I must have been confused and apologize for leading you down the wrong path; on principle it's not something I would recommend.)

@dwsupplee
Copy link
Contributor

Okay, no problem! We'll get these removed.

@dwsupplee
Copy link
Contributor

Closed by: #449

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: speech Issues related to the Speech-to-Text API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants