class_docstr: Base class for audio clips.
  
  See ``AudioFileClip`` and ``CompositeAudioClip`` for usable classes.
  
  An AudioClip is a Clip with a ``make_frame``  attribute of
  the form `` t -> [ f_t ]`` for mono sound and
  ``t-> [ f1_t, f2_t ]`` for stereo sound (the arrays are Numpy arrays).
  The `f_t` are floats between -1 and 1. These bounds can be
  trespassed without problems (the program will put the
  sound back into the bounds at conversion time, without much impact).
  
  Parameters
  ----------
  
  make_frame
    A function `t-> frame at time t`. The frame does not mean much
    for a sound, it is just a float. What 'makes' the sound are
    the variations of that float in the time.
  
  duration
    Duration of the clip (in seconds). Some clips are infinite, in
    this case their duration will be ``None``.
  
  nchannels
    Number of channels (one or two for mono or stereo).
  
  Examples
  --------
  
  >>> # Plays the note A in mono (a sine wave of frequency 440 Hz)
  >>> import numpy as np
  >>> make_frame = lambda t: np.sin(440 * 2 * np.pi * t)
  >>> clip = AudioClip(make_frame, duration=5, fps=44100)
  >>> clip.preview()
  
  >>> # Plays the note A in stereo (two sine waves of frequencies 440 and 880 Hz)
  >>> make_frame = lambda t: np.array([
  ...     np.sin(440 * 2 * np.pi * t),
  ...     np.sin(880 * 2 * np.pi * t)
  ... ]).T.copy(order="C")
  >>> clip = AudioClip(make_frame, duration=3, fps=44100)
  >>> clip.preview()
class_docstr_tok: ["Base","class","for","audio","clips",".","See","``","AudioFileClip","``","and","``","CompositeAudioClip","``","for","usable","classes",".","An","AudioClip","is","a","Clip","with","a","``","make_frame","``","attribute","of","the","form","``","t","-",">","[","f_t","]","``","for","mono","sound","and","``","t-",">","[","f1_t",",","f2_t","]","``","for","stereo","sound","(","the","arrays","are","Numpy","arrays",")",".","The","`","f_t","`","are","floats","between","-1","and","1",".","These","bounds","can","be","trespassed","without","problems","(","the","program","will","put","the","sound","back","into","the","bounds","at","conversion","time",",","without","much","impact",")",".","Parameters","--","--","--","--","--","make_frame","A","function","`","t-",">","frame","at","time","t","`",".","The","frame","does","not","mean","much","for","a","sound",",","it","is","just","a","float",".","What","'makes","'","the","sound","are","the","variations","of","that","float","in","the","time",".","duration","Duration","of","the","clip","(","in","seconds",")",".","Some","clips","are","infinite",",","in","this","case","their","duration","will","be","``","None","``",".","nchannels","Number","of","channels","(","one","or","two","for","mono","or","stereo",")",".","Examples","--","--","--","--",">",">",">","#","Plays","the","note","A","in","mono","(","a","sine","wave","of","frequency","440","Hz",")",">",">",">","import","numpy","as","np",">",">",">","make_frame","=","lambda","t",":","np.sin","(","440","*","2","*","np.pi","*","t",")",">",">",">","clip","=","AudioClip","(","make_frame",",","duration=5",",","fps=44100",")",">",">",">","clip.preview","(",")",">",">",">","#","Plays","the","note","A","in","stereo","(","two","sine","waves","of","frequencies","440","and","880","Hz",")",">",">",">","make_frame","=","lambda","t",":","np.array","(","[","...","np.sin","(","440","*","2","*","np.pi","*","t",")",",","...","np.sin","(","880","*","2","*","np.pi","*","t",")","...","]",")",".T.copy","(","order=","''","C","''",")",">",">",">","clip","=","AudioClip","(","make_frame",",","duration=3",",","fps=44100",")",">",">",">","clip.preview","(",")"]
docstr: Writes an audio file from the AudioClip.
  
  
  Parameters
  ----------
  
  filename
    Name of the output file, as a string or a path-like object.
  
  fps
    Frames per second. If not set, it will try default to self.fps if
    already set, otherwise it will default to 44100.
  
  nbytes
    Sample width (set to 2 for 16-bit sound, 4 for 32-bit sound)
  
  codec
    Which audio codec should be used. If None provided, the codec is
    determined based on the extension of the filename. Choose
    'pcm_s16le' for 16-bit wav and 'pcm_s32le' for 32-bit wav.
  
  bitrate
    Audio bitrate, given as a string like '50k', '500k', '3000k'.
    Will determine the size and quality of the output file.
    Note that it mainly an indicative goal, the bitrate won't
    necessarily be the this in the output file.
  
  ffmpeg_params
    Any additional parameters you would like to pass, as a list
    of terms, like ['-option1', 'value1', '-option2', 'value2']
  
  write_logfile
    If true, produces a detailed logfile named filename + '.log'
    when writing the file
  
  logger
    Either ``"bar"`` for progress bar or ``None`` or any Proglog logger.
