Skip to content

Instantly share code, notes, and snippets.

import os
os.environ["PYTHONWARNINGS"] = "ignore"
import warnings
warnings.filterwarnings("ignore")
import speech_recognition as sr
import subprocess
def play_song(song_name):
script_content = f"""#!/bin/bash
yt-dlp --no-playlist -x --audio-format wav -o - --quiet "ytsearch1:{song_name}" | ffmpeg -i - -f s16le -ar 48000 -ac 2 -
@YumpyMan
YumpyMan / VoiceColorPygame
Created March 11, 2026 01:10
Creates Pygame display with changing background colors based on voice input.
import speech_recognition as sr
import pygame
# Initialize recognizer
recognizer = sr.Recognizer()
# Initialize Pygame
pygame.init()
screen_width = 1024
screen_height = 600
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
import touchio
touch_pad = board.A0 # the ~1 pin
touch = touchio.TouchIn(touch_pad)
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
import touchio
touch_pad = board.A0 # the ~1 pin
touch = touchio.TouchIn(touch_pad)
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
import touchio
touch_pad = board.A0 # the ~1 pin
touch = touchio.TouchIn(touch_pad)
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
import touchio
touch_pad = board.A0 # the ~1 pin
touch = touchio.TouchIn(touch_pad)
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
import touchio
touch_pad = board.A0 # the ~1 pin
touch = touchio.TouchIn(touch_pad)
import board
import neopixel
import time
pixel_pin = board.D2 #the ring data is connected to this pin
num_pixels = 16 #number of leds pixels on the ring
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0) #RGB