code: def velocity_range_from_sequence(ns):
      """Derive a VelocityRange proto from a NoteSequence."""
      velocities = [note.velocity for note in ns.notes]
      velocity_max = np.max(velocities) if velocities else 0
      velocity_min = np.min(velocities) if velocities else 0
      velocity_range = music_pb2.VelocityRange(
          min=velocity_min, max=velocity_max
      )
      return velocity_range
  
file_path: magenta/magenta/models/onsets_frames_transcription/audio_label_data_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import bisect
  import math
  import librosa
  from note_seq import audio_io
  from note_seq import constants
  from note_seq import sequences_lib
  from note_seq.protobuf import music_pb2
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: velocity_range_from_sequence(ns) and returns: velocity_range