code: def decode_to_memory(
      infile,
      fmt="f32le",
      sample_rate=None,
      num_channels=1,
      channel=None,
      skip=None,
      max_len=None,
      cmd_decode="ffmpeg",
      cmd_probe="ffprobe",
      replaygain_mode=None,
      replaygain_preamp=0.0,
  ):
      """
      Decode the given audio and return it as a binary string representation.
  
      Parameters
      ----------
      infile : str
          Name of the audio sound file to decode.
      fmt : {'f32le', 's16le'}, optional
          Format of the samples:
          - 'f32le' for float32, little-endian,
          - 's16le' for signed 16-bit int, little-endian.
      sample_rate : int, optional
          Sample rate to re-sample the signal to (if set) [Hz].
      num_channels : int, optional
          Number of channels to reduce the signal to.
          If 'None', return the signal with its original channels,
          or whatever is selected by `channel`.
      channel : int, optional
          When reducing a signal to `num_channels` of 1, use this channel,
          or 'None' to return the average across all channels.
      skip : float, optional
          Number of seconds to skip at beginning of file.
      max_len : float, optional
          Maximum length in seconds to decode.
      cmd_decode : {'ffmpeg', 'avconv'}, optional
          Decoding command (defaults to ffmpeg, alternatively supports avconv).
      cmd_probe : {'ffprobe', 'avprobe'}, optional
          Probing command (defaults to ffprobe, alternatively supports avprobe).
      replaygain_mode : {None, 'track','album'}, optional
          Specify the ReplayGain volume-levelling mode (None to disable).
      replaygain_preamp : float, optional
          ReplayGain preamp volume change level (in dB).
  
      Returns
      -------
      samples : str
          Binary string representation of the audio samples.
  
      """
      # check input file type
      if not isinstance(infile, (string_types, file_types, Signal)):
          raise ValueError(
              "only file names, file objects or Signal instances "
              "are supported as `infile`, not %s." % infile
          )
      # prepare decoding to pipe
      _, proc = decode_to_pipe(
          infile,
          fmt=fmt,
          sample_rate=sample_rate,
          num_channels=num_channels,
          channel=channel,
          skip=skip,
          max_len=max_len,
          cmd=cmd_decode,
          replaygain_mode=replaygain_mode,
          replaygain_preamp=replaygain_preamp,
      )
      # decode the input to memory
      if isinstance(infile, Signal):
          # Note: np.getbuffer was removed in Python 3, but Python 2 memoryviews
          #       do not have the cast() method
          try:
              signal, _ = proc.communicate(np.getbuffer(infile))
          except AttributeError:
              mv = memoryview(infile)
              signal, _ = proc.communicate(mv.cast("b"))
      elif isinstance(infile, file_types):
          signal, _ = proc.communicate(infile.read())
          infile.seek(0)
          # handle non-streamable MP4 container, which silently returns an empty
          # signal
          if not signal and nonstreamable_mp4_file_object(
              infile, cmd_probe
          ):
              try:
                  delete_file = False
                  try:
                      # pass its path if the file exists on disk
                      path = infile.name
                  except AttributeError:
                      # otherwise store it as a temporary file
                      with tempfile.NamedTemporaryFile(
                          mode="wb", delete=False, suffix=".mp4"
                      ) as f:
                          f.write(infile.read())
                      infile.seek(0)
                      path = f.name
                      delete_file = True
                  # retry by passing a path to ffmpeg instead of piping the
                  # audio to stdin (allows multiple reading passes)
                  signal = decode_to_memory(
                      path,
                      fmt,
                      sample_rate,
                      num_channels,
                      channel,
                      skip,
                      max_len,
                      cmd_decode,
                      cmd_probe,
                      replaygain_mode,
                      replaygain_preamp,
                  )
              finally:
                  if delete_file:
                      os.remove(path)
      else:
          signal, _ = proc.communicate()
      if proc.returncode != 0:
          raise subprocess.CalledProcessError(
              proc.returncode, cmd_decode
          )
      return signal
  
imports: from __future__ import absolute_import, division, print_function
  import errno
  import os
  import subprocess
  import sys
  import tempfile
  import numpy
  from ..audio.signal import Signal
  from ..utils import string_types, file_types
label_desc: Use image node_id 6 for calling a global function with example usage: decode_to_memory(infile, fmt, sample_rate, num_channels, channel, skip, max_len, cmd_decode, cmd_probe, replaygain_mode, replaygain_preamp) and returns: signal