speech_transcribe_multichannel_gcs.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_transcribe_multichannel_gcs
  5. title: Multi-Channel Audio Transcription (Cloud Storage)
  6. description: Transcribe a short audio file from Cloud Storage with multiple channels
  7. rpc: Recognize
  8. service: google.cloud.speech.v1.Speech
  9. request:
  10. - field: audio.uri
  11. value: "gs://cloud-samples-data/speech/multi.wav"
  12. input_parameter: storage_uri
  13. comment: URI for audio file in Cloud Storage, e.g. gs://[BUCKET]/[FILE]
  14. - field: config.audio_channel_count
  15. value: 2
  16. comment: The number of channels in the input audio file (optional)
  17. - field: config.enable_separate_recognition_per_channel
  18. value: true
  19. comment: |
  20. When set to true, each audio channel will be recognized separately.
  21. The recognition result will contain a channel_tag field to state which
  22. channel that result belongs to
  23. - field: config.language_code
  24. value: "en-US"
  25. comment: The language of the supplied audio
  26. response:
  27. - loop:
  28. variable: result
  29. collection: $resp.results
  30. body:
  31. - comment:
  32. - "%s to recognize which audio channel this result is for"
  33. - channel_tag
  34. - print:
  35. - "Channel tag: %s"
  36. - result.channel_tag
  37. - comment:
  38. - First alternative is the most probable result
  39. - define: alternative = result.alternatives[0]
  40. - print:
  41. - "Transcript: %s"
  42. - alternative.transcript