{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/1034","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/1034/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/1034/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/1034/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-php/issues/1034","id":318886699,"number":1034,"title":"Google Speech PHP API - Error reg. Audio Sampling Rate 'sampleRateHertz'","user":{"login":"hypercms","id":1419700,"avatar_url":"https://avatars3.githubusercontent.com/u/1419700?v=4","gravatar_id":"","url":"https://api.github.com/users/hypercms","html_url":"https://github.com/hypercms","followers_url":"https://api.github.com/users/hypercms/followers","following_url":"https://api.github.com/users/hypercms/following{/other_user}","gists_url":"https://api.github.com/users/hypercms/gists{/gist_id}","starred_url":"https://api.github.com/users/hypercms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypercms/subscriptions","organizations_url":"https://api.github.com/users/hypercms/orgs","repos_url":"https://api.github.com/users/hypercms/repos","events_url":"https://api.github.com/users/hypercms/events{/privacy}","received_events_url":"https://api.github.com/users/hypercms/received_events","type":"User","site_admin":false},"labels":[{"id":437931940,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/labels/api:%20speech","name":"api: speech","color":"f8f8f8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-04-30T13:18:09Z","updated_at":"2018-04-30T20:10:24Z","closed_at":null,"author_association":"NONE","body":"I created a FLAC audio file with 16.000 Hz sampling rate using FFMPEG and verified it as well.\r\nI tried it with and w/o the option 'sampleRateHertz' => 16000. In both cases I receive the same error.\r\nThe audio sampling rate is included in the header of the FLAC file, so maybe the value can not be extracted from the file header by the Cloud Service?\r\n\r\n**I receive an error regarding the audio sampling rate, see:**\r\n  \"error\": {\r\n    \"code\": 400,\r\n    \"message\": \"sample_rate_hertz (16000) in RecognitionConfig must either be unspecifie (truncated...)"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/comments/385513946","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-php/issues/1034#issuecomment-385513946","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/issues/1034","id":385513946,"user":{"login":"dwsupplee","id":2079879,"avatar_url":"https://avatars2.githubusercontent.com/u/2079879?v=4","gravatar_id":"","url":"https://api.github.com/users/dwsupplee","html_url":"https://github.com/dwsupplee","followers_url":"https://api.github.com/users/dwsupplee/followers","following_url":"https://api.github.com/users/dwsupplee/following{/other_user}","gists_url":"https://api.github.com/users/dwsupplee/gists{/gist_id}","starred_url":"https://api.github.com/users/dwsupplee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwsupplee/subscriptions","organizations_url":"https://api.github.com/users/dwsupplee/orgs","repos_url":"https://api.github.com/users/dwsupplee/repos","events_url":"https://api.github.com/users/dwsupplee/events{/privacy}","received_events_url":"https://api.github.com/users/dwsupplee/received_events","type":"User","site_admin":false},"created_at":"2018-04-30T20:10:24Z","updated_at":"2018-04-30T20:10:24Z","author_association":"COLLABORATOR","body":"Thanks for confirming. :)\r\n\r\nI just ran the snippet provided on 0.12.3, using an audio file recorded using the following method:\r\n\r\n```bash\r\n// Sample rate: 16000, 16 bit, 1 channel audio\r\nrec -r 16000 -b 16 -c 1 -t flac /audio/test.flac\r\n```\r\n\r\nAnd the request went through successfully. When inspecting the config from the request built by the library the sampleRateHertz setting was not provided, and was inferred by the upstream service:\r\n\r\n```json\r\n{\r\n  \"languageCode\": \"en-US\",\r\n  \"encoding\": \"FLAC\",\r\n  \"enableWordTimeOffsets\": true\r\n}\r\n```\r\n\r\nI'm having a hard time understanding how the library is attempting to infer the sample rate for you, as we removed that functionality about a year ago. Also, the fact the message is truncated is odd, as that is a remnant from [an issue we fixed some time back](https://github.com/GoogleCloudPlatform/google-cloud-php/issues/145) as well. The full message should read \"sample_rate_hertz (16000) in RecognitionConfig must either be unspecified or match the value in the FLAC header ([SOME_VALUE]).\" Would you be able to run `composer show` and share the libraries/versions which are installed?\r\n\r\nAlso, it would be very helpful if you would be able to modify the instantiation of the `SpeechClient` to look like the following. It should help provide some valuable debug information for us. If you could shoot that over to me at dwsupplee@gmail.com we can get a better understanding of what may be occurring.\r\n\r\n```php\r\n$guzzleClient = new \\GuzzleHttp\\Client();\r\n\r\n$speech = new SpeechClient([\r\n    'httpHandler' => function ($request, $options = []) use ($guzzleClient) {\r\n        debug_print_backtrace(); // capture this output\r\n\r\n        return $guzzleClient->send($request, $options);\r\n    }\r\n]);\r\n```"}}
{"actor":{"display_login":"dwsupplee"}}