@name
@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 = owner():lastSaid():lower()

Note = Song:index(X)
if(Note == " ") {PV = 0}
if(Note == "a") {PV = 10} # E
if(Note == "b") {PV = 15} # F
if(Note == "c") {PV = 20} # G#
if(Note == "d") {PV = 25} # A#
if(Note == "e") {PV = 30} # C - Up
if(Note == "f") {PV = 35} # C#
if(Note == "g") {PV = 40} # D
if(Note == "h") {PV = 45} # D#
if(Note == "i") {PV = 50} # E
if(Note == "j") {PV = 55} # F
if(Note == "k") {PV = 60} # F#
if(Note == "l") {PV = 65} # G
if(Note == "m") {PV = 70} # G#
if(Note == "n") {PV = 75} # A#
if(Note == "o") {PV = 80} # A#
if(Note == "p") {PV = 85} # A#
if(Note == "q") {PV = 90} # A#
if(Note == "r") {PV = 95} # A#
if(Note == "s") {PV = 100} # A#
if(Note == "t") {PV = 105} # A#
if(Note == "u") {PV = 110} # A#
if(Note == "v") {PV = 115} # A#
if(Note == "w") {PV = 120} # A#
if(Note == "x") {PV = 125} # A#
if(Note == "y") {PV = 130} # A#
if(Note == "z") {PV = 135} # A#

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

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