-
Notifications
You must be signed in to change notification settings - Fork 438
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
Comments
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? |
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.) |
Okay, no problem! We'll get these removed. |
Closed by: #449 |
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.
The text was updated successfully, but these errors were encountered: