code: def _ffmpeg_call(
      infile,
      output,
      fmt="f32le",
      sample_rate=None,
      num_channels=1,
      channel=None,
      skip=None,
      max_len=None,
      cmd="ffmpeg",
      replaygain_mode=None,
      replaygain_preamp=0.0,
  ):
      """
      Create a sequence of strings indicating ffmpeg how to be called as well as
      the parameters necessary to decode the given input (file) to the given
      format, at the given offset and for the given length to the given output.
  
      Parameters
      ----------
      infile : str
          Name of the audio sound file to decode.
      output : str
          Where to decode to.
      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 : {'ffmpeg','avconv'}, optional
          Decoding command (defaults to ffmpeg, alternatively supports avconv).
      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
      -------
      list
          ffmpeg call.
  
      Notes
      -----
      'avconv' rounds decoding positions and decodes in blocks of 4096 length
      resulting in incorrect start and stop positions. Thus it should only be
      used to decode complete files.
  
      """
      # Note: avconv rounds decoding positions and decodes in blocks of 4096
      #       length resulting in incorrect start and stop positions
      if cmd == "avconv" and skip is not None and max_len is not None:
          raise RuntimeError(
              "avconv has a bug, which results in wrong audio "
              "slices! Decode the audio files to .wav first or "
              "use ffmpeg."
          )
      # general options
      call = [cmd, "-v", "quiet", "-y"]
      # input options
      if skip:
          # use "%f" to avoid scientific float notation
          call.extend(["-ss", "%f" % float(skip)])
      # if we decode from STDIN, the format must be specified
      if isinstance(infile, Signal):
          in_fmt = _ffmpeg_fmt(infile.dtype)
          in_ac = str(int(infile.num_channels))
          in_ar = str(int(infile.sample_rate))
          infile = "pipe:0"
          call.extend(["-f", in_fmt, "-ac", in_ac, "-ar", in_ar])
      elif isinstance(infile, file_types):
          infile = "pipe:0"
      else:
          infile = str(infile)
      call.extend(["-i", infile])
      if replaygain_mode:
          audio_filter = (
              "volume=replaygain=%s:replaygain_preamp=%.1f"
              % (replaygain_mode, replaygain_preamp)
          )
          call.extend(["-af", audio_filter])
      # output options
      call.extend(["-f", str(fmt)])
      if max_len:
          # use "%f" to avoid scientific float notation
          call.extend(["-t", "%f" % float(max_len)])
      # output options
      if num_channels:
          call.extend(["-ac", str(int(num_channels))])
      if channel is not None and (
          num_channels == 1 or num_channels is None
      ):
          # Calling with channel=x and num_channels
          call.extend(["-af", "pan=mono|c0=c%d" % int(channel)])
      if sample_rate:
          call.extend(["-ar", str(int(sample_rate))])
      call.append(output)
      return call
  
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 2 for calling a global function with example usage: _ffmpeg_call(infile, output, fmt, sample_rate, num_channels, channel, skip, max_len, cmd, replaygain_mode, replaygain_preamp) and returns: call