Bytebeat: Sound from Javascript functions

How I made the sample song? Or how this works in general?