Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local wait = sleep
- local bingNum = 1
- local bingPlayed = 1
- local bingTotal = 0
- local time = 0.5
- local t = os.date("!*t")
- local f = fs.open("User/Cloud/bing/Log/log", "a")
- local speaker = peripheral.find("speaker")
- local gla = peripheral.find("arController")
- local m = peripheral.wrap("monitor_0")
- local posX = 5
- local posY = 60
- local mposX = 1
- local mposY = 1
- local size = m.getSize()
- m.clear()
- m.setCursorPos(1, 1)
- m.setPaletteColour(colours.orange, 0x33dd33)
- m.setTextColour(colours.orange)
- m.setTextScale(0.8)
- print("instrument to use")
- local instr = read()
- print("volume(range of the audio)")
- local vol = tonumber(read())
- while true do
- if bingNum > 400 then
- time = 0.05
- elseif bingNum > 250 then
- time = 0.1
- elseif bingNum > 150 then
- time = 0.2
- elseif bingNum > 100 then
- time = 0.3
- elseif bingNum > 50 then
- time = 0.4
- else
- time = 0.5
- end
- for i = 1, bingNum do
- local pitch = math.random(0, 24)
- end
- speaker.playNote(instr, vol, pitch)
- bingTotal = bingTotal + 1
- print("That was bing number", bingPlayed)
- gla.clear() -- clears glasses ready for next writes
- m.clear() -- Clears monitor ready for next writes
- if bingNum < 10 then -- writes the instrument to the Glasses for the first 10 steps
- gla.drawString("The current instruement is: " .. instr, posX, posY, 0x59de92) -- Writes the instrument to Glasses
- gla.drawString("The current bing is: " .. bingPlayed, posX, posY + 10, 0x59de92) -- Writes bingPlayed to Glasses
- gla.drawString("That bings pitch is: " .. pitch, posX, posY + 20, 0x59de92) -- Writes the notes pitch
- gla.drawString("The number of bings in queue is: " .. bingNum, posX, posY + 30, 0x59de92) -- Writes bingNum to Glasses
- gla.drawString("The total number of bings played is : " .. bingTotal, posX, posY + 40, 0x59de92) -- Writes bingTotal to Glasses
- else
- gla.drawString("The current bing is: " .. bingPlayed, posX, posY, 0x59de92) -- Writes bingPlayed to Glasses
- gla.drawString("That bings pitch is: " .. pitch, posX, posY + 10, 0x59de92) -- Writes the notes pitch
- gla.drawString("The number of bings in queue is: " .. bingNum, posX, posY + 20, 0x59de92) -- Writes bingNum to Glasses
- gla.drawString("The total number of bings played is : " .. bingTotal, posX, posY + 30, 0x59de92) -- Writes bingTotal to Glasses
- end
- m.clear()
- m.write("The instrument is")
- m.setCursorPos(mposX, mposY + 1)
- m.write(instr)
- m.setCursorPos(mposX, mposY + 2)
- m.write("The current bing is")
- m.setCursorPos(mposX, mposY + 3)
- m.write(bingPlayed)
- m.setCursorPos(mposX, mposY + 4)
- m.write("That bings pitch is")
- m.setCursorPos(mposX, mposY + 5)
- m.write(pitch)
- m.setCursorPos(mposX, mposY + 6)
- m.write("The number of bings in queue is")
- m.setCursorPos(mposX, mposY + 7)
- m.write(bingNum)
- m.setCursorPos(mposX, mposY + 8)
- m.write("The total number of bings played is")
- m.setCursorPos(mposX, mposY + 9)
- m.write(bingTotal)
- m.setCursorPos(mposX, mposY) -- sets monitor cursor back to default position
- if bingPlayed % 15 == 0 then -- Every 15 bings it will print the current bingNum
- print("The current amount of bings you are hearing is", bingNum)
- end
- bingPlayed = bingPlayed + 1
- wait(time)
- end
- bingPlayed = 1
- print("The number of bings you just heard is:", bingNum)
- print("The total number of bings played is:", bingTotal)
- if bingNum % 10 == 0 then -- writes log file every 10 steps
- t = os.date("!*t")
- local f, err = fs.open("User/Cloud/bing/Log/log", "a")
- if err then
- error(err, 0)
- end
- f.write(t.hour .. ":" .. t.min .. ":" .. t.sec .. " " .. bingNum .. " reached \n")
- f.write("The total number of bings so far is " .. bingTotal .. " \n")
- f.close()
- print("log updated")
- end
- wait(6)
- bingNum = bingNum + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement