Eyesy and Chat GPT

I have been getting some success downloading eyesy patches on patchstorage.com, not all of them work for me but a few do. I tried to create a patch on Chat GPT, but I can’t get it to work correctly. It is the free version of chat gpt and I have sent it photos of the errors, and described as much as I can. I was curious to see if anyone else has had success making a patch, or coding, with chat gpt. I will share the code it wrote for me and hopefully someone can help me to understand more of what I am missing. I will continue to research, practice, and attempt to code and make cool patches.

import pygame
import pygame.gfxdraw
import random
import math

Initialize parameters

eyes_brightness = 0
mouth_open = 0
background_rotation = 0 # For swirling background
eye_color = [255, 0, 0] # Initial color for eyes
mouth_color = [255, 255, 255] # Initial color for mouth

def setup():
pygame.gfxdraw.filled_rectangle(etc.screen, (0, 0, etc.xres, etc.yres), (0, 0, 0))

def draw():
global eyes_brightness, mouth_open, background_rotation, eye_color, mouth_color

# Analyze audio frequencies
low_freq = etc.audio_in[0]  # Low frequencies (mouth)
high_freq = etc.audio_in[2]  # High frequencies (eyes)

# Set thresholds for reaction
mouth_open = int(low_freq * 50)
eyes_brightness = int(high_freq * 255)

# Trigger random color change on significant reaction
if eyes_brightness > 200:
    eye_color = [random.randint(0, 255) for _ in range(3)]
if mouth_open > 20:
    mouth_color = [random.randint(0, 255) for _ in range(3)]

# Draw swirling background
draw_swirl(background_rotation)
background_rotation += 0.05  # Constant rotation speed

# Draw Skull with reactive eyes and mouth
draw_skull(eye_color, eyes_brightness, mouth_color, mouth_open)

def draw_swirl(rotation):
# Draw rotating background pattern
for i in range(10):
color = [(math.sin(rotation + i) * 127 + 128) for _ in range(3)]
swirl_color = (int(color[0]), int(color[1]), int(color[2]))
pygame.gfxdraw.filled_circle(etc.screen, 64, 64, i * 10 + 5, swirl_color)

def draw_skull(eye_color, eyes_brightness, mouth_color, mouth_open):
# Skull outline
pygame.gfxdraw.aacircle(etc.screen, 64, 64, 50, (255, 255, 255)) # Head

# Eyes with reactive color
pygame.gfxdraw.filled_circle(etc.screen, 48, 50, 8, eye_color)  # Left eye
pygame.gfxdraw.filled_circle(etc.screen, 80, 50, 8, eye_color)  # Right eye

# Mouth with reactive color
pygame.gfxdraw.box(etc.screen, (54, 80, 20, mouth_open), mouth_color)  # Mouth opens based on low frequency volume

Start the visualizer

Ensure setup and draw are connected to Eyesy’s main loop or equivalent function.

Hi,

There are two errors I can see right off the bat:

  1. Add import os to the other libraries to import at the top of the file.
  2. The two lines of code below # Analyze audio frequencies won’t be evaluating the frequencies of the incoming audio - EYESY doesn’t have a built-in method for determining frequency. The two lines of code will just be reading two of 100 values of the audio input buffer.

Using ChatGPT can be helpful but it can make many incorrect assumptions about how the EYESY (or any platform/language) works. It’s probably best to start with a simple premise and then build up complexity as you go such as:

  1. draw a red circle in the center with a radius of 10 pixels.
  2. …Now, make it orbit the center of the screen while keeping within the Y resolution.
  3. …Now make the radius dependent on audio amplitude (aka ‘etc.audio_in[ ]’))

You can always provide existing code for ChatGPT as a reference point.

1 Like

Thank you very much that is the most helpful advice I’ve gotten so far, I appreciate it

Also check out the EYESY bot, which is just GPT 4, but prompted/ tuned for making EYESY programs:

1 Like

That’s really cool, thank you so much for sharing that info, I’ll be testing that out asap.