play skript

This commit is contained in:
severak 2019-10-02 01:25:26 +02:00
parent 3734dee889
commit 630e50a716
1 changed files with 30 additions and 0 deletions

30
sunvoxlua/play.lua Normal file
View File

@ -0,0 +1,30 @@
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"