g();
					songName.innerHTML = song.title;

					// We could loop over all the patterns to get the real length, but a rough estimate is good enough.
					patternLength = song.patterns[song.patternTable[0]].length;
					songLength = song.length*patternLength;

					// only autostart
					if (autoPlay) togglePlay();
				});
			};

			// setup UI

			playButton.onclick = function(){
				autoPlay = true;
				togglePlay();
			};

			// setup progress bar to seek into the song
			progressBar.oninput = function(){