class_docstr: The Stream_Reader continuously reads data from a selected sound source using PyAudio
  
  Arguments:
  
      device: int or None:    Select which audio stream to read .
      rate: float or None:    Sample rate to use. Defaults to something supported.
      updatesPerSecond: int:  How often to record new data.
class_docstr_tok: ["The","Stream_Reader","continuously","reads","data","from","a","selected","sound","source","using","PyAudio","Arguments",":","device",":","int","or","None",":","Select","which","audio","stream","to","read",".","rate",":","float","or","None",":","Sample","rate","to","use",".","Defaults","to","something","supported",".","updatesPerSecond",":","int",":","How","often","to","record","new","data","."]
code: def __init__(
      self,
      device=None,
      rate=None,
      updates_per_second=1000,
      FFT_window_size=None,
      verbose=False,
  ):
      self.rate = rate
      self.verbose = verbose
      self.pa = pyaudio.PyAudio()
  
      # Temporary variables #hacks!
      self.update_window_n_frames = (
          1024  # Don't remove this, needed for device testing!
      )
      self.data_buffer = None
  
      self.device = device
      if self.device is None:
          self.device = self.input_device()
      if self.rate is None:
          self.rate = self.valid_low_rate(self.device)
  
      self.update_window_n_frames = round_up_to_even(
          self.rate / updates_per_second
      )
      self.updates_per_second = self.rate / self.update_window_n_frames
      self.info = self.pa.get_device_info_by_index(self.device)
      self.data_capture_delays = deque(maxlen=20)
      self.new_data = False
      if self.verbose:
          self.data_capture_delays = deque(maxlen=20)
          self.num_data_captures = 0
  
      self.stream = self.pa.open(
          input_device_index=self.device,
          format=pyaudio.paInt16,
          channels=1,
          rate=self.rate,
          input=True,
          frames_per_buffer=self.update_window_n_frames,
          stream_callback=self.non_blocking_stream_read,
      )
  
      print(
          "\n##################################################################################################"
      )
      print("\nDefaulted to using first working mic, Running on:")
      self.print_mic_info(self.device)
      print(
          "\n##################################################################################################"
      )
      print(
          "Recording from %s at %d Hz\nUsing (non-overlapping) data-windows of %d samples (updating at %.2ffps)"
          % (
              self.info["name"],
              self.rate,
              self.update_window_n_frames,
              self.updates_per_second,
          )
      )
  
file_path: rt-audio-fft/src/stream_reader_pyaudio.py
imports: import numpy
  import pyaudio
  import time, sys, math
  from collections import deque
  from src.utils import *
label_desc: Use image node_id 1 to create a new Stream_Reader object  with example: obj = Stream_Reader(device, rate, updates_per_second, FFT_window_size, verbose)