- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
ManIkWeet
-
Content Count
8 -
Joined
-
Last visited
Posts posted by ManIkWeet
-
-
19 hours ago, BrisingrAerowing said:
I've noticed the autorun system is kind of finicky, another way (that may work better) is to use the RC system and make a daemon / service program. There's a few examples on the forums here.
Seems to work, but documentation is terrible... Spent 30 minutes figuring out what to place in rc.cfg
Thank you
-
I wrote a program that basically needs to read/write a file and trigger one of 9 note blocks, this file is managed externally.
Because of the 9 note blocks I am running out of component space. The perfect solution to this would be to boot my program without a screen (it doesn't need a screen to function).
I tried booting OpenOS without a GPU/Screen, but it seems to freeze at some point and OpenOS will not run any programs I've configured to autorun.
Preferably I'd like a minimal setup, which only loads what I need and runs without a GPU/Screen, I have the following requires in my program:
require("serialization") require("component") require("filesystem") require("shell") require("event")
Which I guess is basically the complete OpenOS suite...
So simple question: how to boot without a GPU/Screen and run my program?
-
I made a step sequencer as my first project for OC, I ran into this problem too.
My solution as yet unmade was to have multiple computers each with a copy of the 'score'waiting for a midi tick from a server.
My code is still in the showcase if you'd like to take a look.
Multiple computers would be a solution, but it is not exactly a very eco-friendly (aka survival) solution, sadly I think I have to give up on this project...
-
you couldn't have been using those programs for that video tho
[ as my example requires you to press "p" to make a note play ]
but that's by-the-by... i'm guessing you used a simpler thing, it's obvious that there is a lag there, perhaps it's to do with how the adapter works.
did you try my suggestion of using Computronics' iron note block? as i say - that seemed to work perfectly for me [ in 1.7.10 ]
i.e. i'm using
play = component.iron_noteblock.playNote majorTriad = function(root) play(root) play(root+4) play(root+7) end minorTriad = function(root) play(root) play(root+3) play(root+7) end majorTriad(1) os.sleep(0.25) minorTriad(3)
.. which does it perfectly
But vanilla noteblocks are so much cooler
Thanks on the heads up of the memory leak btw.
-
p.s. this has really made me want to do more music in MC - thanks for the inspiration!
I have made a small video displaying the issue I have:
I have used the following programs:
ComputerCraft:
sleep(2) local note1 = peripheral.wrap("left") local note2 = peripheral.wrap("right") function play1() note1.triggerNote() end function play2() note2.triggerNote() end c1 = coroutine.create(play1) c2 = coroutine.create(play2) coroutine.resume(c1) coroutine.resume(c2)
OpenComputers:
local component = require("component") local keyboard = require("keyboard") local computer = require("computer") local event = require("event") local mbs = {} for k,v in pairs(component.list()) do if v == "musicblock" then table.insert(mbs,component.proxy(k)) end end t1 = function() local note = 1 while true do --local note = 1 mbs[1].trigger( note ) note = ( note + 1 ) % 24 + 1 coroutine.yield() end end t2 = function() local note = 1 while true do --local note = 4 mbs[2].trigger( note ) note = ( note + 1 ) % 24 + 1 coroutine.yield() end end c1 = coroutine.create( t1 ) c2 = coroutine.create( t2 ) play = function() os.sleep(2) --while true do --if keyboard.isKeyDown(keyboard.keys.p) then --for i=1, 10 do coroutine.resume(c1) coroutine.resume(c2) --end --end --event.pull() --end end play()
So clearly there's a difference between how ComputerCraft handles noteblocks and how OpenComputers handles noteblocks...
Still looking for the solution for OpenComputers
Also, you're welcome for the inspiration
-
The solution that you propose doesn't fire the 2 noteblocks at once, there still is a slight delay between them...
Sadly OpenPeripherals (the mod to get Noteblocks to CC) doesn't work in 1.7.10 yet, so I have to downgrade to this horrible 1.6.4 that noone likes to demonstrate... will do that in a little while when I got more time...
If you fire the 2 noteblocks with a redstone signal, you hear a single sound, I want to replace the redstone with the computer...
Here's your code in a more readable and fixed matter:
local component = require("component") local keyboard = require("keyboard") local computer = require("computer") local event = require("event") local mbs = {} for k,v in pairs(component.list()) do if v == "musicblock" then table.insert(mbs,component.proxy(k)) end end t1 = function() local note = 1 while true do --local note = 1 mbs[1].trigger( note ) note = ( note + 1 ) % 24 + 1 coroutine.yield() end end t2 = function() local note = 4 while true do --local note = 4 mbs[2].trigger( note ) note = ( note + 1 ) % 24 + 1 coroutine.yield() end end c1 = coroutine.create( t1 ) c2 = coroutine.create( t2 ) play = function() while true do if keyboard.isKeyDown(keyboard.keys.p) then --for i=1, 10 do coroutine.resume(c1) coroutine.resume(c2) --end end event.pull() end end play()
-
Hi,
I am new to OC, coming from CC and I want to make my music player in OC...
The issue I had with CC was that it was not possible to play multiple notes at the same time, but this was fixed with the information here:
Now the 2 solutions available for CC don't seem to be available in CC so I tried around a bit with events... Didn't work as intended and even got a crashing computer out of it...
Here's my code:
local component = require("component") local counter = 1 local noteblocks = {} for address, componentType in component.list("music") do print(tostring(address) .. "," .. componentType) noteblocks[counter] = component.proxy(address) counter = counter + 1; end for _,nb in pairs(noteblocks) do nb.trigger(10) end local computer = require("computer") local event = require("event") function trigger() component.musicblock.trigger(15) end event.listen("note", trigger) for i=1, 10 do computer.pushSignal("note") end event.pull() print("finish")
To replicate my issue, just place an adapter anywhere with one or more noteblocks connected to it.
If you run the program you'll hear a clear delay between each note, music will need multiple notes at once...
Preferably I want multiple notes to play instantly out of one single noteblock, but if that's impossible then I guess multiple will have to do...
As for the memory leak:
Running this part of the code
local computer = require("computer") local event = require("event") function trigger() component.musicblock.trigger(15) end event.listen("note", trigger) for i=1, 10 do computer.pushSignal("note") end event.pull()
Multiple times it will:
1. keep playing more and more notes at the end.
2. eventually crash, saying it ran out of memory.
ShEdit - edit.lua, but with syntax highlighting
in Programs
Posted
This is pretty amazing!
Surely all the colors mean the GPU has a tough life, but this is 200% better than the default editor
I actually like it showing tabs as special characters, allows me to manually get rid of them