code: def create_example(filename, sample_rate, load_audio_with_librosa):
      """Processes an audio file into an Example proto."""
      wav_data = tf.gfile.Open(filename, "rb").read()
      example_list = list(
          audio_label_data_utils.process_record(
              wav_data=wav_data,
              sample_rate=sample_rate,
              ns=music_pb2.NoteSequence(),
              # decode to handle filenames with extended characters.
              example_id=six.ensure_text(filename, "utf-8"),
              min_length=0,
              max_length=-1,
              allow_empty_notesequence=True,
              load_audio_with_librosa=load_audio_with_librosa,
          )
      )
      assert len(example_list) == 1
      return example_list[0].SerializeToString()
  
file_path: magenta/magenta/models/onsets_frames_transcription/onsets_frames_transcription_transcribe.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from magenta.models.onsets_frames_transcription import audio_label_data_utils
  from magenta.models.onsets_frames_transcription import configs
  from magenta.models.onsets_frames_transcription import data
  from magenta.models.onsets_frames_transcription import infer_util
  from magenta.models.onsets_frames_transcription import train_util
  from note_seq import midi_io
  from note_seq.protobuf import music_pb2
  import six
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: create_example(filename, sample_rate, load_audio_with_librosa) and returns: example_list