function UnDigify(v)if v<1 or v>61 then return""elseif v==1 then return"\049"elseif v==2 then return"\033"elseif v==3 then return"\050"elseif v==4 then return"\064"elseif v==5 then return"\051"elseif v==6 then return"\052"elseif v==7 then return"\036"elseif v==8 then return"\053"elseif v==9 then return"\037"elseif v==10 then return"\054"elseif v==11 then return"\094"elseif v==12 then return"\055"elseif v==13 then return"\056"elseif v==14 then return"\042"elseif v==15 then return"\057"elseif v==16 then return"\040"elseif v==17 then return"\048"elseif v==18 then return"\113"elseif v==19 then return"\081"elseif v==20 then return"\119"elseif v==21 then return"\087"elseif v==22 then return"\101"elseif v==23 then return"\069"elseif v==24 then return"\114"elseif v==25 then return"\116"elseif v==26 then return"\084"elseif v==27 then return"\121"elseif v==28 then return"\089"elseif v==29 then return"\117"elseif v==30 then return"\105"elseif v==31 then return"\073"elseif v==32 then return"\111"elseif v==33 then return"\079"elseif v==34 then return"\112"elseif v==35 then return"\080"elseif v==36 then return"\097"elseif v==37 then return"\115"elseif v==38 then return"\083"elseif v==39 then return"\100"elseif v==40 then return"\068"elseif v==41 then return"\102"elseif v==42 then return"\103"elseif v==43 then return"\071"elseif v==44 then return"\104"elseif v==45 then return"\072"elseif v==46 then return"\106"elseif v==47 then return"\074"elseif v==48 then return"\107"elseif v==49 then return"\108"elseif v==50 then return"\076"elseif v==51 then return"\122"elseif v==52 then return"\090"elseif v==53 then return"\120"elseif v==54 then return"\099"elseif v==55 then return"\067"elseif v==56 then return"\118"elseif v==57 then return"\086"elseif v==58 then return"\098"elseif v==59 then return"\066"elseif v==60 then return"\110"elseif v==61 then return"\109"else return"\063"end end function IsBlack(v)if v%12==2 or v%12==4 or v%12==7 or v%12==9 or v%12==11 then return true end end local v=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")function Tween(f,q,z,W,...)local l=TweenInfo.new(z,...)local Z=v:Create(f,l,q)Z:Play()if W then Z.Completed:wait()end return end local f=Piano.Case.Originals:GetChildren()function HighlightPianoKey(v,q)if not Settings.KeyAesthetics then return end local z=math.ceil(v/12)local W=(v-1)%12+1 local l=3 local Z=.2 local g=.25 local x=Keys[z][W]local h=x:GetChildren()for v,q in pairs(h)do if v>=#h then local v=q local g={}g.Position=Vector3.new(q.Position.x,f[z][W][q.Name].Position.y+l,q.Position.z)Tween(v,g,Z,true,Enum.EasingStyle.Linear)else local v=q local g={}g.Position=Vector3.new(q.Position.x,f[z][W][q.Name].Position.y+l,q.Position.z)Tween(v,g,Z,false,Enum.EasingStyle.Linear)end end for v,q in pairs(h)do if v>=#h then local v=q local Z={}Z.Position=Vector3.new(q.Position.x,f[z][W][q.Name].Position.y-l,q.Position.z)Tween(v,Z,g,true,Enum.EasingStyle.Linear)else local v=q local Z={}Z.Position=Vector3.new(q.Position.x,f[z][W][q.Name].Position.y-l,q.Position.z)Tween(v,Z,g,false,Enum.EasingStyle.Linear)end end for v,q in pairs(h)do q.CFrame=f[z][W][q.Name].CFrame end return end


