17 posts
Posted 07 June 2014 - 01:04 PM
Music in Minecraft with ComputerCraft!?
It would be fantastic if computers could eventually play music files (ie MP3's) or some other format! The files could be placed in a .minecraft/music file or .minecraft/[insert world name here]/computer/music file.
It could use the 'music' api with features such as:
music.play([songname.mp3], [Volume 1-10]) - Plays a certain track at volume [1-10]
music.pause() - Pauses the track playing
music.stop() - Stops all tracks playing and returns seek back to 0 seconds
music.seek([insert seek time here]) - Seeks to the entered time in the track (in seconds)
music.getCurrentPos() - Gets the current position of the track playing seek (in seconds)
music.getTotalTime([songname.mp3]) - Gets the total time of the track (in seconds)
I know this will be hard as minecraft can only support .ogg at this time however even if it worked with .ogg that would be amazing! As you moved away from the computer/turtle playing the music, it would get fainter maybe) there could be a peripheral that is the speaker that goes on the side (like a modem)
Anyway this would be amazing if it were added and it could be used in adventure games or other things a lot more! :)/>
(PS: Lets hope Dan reads this and could maybe add this!)
1426 posts
Location
Does anyone put something serious here?
Posted 07 June 2014 - 01:10 PM
Could you just not implement this in Lua. You could write a MP3 parser and then use note blocks to play the tune.
Edit: Ok MP3 would be quite hard to then convert to notation but maybe MIDI?
Why is there no Note block peripheral API though or am I missing it?
Edited on 07 June 2014 - 06:22 PM
570 posts
Posted 07 June 2014 - 08:59 PM
The biggest problem with this is that the music has to be sent to the clients in multiplayer. We don't know when to send it, since anyone could play audio at any given time. If it were possible, it should be generalised and play sounds instead.
1029 posts
Location
Missouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension
Posted 08 June 2014 - 03:57 AM
This has been asked quite a lot, and always turned down. There are many programs to read MIDIs and peripherals to interface with note blocks.
I can see why you're suggesting it. I do agree with the idea to be able to interface with note blocks without 3rd party peripherals.
724 posts
Posted 08 June 2014 - 10:27 AM
Music is to much to transfer, so your best hopes are:
1.Radio, listening inet for sound data.
2.Player to play preinstalled (or written down and finalized) disks.
3.MIDI (or CC_MIDI) to be played on some Noteblocks.
7083 posts
Location
Tasmania (AU)
Posted 08 June 2014 - 10:51 AM
Were I to be implementing such a thing, it'd be a "stereo" block which streams online radio through the player's client. Wouldn't have to be anything to do with ComputerCraft at all (though it'd be handy to be able to use it as a peripheral, to eg control the stream address and turn it off/on etc), plus the audio wouldn't have to be handled by the MineCraft server nor specifically installed into the client.
724 posts
Posted 08 June 2014 - 11:14 AM
Exactly. Except "stereo" could be problematic in MC. And some audio can be preinstalled with mod.
Let's hope IChun would evolve his Portal Gun mod Radio in such a maner.
Also some other things from that great mod would be god to upgrade as a peripherals. (I have cool ideas for that).
Edited on 08 June 2014 - 09:17 AM
3790 posts
Location
Lincoln, Nebraska
Posted 09 June 2014 - 08:04 PM
Check out OpenBlocks. It has a streaming radio that you can use, and you can even specify what streams you can listen to.
I don't think this is going to be implemented in CC because it takes a lot to stream just internet radio as it is, and to stream it to any clients within range? Lots of overhead.
120 posts
Posted 10 June 2014 - 01:12 AM
If you go with CCMIDI then the files should look like:
N1 N2
N1 N2
N1 N2
Person: But I want it to be more understandable! And I want a delay!
Setup:
ORCRT
O = note block on note 1
T = note block on note 2
R = redstone
C = computer
Code:
--For people that want to have delays
print("Test!")
--Yay! Coroutines rock!
function c1()
rs.setOutput("left", true)
sleep(1)
rs.setOutput("left", false)
end
function c2()
rs.setOutput("right", true)
sleep(1)
rs.setOutput("right", false)
end
local o = 3
coroutine.create(c1)
coroutine.create(c2)
while o > 0 do
coroutine.resume(c1)
coroutine.resume(c2)
end
NOTE: You can put more then 6, but it involves more coroutines, and some Rednet.
And the setup for 9:
N
R
NRCW
R
N
Bottom:
RN
And then PC 2 would have the other 4, then PC 3 with 1.
It would take 9 coroutines, and 5 would use rednet..
And you would need to put a program on each computer..
Edited on 09 June 2014 - 11:29 PM
7508 posts
Location
Australia
Posted 10 June 2014 - 01:14 AM
Code:
--For people that want to have delays
print("Test!")
--Yay! Coroutines rock!
function c1()
rs.setOutput("left", true)
sleep(1)
rs.setOutput("left", false)
end
function c2()
rs.setOutput("right", true)
sleep(1)
rs.setOutput("right", false)
end
local o = 3
coroutine.create(c1)
coroutine.create(c2)
while o > 0 do
coroutine.resume(c1)
coroutine.resume(c2)
end
*sigh* that's not how to do coroutines. just use the parallel api.
18 posts
Location
Norway
Posted 15 June 2014 - 12:04 PM
Why make an Api when you can play it with command blocks? (For they who don't know how yet, I found this:
http://youtu.be/8jXLhhiaKWQ).
78 posts
Posted 15 June 2014 - 12:17 PM
17 posts
Posted 25 July 2014 - 09:38 PM
Music is to much to transfer, so your best hopes are:
1.Radio, listening inet for sound data.
2.Player to play preinstalled (or written down and finalized) disks.
3.MIDI (or CC_MIDI) to be played on some Noteblocks.
Maybe then it could connect to the internet and provide internet radio? Could be an idea….
(Sorry for late reply on this topic!)
Were I to be implementing such a thing, it'd be a "stereo" block which streams online radio through the player's client. Wouldn't have to be anything to do with ComputerCraft at all (though it'd be handy to be able to use it as a peripheral, to eg control the stream address and turn it off/on etc), plus the audio wouldn't have to be handled by the MineCraft server nor specifically installed into the client.
Would be pretty cool to have that! However I am guessing it would probably reduce connection to the server (ping) as you are streaming radio at the same time?
(Sorry for late reply on this topic!) I had a look at that and couldn't get it working, if you can tell me how to use it that would be great!
It installed correctly and then whenever I try to use the api, it just wouldn't work!
7083 posts
Location
Tasmania (AU)
Posted 26 July 2014 - 12:44 AM
Would be pretty cool to have that! However I am guessing it would probably reduce connection to the server (ping) as you are streaming radio at the same time?
Depends on the bandwidth available to your client's connection. So long as that's not being flooded, latency shouldn't be an issue.
1 posts
Posted 27 July 2014 - 12:14 PM
What do you think of XM file format? The format of Fast Tracker, and the keygen music? :D/>
Its small, doesn't require big bandwidth. It fits for the command line interface :)/>
Or maybe midi or something like this? :)/>
https://en.wikipedia.org/wiki/XM_(file_format) https://en.wikipedia.org/wiki/FastTracker_2
38 posts
Posted 29 July 2014 - 08:11 AM
I had a look at that and couldn't get it working, if you can tell me how to use it that would be great!
It installed correctly and then whenever I try to use the api, it just wouldn't work!
Do you have OpenPeripheral installed? If yes, that would be a bug (which is fixed in 1.7 as I rewrote all the CC compatibility stuff).
Edited on 29 July 2014 - 06:11 AM