Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local inst_pl = "harp"
- local inst_pl_la = nil
- local notew = 0.2
- local note_pl = 0.2
- local note_pl_la = nil
- local function inst_sort(table,inst,i)
- if inst_pl_la ~= nil and table[i].inst == nil then
- inst_pl = inst_pl_la
- elseif table[i].inst == nil and inst_pl_la == nil then
- inst_pl = inst
- else
- inst_pl = table[i].inst
- inst_pl_la = inst_pl
- end
- end
- local function wait_sort(table,wait,i)
- if note_pl_la ~= nil and table[i].wait == nil then
- note_pl = note_pl_la
- elseif table[i].wait == nil and note_pl_la == nil then
- note_pl = wait
- else
- note_pl = table[i].wait
- note_pl_la = note_pl
- end
- end
- function playnoti(table,wait,inst,vol)
- local speaker = peripheral.find("speaker")
- for i=1,#table do
- inst_sort(table,inst,i)
- wait_sort(table,wait,i)
- for i2=1,#table[i].note do
- speaker.playNote(inst_pl, vol, table[i].note[i2])
- end
- sleep(note_pl * wait)
- end
- return
- end
- local playnotitestnotes = {
- {note = {6, 3, 11},wait = 0.2, inst = "guitar"},
- {note = {8, 1, 15}},
- {note = {10, 15, 18}},
- {note = {6,10,13},wait = 0.4, inst = "harp"},
- {note = {8,11,6}},
- {note = {6,1,10}}
- }
- local waitmul = 0.8
- local instdef = "harp"
- local voldef = 80
- playnoti(playnotitestnotes, waitmul, instdef, voldef)
Advertisement
Add Comment
Please, Sign In to add comment