class_docstr: The Spectrum_Visualizer visualizes spectral FFT data using a simple PyGame GUI
class_docstr_tok: ["The","Spectrum_Visualizer","visualizes","spectral","FFT","data","using","a","simple","PyGame","GUI"]
code: def start(self):
      print("Starting spectrum visualizer...")
      pygame.init()
      self.screen = pygame.display.set_mode((self.WIDTH, self.HEIGHT))
      self.screen.fill((self.bg_color, self.bg_color, self.bg_color))
  
      if self.plot_audio_history:
          self.screen.set_alpha(255)
          self.prev_screen = self.screen
  
      pygame.display.set_caption(
          "Spectrum Analyzer -- (FFT-Peak: %05d Hz)"
          % self.ear.strongest_frequency
      )
      self.bin_font = pygame.font.Font(
          "freesansbold.ttf", round(0.025 * self.HEIGHT)
      )
      self.fps_font = pygame.font.Font(
          "freesansbold.ttf", round(0.05 * self.HEIGHT)
      )
  
      for i in range(self.ear.n_frequency_bins):
          if i == 0 or i == (self.ear.n_frequency_bins - 1):
              continue
          if i % self.tag_every_n_bins == 0:
              f_centre = self.ear.frequency_bin_centres[i]
              text = self.bin_font.render(
                  "%d Hz" % f_centre,
                  True,
                  (255, 255, 255),
                  (self.bg_color, self.bg_color, self.bg_color),
              )
              textRect = text.get_rect()
              x = (
                  i * (self.WIDTH / self.ear.n_frequency_bins)
                  + (self.bar_width - textRect.x) / 2
              )
              y = 0.98 * self.HEIGHT
              textRect.center = (int(x), int(y))
              self.bin_text_tags.append(text)
              self.bin_rectangles.append(textRect)
  
      self._is_running = True
  
      # Interactive components:
      self.button_height = round(0.05 * self.HEIGHT)
      self.history_button = Button(
          text="Toggle 2D/3D Mode",
          right=self.WIDTH,
          top=0,
          width=round(0.12 * self.WIDTH),
          height=self.button_height,
      )
      self.slow_bar_button = Button(
          text="Toggle Slow Bars",
          right=self.WIDTH,
          top=self.history_button.height,
          width=round(0.12 * self.WIDTH),
          height=self.button_height,
      )
  
file_path: rt-audio-fft/src/visualizer.py
imports: import numpy
  import time, sys, math
  import pygame
  from collections import deque
  from src.utils import Button
  from matplotlib import cm
label_desc: Use image node_id 3 for calling the Spectrum_Visualizer obj's underlying member method code with example usage: obj.start() without return types