function CreateSimpleHTMLForUI(word) local preHTML = [[

]] local postHTML = [[

]] return preHTML .. word .. postHTML end function MainCoroutine() print("Main coroutine started") local shouldRecord = true; local avgNote; local notesDict = {} print("Recording starting") engine:SoundRecordStart() while true do avgNote = engine:SoundRecordGetAverageNote() --print(avgNote) if avgNote ~= "C 0" then avgNote = string.sub(avgNote,1,1) print("Found note: " .. avgNote) if avgNote == "C" then engine:SendScryMessageToServer(1,"HighestNote",avgNote) player:SendMessageToGUI("GGJ2015", CreateSimpleHTMLForUI("Power of the Sea")) elseif avgNote == "D" then print("Deactivated note") elseif avgNote == "E" then engine:SendScryMessageToServer(1,"HighestNote",avgNote) player:SendMessageToGUI("GGJ2015", CreateSimpleHTMLForUI("Force of the Eee")) elseif avgNote == "F" then print("Deactivated note") elseif avgNote == "G" then engine:SendScryMessageToServer(1,"HighestNote",avgNote) player:SendMessageToGUI("GGJ2015", CreateSimpleHTMLForUI("The Song of Gaa")) elseif avgNote == "A" then engine:SendScryMessageToServer(1,"HighestNote",avgNote) player:SendMessageToGUI("GGJ2015", CreateSimpleHTMLForUI("The Song of Gaa")) elseif avgNote == "B" then print("Deactivated note") else print("Note not recognized") end end coroutine.yield(100) end engine:SoundRecordStop() end print("Words of Power lua script loaded") local luaScriptComponent = player:GetGameObject():AddLuaScriptComponent(true) luaScriptComponent:StartCoroutine(coroutine.create(MainCoroutine))