type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
schema_version: 1.2.0
samples:
- region_tag: speech_transcribe_multilanguage_beta
  title: Detecting language spoken automatically (Local File) (Beta)
  description: |
    Transcribe a short audio file with language detected from a list of possible languages
  rpc: Recognize
  service: google.cloud.speech.v1p1beta1.Speech
  request:
  - field: audio.content
    value: resources/brooklyn_bridge.flac
    input_parameter: local_file_path
    comment: Path to local audio file, e.g. /path/audio.wav
    value_is_file: true
  - field: config.language_code
    value: "fr"
    comment: |
      The language of the supplied audio. Even though additional languages are
      provided by alternative_language_codes, a primary language is still required.
  - field: config.alternative_language_codes[0]
    value: "es"
    comment: |
      Specify up to 3 additional languages as possible alternative languages
      of the supplied audio.
  - field: config.alternative_language_codes[1]
    value: "en"
  response:
  - loop:
      variable: result
      collection: $resp.results
      body:
      - comment:
        - The %s which was detected as the most likely being spoken in the audio
        - language_code
      - print:
        - "Detected language: %s"
        - result.language_code
      - comment:
        - First alternative is the most probable result
      - define: alternative = result.alternatives[0]
      - print:
        - "Transcript: %s"
        - alternative.transcript
