News for hackers. Stuff that matters.
Re:Ask HN: ideas for little projects you have? by chaosmachine on Monday September 28, 2009 @03:59PM (#849100)
Write a program to convert torrent files into midi files. They should be normal midi files that will play music, but can be run through midi2torrent to get your original torrent back.

The idea being that you now have unique pieces of music you can host anywhere, rather than scary torrent files.

PS: If anyone does this, let me know :)

Re:Ask HN: ideas for little projects you have? by zeckalpha on Monday September 28, 2009 @04:19PM (#849145)
To clarify, the .torrent, not the file that is found by feeding the .torrent into a client. Correct?

One could simply change the extension.

Re:Ask HN: ideas for little projects you have? by chaosmachine on Monday September 28, 2009 @04:34PM (#849181)
Changing the extension is too easy.

The .torrent file should be converted into an actual midi file, with correct headers, etc. It should actually play when you open it with quicktime or windows media player.

When converted, the result should be a unique piece of music. Perhaps something that could be considered "art", and protected by free speech laws.

Imagine printing out the score and having an orchestra perform the torrent file!

The key, though, is that you can also convert the midi back into a usable torrent.

Re:Ask HN: ideas for little projects you have? by mr_dbr on Monday October 05, 2009 @07:48PM (#863135)
I present to you, Ubuntu in D Minor:

http://www.mediafire.com/?sharekey=bc9a7de093071754ed24a2875...

...it's not actually in D Minor, but it's certainly Ubuntu (ubuntu-9.04-desktop-i386.iso.torrent, converted to a proper, listenable MIDI file)

Only done the encoding just now.. Basically the code loops over each byte in the file, ord()'s it, creates a note with that value and advances to the next beat.. Decoding should be simple enough, but the simple MIDI library I was using only creates MIDI files.

One slight problem is the file is about 5-6 hours long, so I don't think we'll be sharing torrents via background music on Youtube videos quite yet.. A more time-efficient way to pack the bytes into notes is definitely possible (currently it only plays one note per time-slot), but that would have taken far longer than I wanted to spend on this...

The Python code, including the required smidi.py module: http://gist.github.com/202593