code: def get_envelope(
      t_note_length, t_attack=0.010, t_release=0.3, sr=16000
  ):
      """Create an attack sustain release amplitude envelope."""
      t_note_length = min(t_note_length, MAX_NOTE_LENGTH)
      i_attack = int(sr * t_attack)
      i_sustain = int(sr * t_note_length)
      i_release = int(sr * t_release)
      i_tot = (
          i_sustain + i_release
      )  # attack envelope doesn't add to sound length
      envelope = np.ones(i_tot)
      # Linear attack
      envelope[:i_attack] = np.linspace(0.0, 1.0, i_attack)
      # Linear release
      envelope[i_sustain:i_tot] = np.linspace(1.0, 0.0, i_release)
      return envelope
  
file_path: magenta/magenta/models/gansynth/lib/generate_util.py
imports: from magenta.models.gansynth.lib import util
  import note_seq
  import numpy
  from scipy.io import wavfile
label_desc: Use image node_id 5 for calling a global function with example usage: get_envelope(t_note_length, t_attack, t_release, sr) and returns: envelope