MarkFergus

music/main

Oct 30th, 2020 (edited)
974
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("/music/Harmonie")
  2. local g = Harmonie.load({"gamme_simple"})
  3.  
  4. function gn(n)
  5.     local dN = maths.floor(n/12)
  6.     local nN = n - dN*12
  7.     local obj = g[nN]
  8.     obj["val"] = n -- broken ?
  9.     obj["octaves"] = dN -- broken ?
  10.     return obj
  11. end
  12.  
  13. function gLine(sN,mI)
  14.     local obj = {}
  15.     obj["sN"] = sN
  16.     for i=1,mI do
  17.         obj[i] = gn(sN+i)
  18.     end
  19.     return obj
  20. end
  21.  
  22. function dLine(m,index)
  23.     local obj = index
  24.     local x,y = m.getCursorPos()
  25.     if obj["sN"] ~= nil then
  26.         m.write(gn(obj["sN"]).name)
  27.     end
  28.     m.setCursorPos(x+6,y)
  29.     for i,v in pairs(obj) do
  30.         if i ~= "sN" then
  31.             x,y = m.getCursorPos()
  32.             m.write("; "..v.name)
  33.             m.setCursorPos(x+7,y)
  34.         end
  35.     end
  36.     m.setCursorPos(1,y+1)
  37. end
  38.  
  39. function main(m,acc,arg)
  40.     for i,v in pairs(acc) do
  41.         dLine(m,gLine(v.val,arg))
  42.     end
  43. end
  44.  
  45. acc = {5,10,14,20,25,30}
  46. main(peripheral.find("monitor"),acc,21)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×