Menu

Blog

Sep 5, 2024

Music visualizer in the style of a Pong game

Posted by in categories: information science, media & arts, physics

You know the classic game Pong with the paddles and ball that moves across the screen? Imagine the ball and paddles synchronized to music. Victor Tao approached the challenge as an optimization problem to figure out where the paddle and balls should go, based on the beats of a song:

Fortunately there is a mature field dedicated to optimizing an objective (screen utilization) with respect to variables (the locations of bounces) in the presence of constraints on those variables (physics and the beats of the song). If we write our requirements as a constrained optimization problem, we can use an off-the-shelf solver to compute optimal paddle positions instead of designing an algorithm ourselves.

The result is Song Pong, and the Python code is on GitHub. [via Waxy].

Leave a reply