Aldo’s Game of Music

Conway’s game of life is a very famous cellular automaton which I’ve coded into a small game that also generates music from the input you give it.

In Conway’s game of life there’s an infinite grid of cells and a simple set of rules that guide each cell’s behavior. They are as follows:
1. Cells that have 1 or less neighbors die
2. Cells that have 2 neighbors do not change
3. Cells that have 3 neighbors stay/become alive
4. Cells that have 4 or more neighbors die

The rules that I’ve added so that it makes music are as follows:
1. Cells have a color based on their Y position (height)
2. Cells that are neighbors of each other form a group
3. Groups take on the color of their lowest member
4. For each color that is newly visible, play the note that is connected to that color