code: def read_ogg_opus(ogg_file):
      error = ctypes.c_int()
      ogg_file_buffer = ogg_file.getbuffer()
      ubyte_array = ctypes.c_ubyte * len(ogg_file_buffer)
      opusfile = pyogg.opus.op_open_memory(
          ubyte_array.from_buffer(ogg_file_buffer),
          len(ogg_file_buffer),
          ctypes.pointer(error),
      )
  
      if error.value != 0:
          raise ValueError(
              (
                  "Ogg/Opus buffer could not be read." "Error code: {}"
              ).format(error.value)
          )
  
      channel_count = pyogg.opus.op_channel_count(opusfile, -1)
      sample_rate = 48000  # opus files are always 48kHz
      sample_width = 2  # always 16-bit
      audio_format = AudioFormat(
          sample_rate, channel_count, sample_width
      )
  
      # Allocate sufficient memory to store the entire PCM
      pcm_size = pyogg.opus.op_pcm_total(opusfile, -1)
      Buf = pyogg.opus.opus_int16 * (pcm_size * channel_count)
      buf = Buf()
  
      # Create a pointer to the newly allocated memory.  It
      # seems we can only do pointer arithmetic on void
      # pointers.  See
      # https://mattgwwalker.wordpress.com/2020/05/30/pointer-manipulation-in-python/
      buf_ptr = ctypes.cast(ctypes.pointer(buf), ctypes.c_void_p)
      assert buf_ptr.value is not None  # for mypy
      buf_ptr_zero = buf_ptr.value
  
      #: Bytes per sample
      bytes_per_sample = ctypes.sizeof(pyogg.opus.opus_int16)
  
      # Read through the entire file, copying the PCM into the
      # buffer
      samples = 0
      while True:
          # Calculate remaining buffer size
          remaining_buffer = (
              len(buf)  # int
              - (buf_ptr.value - buf_ptr_zero) // bytes_per_sample
          )
  
          # Convert buffer pointer to the desired type
          ptr = ctypes.cast(
              buf_ptr, ctypes.POINTER(pyogg.opus.opus_int16)
          )
  
          # Read the next section of PCM
          ns = pyogg.opus.op_read(
              opusfile, ptr, remaining_buffer, pyogg.ogg.c_int_p()
          )
  
          # Check for errors
          if ns < 0:
              raise ValueError(
                  "Error while reading OggOpus buffer. "
                  + "Error code: {}".format(ns)
              )
  
          # Increment the pointer
          buf_ptr.value += ns * bytes_per_sample * channel_count
          assert buf_ptr.value is not None  # for mypy
  
          samples += ns
  
          # Check if we've finished
          if ns == 0:
              break
  
      # Close the open file
      pyogg.opus.op_free(opusfile)
  
      # Cast buffer to a one-dimensional array of chars
      #: Raw PCM data from audio file.
      CharBuffer = ctypes.c_byte * (
          bytes_per_sample * channel_count * pcm_size
      )
      audio_data = CharBuffer.from_buffer(buf)
  
      return audio_format, audio_data
  
imports: import collections
  import ctypes
  import io
  import math
  import numpy
  import os
  import pyogg
  import tempfile
  import wave
  from .helpers import LimitingPool
  from collections import namedtuple
  from .io import open_remote, remove_remote, copy_remote, is_remote_path
label_desc: Use image node_id 18 for calling a global function with example usage: read_ogg_opus(ogg_file) and returns: audio_format,  audio_data