docstr_tok: ["Writes","an","audio","file","from","the","AudioClip",".","Parameters","--","--","--","--","--","filename","Name","of","the","output","file",",","as","a","string","or","a","path-like","object",".","fps","Frames","per","second",".","If","not","set",",","it","will","try","default","to","self.fps","if","already","set",",","otherwise","it","will","default","to","44100.","nbytes","Sample","width","(","set","to","2","for","16-bit","sound",",","4","for","32-bit","sound",")","codec","Which","audio","codec","should","be","used",".","If","None","provided",",","the","codec","is","determined","based","on","the","extension","of","the","filename",".","Choose","'pcm_s16le","'","for","16-bit","wav","and","'pcm_s32le","'","for","32-bit","wav",".","bitrate","Audio","bitrate",",","given","as","a","string","like","'50k","'",",","'500k","'",",","'3000k","'",".","Will","determine","the","size","and","quality","of","the","output","file",".","Note","that","it","mainly","an","indicative","goal",",","the","bitrate","won't","necessarily","be","the","this","in","the","output","file",".","ffmpeg_params","Any","additional","parameters","you","would","like","to","pass",",","as","a","list","of","terms",",","like","[","'-option1","'",",","'value1","'",",","'-option2","'",",","'value2","'","]","write_logfile","If","true",",","produces","a","detailed","logfile","named","filename","+","'.log'","when","writing","the","file","logger","Either","``","``","bar","''","``","for","progress","bar","or","``","None","``","or","any","Proglog","logger","."]
code: def write_audiofile(
      self,
      filename,
      fps=None,
      nbytes=2,
      buffersize=2000,
      codec=None,
      bitrate=None,
      ffmpeg_params=None,
      write_logfile=False,
      logger="bar",
  ):
      """Writes an audio file from the AudioClip.
  
  
      Parameters
      ----------
  
      filename
        Name of the output file, as a string or a path-like object.
  
      fps
        Frames per second. If not set, it will try default to self.fps if
        already set, otherwise it will default to 44100.
  
      nbytes
        Sample width (set to 2 for 16-bit sound, 4 for 32-bit sound)
  
      codec
        Which audio codec should be used. If None provided, the codec is
        determined based on the extension of the filename. Choose
        'pcm_s16le' for 16-bit wav and 'pcm_s32le' for 32-bit wav.
  
      bitrate
        Audio bitrate, given as a string like '50k', '500k', '3000k'.
        Will determine the size and quality of the output file.
        Note that it mainly an indicative goal, the bitrate won't
        necessarily be the this in the output file.
  
      ffmpeg_params
        Any additional parameters you would like to pass, as a list
        of terms, like ['-option1', 'value1', '-option2', 'value2']
  
      write_logfile
        If true, produces a detailed logfile named filename + '.log'
        when writing the file
  
      logger
        Either ``"bar"`` for progress bar or ``None`` or any Proglog logger.
  
      """
      if not fps:
          if not self.fps:
              fps = 44100
          else:
              fps = self.fps
  
      if codec is None:
          name, ext = os.path.splitext(os.path.basename(filename))
          try:
              codec = extensions_dict[ext[1:]]["codec"][0]
          except KeyError:
              raise ValueError(
                  "MoviePy couldn't find the codec associated "
                  "with the filename. Provide the 'codec' "
                  "parameter in write_audiofile."
              )
  
      return ffmpeg_audiowrite(
          self,
          filename,
          fps,
          nbytes,
          buffersize,
          codec=codec,
          bitrate=bitrate,
          write_logfile=write_logfile,
          ffmpeg_params=ffmpeg_params,
          logger=logger,
      )
  
imports: import numbers
  import os
  import numpy
  import proglog
  from moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowrite
  from moviepy.Clip import Clip
  from moviepy.decorators import convert_path_to_string, requires_duration
  from moviepy.tools import extensions_dict
label_desc: Use image node_id 5 for calling the AudioClip obj's underlying member method code with example usage: obj.write_audiofile(filename, fps, nbytes, buffersize, codec, bitrate, ffmpeg_params, write_logfile, logger) and returns: ffmpeg_audiowrite