function UnDigify(digit)
	if digit < 1 or digit > 61 then
		return ""
	elseif digit == 1 then
		return "1"
	elseif digit == 2 then
		return "!"
	elseif digit == 3 then
		return "2"
	elseif digit == 4 then
		return "@"
	elseif digit == 5 then
		return "3"
	elseif digit == 6 then
		return "4"
	elseif digit == 7 then
		return "$"
	elseif digit == 8 then
		return "5"
	elseif digit == 9 then
		return "%"
	elseif digit == 10 then
		return "6"
	elseif digit == 11 then
		return "^"
	elseif digit == 12 then
		return "7"
	elseif digit == 13 then
		return "8"
	elseif digit == 14 then
		return "*"
	elseif digit == 15 then
		return "9"
	elseif digit == 16 then
		return "("
	elseif digit == 17 then
		return "0"
	elseif digit == 18 then
		return "q"
	elseif digit == 19 then
		return "Q"
	elseif digit == 20 then
		return "w"
	elseif digit == 21 then
		return "W"
	elseif digit == 22 then
		return "e"
	elseif digit == 23 then
		return "E"
	elseif digit == 24 then
		return "r"
	elseif digit == 25 then
		return "t"
	elseif digit == 26 then
		return "T"
	elseif digit == 27 then
		return "y"
	elseif digit == 28 then
		return "Y"
	elseif digit == 29 then
		return "u"
	elseif digit == 30 then
		return "i"
	elseif digit == 31 then
		return "I"
	elseif digit == 32 then
		return "o"
	elseif digit == 33 then
		return "O"
	elseif digit == 34 then
		return "p"
	elseif digit == 35 then
		return "P"
	elseif digit == 36 then
		return "a"
	elseif digit == 37 then
		return "s"
	elseif digit == 38 then
		return "S"
	elseif digit == 39 then
		return "d"
	elseif digit == 40 then
		return "D"
	elseif digit == 41 then
		return "f"
	elseif digit == 42 then
		return "g"
	elseif digit == 43 then
		return "G"
	elseif digit == 44 then
		return "h"
	elseif digit == 45 then
		return "H"
	elseif digit == 46 then
		return "j"
	elseif digit == 47 then
		return "J"
	elseif digit == 48 then
		return "k"
	elseif digit == 49 then
		return "l"
	elseif digit == 50 then
		return "L"
	elseif digit == 51 then
		return "z"
	elseif digit == 52 then
		return "Z"
	elseif digit == 53 then
		return "x"
	elseif digit == 54 then
		return "c"
	elseif digit == 55 then
		return "C"
	elseif digit == 56 then
		return "v"
	elseif digit == 57 then
		return "V"
	elseif digit == 58 then
		return "b"
	elseif digit == 59 then
		return "B"
	elseif digit == 60 then
		return "n"
	elseif digit == 61 then
		return "m"
  	else
    	return "?"
	end
end
function IsBlack(note)
	if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
		return true
	end
end

local TweenService = game:GetService("TweenService")
function Tween(obj,Goal,Time,Wait,...)
    local TwInfo = TweenInfo.new(Time,...)
    local twn = TweenService:Create(obj, TwInfo, Goal)
    twn:Play()
    if Wait then
        twn.Completed:wait()
    end
	return
end

local originals = Piano.Case.Originals:GetChildren()

function HighlightPianoKey(note1,transpose)
	if not Settings.KeyAesthetics then return end
	local octave = math.ceil(note1/12)
	local note2 = (note1 - 1)%12 + 1
	local yDist = 3
	local TimeUp = .2
	local TimeDn = .25
	local key = Keys[octave][note2]
	local parts = key:GetChildren()
	for i,v in pairs(parts) do
		if i >= #parts then
			local obj = v
			local Properties = {}
			Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y + yDist,v.Position.z)
			Tween(obj,Properties,TimeUp,true,Enum.EasingStyle.Linear)
		else
			local obj = v
			local Properties = {}
			Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y + yDist,v.Position.z)
			Tween(obj,Properties,TimeUp,false,Enum.EasingStyle.Linear)
		end
	end
	for i,v in pairs(parts) do
		if i >= #parts then
			local obj = v
			local Properties = {}
			Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y - yDist,v.Position.z)
			Tween(obj,Properties,TimeDn,true,Enum.EasingStyle.Linear)
		else
			local obj = v
			local Properties = {}
			Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y - yDist,v.Position.z)
			Tween(obj,Properties,TimeDn,false,Enum.EasingStyle.Linear)
		end
	end
	for i,v in pairs(parts) do
		v.CFrame = originals[octave][note2][v.Name].CFrame
	end
	return
end
