code: def load_and_prepare_audio(aligner, audio_path, target_sr, device):
      """Loads and resamples audio to target sample rate (if necessary), and preprocesses for Aligner input."""
      # Load audio and get length for preprocessing
      audio_data, orig_sr = sf.read(audio_path)
      if orig_sr != target_sr:
          audio_data = librosa.core.resample(
              audio_data, orig_sr=orig_sr, target_sr=target_sr
          )
  
      audio = torch.tensor(
          audio_data, dtype=torch.float, device=device
      ).unsqueeze(0)
      audio_len = (
          torch.tensor(audio_data.shape[0], device=device)
          .long()
          .unsqueeze(0)
      )
  
      # Generate spectrogram
      spec, spec_len = aligner.preprocessor(
          input_signal=audio, length=audio_len
      )
  
      return spec, spec_len
  
file_path: NeMo/examples/tts/aligner_heteronym_disambiguation.py
imports: import argparse
  import json
  import os
  import re
  import librosa
  import soundfile
  import torch
  from nemo.collections.tts.models import AlignerModel
  from nemo.collections.tts.parts.utils.tts_dataset_utils import general_padding
label_desc: Use image node_id 2 for calling a global function with example usage: load_and_prepare_audio(aligner, audio_path, target_sr, device) and returns: spec,  spec_len