code: def transcribe_waveform(model, enc, waveforms, truncate=False):
      """
      Expects an array of shape (N,S) where N is the number waveforms to transcribe in parallel and S is number of 16000Hz samples
      Returns the transcribed text if a single waveform is provided, or an array of transcriptions if multiple are provided
      """
      N_audio = len(waveforms)
      log_spec = prep_audio(waveforms, model.batch_size, truncate)
  
      if log_spec.shape[-1] > FRAMES_PER_SEGMENT and N_audio > 1:
          # we don't support multi-segment batching because the size of the prompt tokens would be different for each item in the batch
          # if we really want this feature, we can consider padding or trimming prompt tokens of varying lengths to make them consistent
          raise Exception(
              "Multi-segment transcription not supported with batch audio input"
          )
  
      start_tokens = [enc._special_tokens["<|startoftranscript|>"]]
      if model.is_multilingual:
          # TODO detect language
          language_token = (
              enc._special_tokens["<|startoftranscript|>"]
              + 1
              + tuple(LANGUAGES.keys()).index("en")
          )
          start_tokens.append(language_token)
          start_tokens.append(enc._special_tokens["<|transcribe|>"])
      start_tokens.append(enc._special_tokens["<|notimestamps|>"])
      transcription_start_index = len(start_tokens)
      eot = enc._special_tokens["<|endoftext|>"]
      transcription_tokens = [
          np.array([], dtype=np.int32)
      ] * log_spec.shape[0]
  
      for curr_frame in range(
          0, log_spec.shape[-1], FRAMES_PER_SEGMENT
      ):
          encoded_audio = model.encoder.encode(
              Tensor(
                  log_spec[
                      :, :, curr_frame : curr_frame + FRAMES_PER_SEGMENT
                  ]
              )
          )
          pos = 0
          curr_segment_tokens = np.tile(
              start_tokens, (log_spec.shape[0], 1)
          )
          if curr_frame > 0:
              # pass the previously inferred tokens as 'prompt' - https://github.com/openai/whisper/discussions/117#discussioncomment-3727051
              prompt = np.concatenate(
                  (
                      [enc._special_tokens["<|startofprev|>"]],
                      transcription_tokens[0][
                          -model.decoder.max_tokens_to_sample + 1 :
                      ],
                      start_tokens,
                  )
              )
              curr_segment_tokens = np.tile(
                  prompt, (log_spec.shape[0], 1)
              )
              transcription_start_index = len(curr_segment_tokens[0])
  
          for i in range(model.decoder.max_tokens_to_sample):
              out = model.decoder(
                  Tensor(
                      curr_segment_tokens
                      if i == 0
                      else curr_segment_tokens[:, -1:]
                  ),
                  pos,
                  encoded_audio,
                  streaming=curr_frame > 0,
              )
              next_tokens = (
                  out[:, -1].argmax(axis=-1).numpy().astype(np.int32)
              )
              next_tokens[curr_segment_tokens[:, -1] == eot] = eot
              curr_segment_tokens = np.concatenate(
                  (curr_segment_tokens, next_tokens.reshape(-1, 1)),
                  axis=1,
              )
              pos = curr_segment_tokens.shape[-1] - 1
              if DEBUG >= 1:
                  print(
                      i,
                      list(
                          map(
                              lambda tokens: enc.decode(tokens),
                              curr_segment_tokens,
                          )
                      ),
                  )
              if (curr_segment_tokens[:, -1] == eot).all():
                  break
  
          for i, t in enumerate(curr_segment_tokens):
              eot_index = np.where(t == eot)[0]
              eot_index = None if len(eot_index) == 0 else eot_index[0]
              transcription_tokens[i] = np.concatenate(
                  (
                      transcription_tokens[i],
                      t[transcription_start_index:eot_index],
                  )
              )
  
      transcriptions = list(
          map(
              lambda tokens: enc.decode(tokens).strip(),
              transcription_tokens,
          )
      )
      return (
          transcriptions[:N_audio] if N_audio > 1 else transcriptions[0]
      )
  
imports: import sys
  import pathlib
  import base64
  import multiprocessing
  import numpy
  from typing import Optional, Union, Literal, List
  from tinygrad.jit import TinyJit
  from tinygrad.nn.state import torch_load, load_state_dict
  from tinygrad.helpers import getenv, DEBUG, CI, fetch
  import tinygrad.nn
  from tinygrad.shape.symbolic import Variable
  from tinygrad.tensor import Tensor
  import itertools
  import librosa
label_desc: Use image node_id 6 for calling a global function with example usage: transcribe_waveform(model, enc, waveforms, truncate) and returns: unknown