class_docstr: Creates a new ``AudioData`` instance, which represents mono audio data.
  
  The raw audio data is specified by ``frame_data``, which is a sequence of bytes representing audio samples. This is the frame data structure used by the PCM WAV format.
  
  The width of each sample, in bytes, is specified by ``sample_width``. Each group of ``sample_width`` bytes represents a single audio sample.
  
  The audio data is assumed to have a sample rate of ``sample_rate`` samples per second (Hertz).
  
  Usually, instances of this class are obtained from ``recognizer_instance.record`` or ``recognizer_instance.listen``, or in the callback for ``recognizer_instance.listen_in_background``, rather than instantiating them directly.
class_docstr_tok: ["Creates","a","new","``","AudioData","``","instance",",","which","represents","mono","audio","data",".","The","raw","audio","data","is","specified","by","``","frame_data","``",",","which","is","a","sequence","of","bytes","representing","audio","samples",".","This","is","the","frame","data","structure","used","by","the","PCM","WAV","format",".","The","width","of","each","sample",",","in","bytes",",","is","specified","by","``","sample_width","``",".","Each","group","of","``","sample_width","``","bytes","represents","a","single","audio","sample",".","The","audio","data","is","assumed","to","have","a","sample","rate","of","``","sample_rate","``","samples","per","second","(","Hertz",")",".","Usually",",","instances","of","this","class","are","obtained","from","``","recognizer_instance.record","``","or","``","recognizer_instance.listen","``",",","or","in","the","callback","for","``","recognizer_instance.listen_in_background","``",",","rather","than","instantiating","them","directly","."]
docstr: Returns a byte string representing the contents of a FLAC file containing the audio represented by the ``AudioData`` instance.
  
  Note that 32-bit FLAC is not supported. If the audio data is 32-bit and ``convert_width`` is not specified, then the resulting FLAC will be a 24-bit FLAC.
  
  If ``convert_rate`` is specified and the audio sample rate is not ``convert_rate`` Hz, the resulting audio is resampled to match.
  
  If ``convert_width`` is specified and the audio samples are not ``convert_width`` bytes each, the resulting audio is converted to match.
  
  Writing these bytes directly to a file results in a valid `FLAC file <https://en.wikipedia.org/wiki/FLAC>`__.
docstr_tok: ["Returns","a","byte","string","representing","the","contents","of","a","FLAC","file","containing","the","audio","represented","by","the","``","AudioData","``","instance",".","Note","that","32-bit","FLAC","is","not","supported",".","If","the","audio","data","is","32-bit","and","``","convert_width","``","is","not","specified",",","then","the","resulting","FLAC","will","be","a","24-bit","FLAC",".","If","``","convert_rate","``","is","specified","and","the","audio","sample","rate","is","not","``","convert_rate","``","Hz",",","the","resulting","audio","is","resampled","to","match",".","If","``","convert_width","``","is","specified","and","the","audio","samples","are","not","``","convert_width","``","bytes","each",",","the","resulting","audio","is","converted","to","match",".","Writing","these","bytes","directly","to","a","file","results","in","a","valid","`","FLAC","file","<","https",":","\/\/en.wikipedia.org\/wiki\/FLAC",">","`","__","."]
code: def get_flac_data(self, convert_rate=None, convert_width=None):
      """
      Returns a byte string representing the contents of a FLAC file containing the audio represented by the ``AudioData`` instance.
  
      Note that 32-bit FLAC is not supported. If the audio data is 32-bit and ``convert_width`` is not specified, then the resulting FLAC will be a 24-bit FLAC.
  
      If ``convert_rate`` is specified and the audio sample rate is not ``convert_rate`` Hz, the resulting audio is resampled to match.
  
      If ``convert_width`` is specified and the audio samples are not ``convert_width`` bytes each, the resulting audio is converted to match.
  
      Writing these bytes directly to a file results in a valid `FLAC file <https://en.wikipedia.org/wiki/FLAC>`__.
      """
      assert convert_width is None or (
          convert_width % 1 == 0 and 1 <= convert_width <= 3
      ), "Sample width to convert to must be between 1 and 3 inclusive"
  
      if (
          self.sample_width > 3 and convert_width is None
      ):  # resulting WAV data would be 32-bit, which is not convertable to FLAC using our encoder
          convert_width = 3  # the largest supported sample width is 24-bit, so we'll limit the sample width to that
  
      # run the FLAC converter with the WAV data to get the FLAC data
      wav_data = self.get_wav_data(convert_rate, convert_width)
      flac_converter = get_flac_converter()
      if (
          os.name == "nt"
      ):  # on Windows, specify that the process is to be started without showing a console window
          startup_info = subprocess.STARTUPINFO()
          startup_info.dwFlags |= (
              subprocess.STARTF_USESHOWWINDOW
          )  # specify that the wShowWindow field of `startup_info` contains a value
          startup_info.wShowWindow = (
              subprocess.SW_HIDE
          )  # specify that the console window should be hidden
      else:
          startup_info = None  # default startupinfo
      process = subprocess.Popen(
          [
              flac_converter,
              "--stdout",
              "--totally-silent",  # put the resulting FLAC file in stdout, and make sure it's not mixed with any program output
              "--best",  # highest level of compression available
              "-",  # the input FLAC file contents will be given in stdin
          ],
          stdin=subprocess.PIPE,
          stdout=subprocess.PIPE,
          startupinfo=startup_info,
      )
      flac_data, stderr = process.communicate(wav_data)
      return flac_data
  
file_path: speech_recognition/speech_recognition/audio.py
imports: import aifc
  import audioop
  import io
  import os
  import platform
  import stat
  import subprocess
  import sys
  import wave
label_desc: Use image node_id 6 for calling the AudioData obj's underlying member method code with example usage: obj.get_flac_data(convert_rate, convert_width) and returns: flac_data