Skip to content

Commit

Permalink
feat: support audioChannelCount (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwlui authored Feb 4, 2019
1 parent 16a84e9 commit d6572c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ system-test/*key.json
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
__pycache__
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ message RecognitionConfig {
// for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1.RecognitionConfig.AudioEncoding].
int32 sample_rate_hertz = 2;

// *Optional* The number of channels in the input audio data.
// ONLY set this for MULTI-CHANNEL recognition.
// Valid values for LINEAR16 and FLAC are `1`-`8`.
// Valid values for OGG_OPUS are '1'-'254'.
// Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
// If `0` or omitted, defaults to one channel (mono).
// Note: We only recognize the first channel by default.
// To perform independent recognition on each channel set
// `enable_separate_recognition_per_channel` to 'true'.
int32 audio_channel_count = 7;

// This needs to be set to `true` explicitly and `audio_channel_count` > 1
// to get each channel recognized separately. The recognition result will
// contain a `channel_tag` field to state which channel that result belongs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ const StreamingRecognitionConfig = {
* This field is optional for `FLAC` and `WAV` audio files and required
* for all other audio formats. For details, see AudioEncoding.
*
* @property {number} audioChannelCount
* *Optional* The number of channels in the input audio data.
* ONLY set this for MULTI-CHANNEL recognition.
* Valid values for LINEAR16 and FLAC are `1`-`8`.
* Valid values for OGG_OPUS are '1'-'254'.
* Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
* If `0` or omitted, defaults to one channel (mono).
* Note: We only recognize the first channel by default.
* To perform independent recognition on each channel set
* `enable_separate_recognition_per_channel` to 'true'.
*
* @property {boolean} enableSeparateRecognitionPerChannel
* This needs to be set to `true` explicitly and `audio_channel_count` > 1
* to get each channel recognized separately. The recognition result will
Expand Down
11 changes: 2 additions & 9 deletions packages/google-cloud-node/src/v1/speech_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,14 @@ class SpeechClient {
* // Handle the operation using the promise pattern.
* client.longRunningRecognize(request)
* .then(responses => {
* const operation = responses[0];
* const initialApiResponse = responses[1];
* const [operation, initialApiResponse] = responses;
*
* // Operation#promise starts polling for the completion of the LRO.
* return operation.promise();
* })
* .then(responses => {
* // The final result of the operation.
* const result = responses[0];
*
* // The metadata value of the completed operation.
* const metadata = responses[1];
*
* // The response of the api call returning the complete operation.
* const finalApiResponse = responses[2];
* })
* .catch(err => {
Expand All @@ -382,8 +376,7 @@ class SpeechClient {
* // Handle the operation using the event emitter pattern.
* client.longRunningRecognize(request)
* .then(responses => {
* const operation = responses[0];
* const initialApiResponse = responses[1];
* const [operation, initialApiResponse] = responses;
*
* // Adding a listener for the "complete" event starts polling for the
* // completion of the operation.
Expand Down
11 changes: 2 additions & 9 deletions packages/google-cloud-node/src/v1p1beta1/speech_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,14 @@ class SpeechClient {
* // Handle the operation using the promise pattern.
* client.longRunningRecognize(request)
* .then(responses => {
* const operation = responses[0];
* const initialApiResponse = responses[1];
* const [operation, initialApiResponse] = responses;
*
* // Operation#promise starts polling for the completion of the LRO.
* return operation.promise();
* })
* .then(responses => {
* // The final result of the operation.
* const result = responses[0];
*
* // The metadata value of the completed operation.
* const metadata = responses[1];
*
* // The response of the api call returning the complete operation.
* const finalApiResponse = responses[2];
* })
* .catch(err => {
Expand All @@ -382,8 +376,7 @@ class SpeechClient {
* // Handle the operation using the event emitter pattern.
* client.longRunningRecognize(request)
* .then(responses => {
* const operation = responses[0];
* const initialApiResponse = responses[1];
* const [operation, initialApiResponse] = responses;
*
* // Adding a listener for the "complete" event starts polling for the
* // completion of the operation.
Expand Down
10 changes: 5 additions & 5 deletions packages/google-cloud-node/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-01-17T12:49:57.662306Z",
"updateTime": "2019-02-04T21:37:22.951258Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.16.6",
"dockerImage": "googleapis/artman@sha256:12722f2ca3fbc3b53cc6aa5f0e569d7d221b46bd876a2136497089dec5e3634e"
"version": "0.16.8",
"dockerImage": "googleapis/artman@sha256:75bc07ef34a1de9895c18af54dc503ed3b3f3b52e85062e3360a979d2a0741e7"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "0ac60e21a1aa86c07c1836865b35308ba8178b05",
"internalRef": "229626798"
"sha": "f26c727dde5051abefc5ad9e7dee82a2686ad2b0",
"internalRef": "232306662"
}
},
{
Expand Down

0 comments on commit d6572c5

Please sign in to comment.