@name Zelda Theme
@inputs Button
@model 
@persist X On

interval(50)

if(Button&~Button) {
    On = !On
    if(On) {soundPlay(0,0,"synth/tri.wav")}
    if(!On) {soundPurge()}
}
if(On) {X++} else{X = 0}

Song = "    ssssssssssssssss       s ss s s sssss a ssssssssssssss s ss s s sssss a ssssssssssssss s ss s s sss [ [ [[[ [ [ [[[ [ "+
"[ [[[ [[[ sssssss [[[[[[[[q[[[[[ s ssccvvggnnnnnnnnnnnnnnnnnnn nnn nnnnjjkkllllllllllllllllllll lll lllkkjjkkkkkkjjnnnnnnnnnnnnnnn"+
" nnnnnnnnggg ggnnjjjjjjjjjjjjjjjjnnnnggggfff ffggnnnnnnnnnnnnnnnnggggffffccc ccvvbbbbbbbbbbbbbbbbmmmmmmmmnnnn[ [ [[[ [ [ [[[ [ [ "+
"[[[ [[[["

Note = Song:index(X)
if(Note == " ") {PV = 0}
if(Note == "[") {PV = 76} # F
if(Note == "a") {PV = 79} # G#
if(Note == "s") {PV = 81} # A#
if(Note == "c") {PV = 83} # C - Up
if(Note == "f") {PV = 84} # C#
if(Note == "v") {PV = 85} # D
if(Note == "g") {PV = 86} # D#
if(Note == "b") {PV = 87} # E
if(Note == "n") {PV = 88} # F
if(Note == "j") {PV = 89} # F#
if(Note == "m") {PV = 90} # G
if(Note == "k") {PV = 91} # G#
if(Note == "l") {PV = 93} # A#

soundPitch(0,2^(PV/12))

if(X > Song:length()) {X = 132}
