code: def read_wav_file(file_name, sample_rate):
      wav_file = wave.open(file_name, mode="rb")
      channels = wav_file.getnchannels()
      num_frames = wav_file.getnframes()
  
      if wav_file.getframerate() != sample_rate:
          raise ValueError(
              "Audio file should have a sample rate of %d, got %d"
              % (sample_rate, wav_file.getframerate())
          )
  
      samples = wav_file.readframes(num_frames)
      wav_file.close()
  
      frames = struct.unpack("h" * num_frames * channels, samples)
  
      if channels == 2:
          print(
              "Picovoice processes single-channel audio but stereo file is provided. Processing left channel only."
          )
  
      return frames[::channels]
  
file_path: porcupine/binding/python/test_util.py
imports: import json
  import struct
  import wave
  from _util import *
label_desc: Use image node_id 3 for calling a global function with example usage: read_wav_file(file_name, sample_rate) and returns: frames