speech_transcribe_multichannel.yaml 1.4 KB

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