Tagged as: Software

Convert MIDI Music to MP3
January 22, 2009 by Noah
Numerous years ago I was trying to find a way of converting MIDI files into WAV or MP3. I tried googling for "midi to wav" but found nothing useful. After going through 10 or 20 pages of search results I gave up. All there was out there were lame commercial products that were way more expensive than they're worth.

(On that note, I'm working on researching stuff for a long article I wanna write concerning the sad state of Windows software and the philosophy behind it).

This is one of many cases where after getting into Linux and the open source world, I discovered some free/open source software that does things that I've always wanted to do. In this case, I discovered TiMidity, a MIDI to WAV converter.

TiMidity is used in Linux for support for the MIDI audio format. Rather than have actual hardware drivers to deal with MIDI directly (like Windows does), TiMidity just converts it into WAV format on-the-fly and sends it straight off to your audio hardware. This is its default behavior, anyway. Last night I was digging through its manpages and found out how to save the output as a WAV file instead of sending it directly to the speakers.

Thus, I finally was able to convert MIDI audio to WAV. For reference here's how to do it:

$ timidity -Ow -o output.wav input.mid

WAV files are big and bulky though, so that's where LAME comes in handy. Instead of saving the output to a file, we can pipe it into LAME and save it as an MP3 on the other side.

Thus, here's a one-liner for converting any MIDI file to an MP3:

$ timidity -Ow -o - input.mid | lame - output.mp3

There are Windows ports of these programs available too.

Tags: 3 comments | Permalink
December 26, 2008 by Noah
I've completed a beta version of my Java CyanChat package. It doesn't have a page yet on this site because now that I'm mixing Perl and Java projects together, I'm thinking of redesigning the software pages to indicate what programming language was used. That aspect of this site needs a bit of restructuring.

For now you can download it, or browse the source code and Javadocs, at /projects/Java/.

Tags: 0 comments | Permalink
December 17, 2008 by Noah
Recently I got the bright idea to just sit down and put some time into learning how to program in Java. Why? My ultimate goal in which programming language I wanna figure out is C++, but every time I try that, it gives me a new reason to hate it (for instance, I wrote some code in Dev-C++ 4 which compiled and executed, but would not compile in Dev-C++ 5 anymore). Also, Java is under the GNU General Public License now, it runs the same on multiple platforms without much thought (like Perl), and it's less picky than C++ (and is therefore a good stepping stone along my journey to finally tackling C++).

I started with Sun's tutorials, beginning with basic command-line apps to get the syntax down, then moving into the GUI tutorials with Swing. I'm not putting high priority on learning Java applet programming right at the moment, because nobody likes Java applets anymore.

And so now I'm at the point where I'm attempting to program my own things from scratch. A logical place to start was to create a Java class for the CyanChat protocol. The goal of it is to match the functionality of Net::CyanChat, and then one day I might even program a "Java CyanChat Client", to complement my current Perl CyanChat Client (and by Java CC Client, I don't mean an applet; the standard CyanChat client is an applet -- I mean a GUI application).

My CyanChat package is named for right now. Eventually I intend to program a RiveScript interpreter in Java, to open the door up to Java developers to get into the world of RiveScript (and because the only RiveScript interpreter currently in existence is written in Perl). Then, one of my goals in C++ is to compile a "RiveScript.dll" file, which can be dynamically linked with C/C++ programs or any other language that can dynamically link a DLL. :)

Since I'm serious about Java development, I made a nice lil avatar for Java-related blog posts, and spent more than 5 minutes creating it too.

Tags: 0 comments | Permalink
Random thought about forum spam bots
December 6, 2008 by Noah
In some cases, I don't think all spam bots post on web forums to actually get people on the forum to click the links. This is evidenced by the bot posting what looks like a large article of text about something random in the world, which is just sprinkled with completely random out-of-place links to sites that sell World of Warcraft gold or some such. Maybe the programmers behind these bots don't really think that members of the forum they just spammed are seriously going to click the links...

Maybe they just want the links to be there for Google to see... to improve the page rank of their scam site so that it comes up higher in Google search results. They just want links from the forums they spam, not necessarily clicks.

Thus an interesting idea for web forum software: add a kind of restriction on link posting. Like how some forums require that you post 10 things that aren't spam before you're allowed to send private messages to other users, or other such arbitrary restrictions... what would be useful is one that goes: you can post links immediately after signing up, but every link you post will have rel="nofollow" attached to it, so that Google and other search spiders won't follow your link, and you won't get Pagerank credit for it. And then after posting enough on the forum, all your previous links and all future links will be linkable for search engines then.

Spam bots always seem to find ways to register and spam forums, but taking away their ability to get any Pagerank credit for their spamming would help fight back just a little bit.

/random thought of the day/

Tags: 1 comment | Permalink
Web Development -- A Skill
November 23, 2008 by Noah
I have a major pet peeve about awful program code. Code that's terribly written, has terrible logic, or is just really messy. I can't stand having to read it, or worse, write it (like when changing the code style would totally break stuff).

Right now, my page doesn't validate as HTML 4.01 Strict, because <script> tags aren't allowed to have a id attribute. What script tag has the ID attribute? The one to display the countdown until Fedora 10's release. If I remove the ID attribute, the script breaks. Nonetheless I'm going to keep it there only for the next three days until Fedora 10 finally arrives, then it's history and next time I want to count down until Fedora 11, I'll find my own implementation instead of pasting their awful HTML code into my otherwise perfect pages.

I've ranted about pasting external code into my site before, so I'll spare you any continued rambling for now. Sometime when I'm more motivated I might follow up on this rant with a sequel.

The moral of the story is, don't give me any code to paste anywhere in anything I have unless the code is completely valid and passes all validation tests (for HTML, that means it passes HTML 4.01 Strict standards).

Speaking of which, I wanted to say a little something about web development. Why have a degree in web design?, some people ask. Any 12-year-old can open Notepad and create a web page. I agree -- and I was that 12-year-old at one point in my life. What separates the men from the boys is the ability to create a web page that validates against the W3C's strictest standards. Yeah, any little kid can throw together a mess of HTML tags and get something out of it. They might even be lucky enough that their page works on every browser. But I've heard enough crying and complaining about how the W3C doesn't validate their page, how they get errors in the triple digits or worse whenever they try to validate their code.

So that's why web development is a skill and not a hobby. With the exception of the Fedora banner (which I highly regret embedding), all my pages on this site and every other site I develop, they all validate HTML 4.01 Strict. Not Transitional -- Strict. That means the W3C doesn't take any shit from my pages whatsoever. And that, my critics, is what sets me apart from the 12-year-olds with Notepad.

Tags: 0 comments | Permalink
Text-Based CyanChat Client
October 24, 2008 by Noah
I was looking at my CPAN directory the other day and noticed that my CyanChat modules were poorly documented, to the point where if I was somebody else and didn't know about Kirsle's Perl CyanChat Client, I'd have no example code to reference to figure out how to use these modules.

So, I've decided to update the modules and add some better examples in its documentation. I also thought it would be nice to include a demonstration program for a CyanChat client. The distribution already comes with a sample server script, but none for a client. I didn't wanna include a bot though, because then CyanChat would have these bots entering the room from people testing the demo script, and nobody likes bots. And then, PCCC is a heavy program to include as an example script. So, I decided to make a new CyanChat client that would be light enough to work.

So, I've created a text-based CyanChat client:
Terminal CyanChat Client

The script is mostly standalone: just one Perl script that uses Net::CyanChat. And also Term::ReadKey, which is easy to install. It doesn't use Curses or any other terminal GUI toolkit: it's all plain old text and ANSI colors. I built in my own kind of buffer system, and any time the chat dialog (or typed message prompt) changes, the window is cleared and redrawn from top to bottom, keeping track of how many characters and lines are being written so that it cuts off the buffer directly at the bottom of your terminal. And it works no matter what your terminal's dimensions are.

More screenshots:

The main menu screen, changing the CC host back to using port 1812 (I used 1813 as the default port number for development purposes).

The CyanChat client in full operation.

Update: It works on Windows too (to much amazement as the command prompt completely sucks):

Win32 Console

Tags: 2 comments | Permalink
Favicon Generator
October 15, 2008 by Noah
Dynamic Drive has one, and now I do too: a Favicon Generator. It's a lil CGI application that takes an uploaded image and converts it into a Win32 icon file, specifically the 16x16 resolution variety that are used as favorites icons for websites.

Dynamic Drive's was cool and I've been using it thus far to generate all my favicon files (and some regular icons for use in some of my software like PCCC and ErrorGen), but my generator 1up's that by also being able to include 96x96 resolution icons (Windows Vista size).

To those curious, I mainly used the Perl modules GD and Imager to manipulate the uploaded image and save it as a Win32 icon. I won't give out the code behind my favicon.cgi though because it's really not that hard to figure out just from the manpages of the Imager module (see Imager::File::ICO).

Tags: 0 comments | Permalink
New Terminal Utilities Uploaded
October 6, 2008 by Noah
I've uploaded a couple of new terminal utilities that some people might find useful.

sayto is a wall-like program I wrote at work which acts like wall but only broadcasts the message to a single user (instead of to every user), and takes care not to broadcast to any terminals that are running VIM, or any other process besides plain old bash (or other shells).

kbackupd is a backup daemon script I wrote for my web server. Others might find it useful so I've provided it for download.

Check them out on the Terminal Utilities page.

Tags: 0 comments | Permalink
September 18, 2008 by Noah
Since there was enough interest in my two-year-old program, ErrorGen, I've created a Perl/Tk module that does basically what ErrorGen does.

Here's a screenshot:

It's only a module so far that can be included in other Perl/Tk applications. But it's one very large step closer to me creating a simplified tool to spawn error boxes which could be provoked from batch files or scripts. It will probably have a syntax similar to the GNOME program, Zenity.

CPAN takes a few hours to index module updates but the new module will be available at Tk::StyleDialog on

UPDATE: I've thrown together a quick program called ZenMsg (a name derived from GNOME's Zenity, but since my program only does dialog boxes, it's called ZenMsg).

I've added it as a new tab to the ErrorGen page. Let me know if it can be improved. I had to use ActiveState PerlApp to compile it because PAR::Packer (which I usually prefer to use) was giving me trouble and I didn't have the time or motivation to setup a clean new compiling environment for it. PerlApp may be a bit too limiting.

Tags: 0 comments | Permalink
Software Tabs
August 11, 2008 by Noah
All there is to report is that a few bugs in the software pages (specifically, the ones that use the new tabbed system) have been fixed. On Windows + Internet Explorer, clicking a tab would unfocus the IE window (bringing whatever window is next on your Alt+Tab list to the front of your screen, but keeping IE as the active window, so you had to click off the IE window and back onto it to see the page again).

It turned out I was calling a blur() method on a variable that wasn't actually there, so on Windows IE it defaulted to the browser window. The intention was to remove focus on the hyperlink so that the dotted border wouldn't remain when clicking the tab.

Also, a small tweak in the style sheet means that the tab borders don't intersect through the top of the selected page.

Tags: 0 comments | Permalink