code: def audio_to_features(
      audio,
      sample_rate,
      transcript=None,
      clock=0.0,
      train_phase=False,
      augmentations=None,
      sample_id=None,
  ):
      if train_phase:
          # We need the lambdas to make TensorFlow happy.
          # pylint: disable=unnecessary-lambda
          tf.cond(
              tf.math.not_equal(sample_rate, FLAGS.audio_sample_rate),
              lambda: tf.print(
                  "WARNING: sample rate of sample",
                  sample_id,
                  "(",
                  sample_rate,
                  ") "
                  "does not match FLAGS.audio_sample_rate. This can lead to incorrect results.",
              ),
              lambda: tf.no_op(),
              name="matching_sample_rate",
          )
  
      if train_phase and augmentations:
          audio = apply_graph_augmentations(
              "signal",
              audio,
              augmentations,
              transcript=transcript,
              clock=clock,
          )
  
      spectrogram = contrib_audio.audio_spectrogram(
          audio,
          window_size=Config.audio_window_samples,
          stride=Config.audio_step_samples,
          magnitude_squared=True,
      )
  
      if train_phase and augmentations:
          spectrogram = apply_graph_augmentations(
              "spectrogram",
              spectrogram,
              augmentations,
              transcript=transcript,
              clock=clock,
          )
  
      features = contrib_audio.mfcc(
          spectrogram=spectrogram,
          sample_rate=sample_rate,
          dct_coefficient_count=Config.n_input,
          upper_frequency_limit=FLAGS.audio_sample_rate / 2,
      )
      features = tf.reshape(features, [-1, Config.n_input])
  
      if train_phase and augmentations:
          features = apply_graph_augmentations(
              "features",
              features,
              augmentations,
              transcript=transcript,
              clock=clock,
          )
  
      return features, tf.shape(input=features)[0]
  
file_path: DeepSpeech/training/deepspeech_training/util/feeding.py
imports: from __future__ import absolute_import, division, print_function
  from collections import Counter
  from functools import partial
  import numpy
  import tensorflow
  from tensorflow.python.ops import gen_audio_ops
  from .config import Config
  from .text import text_to_char_array
  from .flags import FLAGS
  from .augmentations import apply_sample_augmentations, apply_graph_augmentations
  from .audio import read_frames_from_file, vad_split, pcm_to_np, DEFAULT_FORMAT
  from .sample_collections import samples_from_sources
  from .helpers import remember_exception, MEGABYTE
label_desc: Use image node_id 1 for calling a global function with example usage: audio_to_features(audio, sample_rate, transcript, clock, train_phase, augmentations, sample_id) and returns: features,  tf