
local sv = require "sunvoxlua"

sv.open_slot(0);
sv.load(0, "test.sunvox")

-- subformat od https://www.qbasic.net/en/reference/qb11/Statement/PLAY-006.htm
function play(str)
	local note2num = {
		C = 60,
		D = 62,
		E = 64,
		F = 65,
		G = 67,
		A = 69,
		B = 71
	}
	
	
	str = string.upper(str)
	for i=1,string.len(str) do
		if note2num[string.sub(str, i, i)] then
			sv.send_event(0, 0, note2num[string.sub(str, i, i)], 0, 2, 0, 0)
			sv.sleep(1000)
		end
	end

end

play "CDEFGAB"