There's two narrative levels, narrative and metanarrative.
The narrative is that on father's day 1960 Roy trapped his son and his son's friends in his machine punishing them and making them learn lessons. At the end he allows Red Guy to unplug the machine and free them.
The metanarrative goes like this:
The whole thing is a show.
Red wrote the Notebook song.
He also wrote the file song which was also in the computer.
Red is a writer, Roy is a producer, Yellow Guy is the audience, and Duck Guy is an actor.
Red's ideas are getting fucked up and corrupted by Roy's executive control.
In episode 4 Roy prevented Red's song about geography from being sung at all and instead used his own song, and Red quit. Without Red the songs become more and more nonsensical and torturous for both the audience and the actor, and the actor quits as well (I DON'T WANT TO DO THIS ANYMORE)
Red comes back to the show because he finds not working as a writer unbearable, but cannot salvage it as it currently is, he and Roy agree to pull the plug and start over.
It's almost exactly the same, but stripped of extraneous detail and now everyone is their favorite color, likely indicating that now the new show is free of Roy's influence.