Archive for August, 2008

Yumeko BPMFinder - My very own human-assisted BPM analyzer written in JavaScript!

Saturday, August 16th, 2008 by Agro Rachmatullah

Yumeko BPMFinder

On a previous post I discussed about the results of a Windows BPM finder program MixMeister BPM Analyzer. It sometimes produces values that are 2 times or half the seemingly actual value. And then the doubt grew on me, “Is that program even accurate at all?”. So, I was set to program my own BPM finder.

But I don’t know any sound programming stuffs, so I went for the easy path of a human-assisted program in which the algorithm is very intuitive. A human would tap the beats while playing a song and the program will do the simple mathematical calculation (it’s “beats per minute” for a thing, so it’s basically just a division).

(more…)

Japanese piano chord collection site

Friday, August 15th, 2008 by Agro Rachmatullah

Japanese piano chord site

I was looking for information about the chord F#m7-5. I know the basics of intervals already, so I just need someone to tell me what this chord type is (e.g. major triad, dominant seventh) and the components of this seemingly-bizarrely chord (e.g. root, major third, and perfect fifth for a major chord).

A cursory browsing around Wikipedia’s music theory articles didn’t bear any fruit. I actually expected it to be in the chord articles which has a handy list of chord symbols/notations with their components.

And then I found this Complete Chords site which has chords for guitars and piano. But to see it we must download a hefty 20+ MB pdf file! The file probably has chord diagrams for C, C#, D, D#, etc. I don’t need that bloat! If I know what Cm7-5 is, I can get the others (just shift all the notes to the left or right by the same amount, though in guitar finding a convenient configuration by oneself might be quite challenging).

And finally, accidentally, by Googling with “only Japanese pages” currently set, I found a convenient Japanese site which provides just the info I need! Go visit the site (shoshinsha, which means beginner). It shows the piano keys which needs to be pressed for a certain chord, some with its inverted chords. Just regard the kanji and stuffs as a beautiful graffiti. With the chord sidebar on the left and the image, you can easily get the chord you need.

So, when you find yourself asking “how do I play this chord?”, you know there’s a handy reference around. I’ve downloaded all the chords with C as its root, which will be a convenient chord cheat sheet.

Btw, it turned out that F#m7-5 is just F#m7 with the perfect fifth component replaced by a diminished fifth. Now I know that the -5 part means “diminished fifth”. So in other words it is an F#dim chord (diminished chord) with the added minor seventh component.

Analyze the BPM of your MP3 files

Thursday, August 14th, 2008 by Agro Rachmatullah

mixmeister bpm analyzer
MixMeister BPM Analyzer - analyzing DOES take time

The BPM (Beats per Minute) of a song can be stored as an ID3 tag on your MP3 files. In essence, the BPM is the tempo of a song which indicates how fast or slow a song is.

Programs like iTunes can display the stored BPM number and utilize it. If your song collection has BPM value, you can for example make a playlist for the fast songs and another for the slow songs. The fast songs can then be copied to your MP3 player for your gym activity, for example.

The problem now is that this value is initially empty. We can even insert a random number on programs that supports MP3 metadata editing. Luckily, there are programs that analyze BPM and store the computed value on the files. One such program is MixMeister BPM Analyzer which is free to download. Using this freeware is very easy, you just need to drag and drop the files or folders you want to analyze. It’s computationally quite heavy so if you have tons of files be prepared for a long wait.

(I wonder whether there is an open-source program for this purpose)

Abe Natsumi\'s 22sai no Watashi with BPM value in iTunes
The result in iTunes after the BPM is analyzed

I tried searching for such programs because I wanted to know the BPM of songs I want to try playing on the keyboard. The calculation output is quite interesting. For most files, the program seems to be accurate. However, for some files the software computes a BPM which is actually 2x faster than the seemingly real value or else half of it. For example, the program gives 82.42 BPM for a song (Berryz Koubou’s “Gag 100kaibun Aishite Kudasai“) despite it being a fast one, so the double value 163.84 BPM seems to suit more. There’s also a slow song (Morning Musume Sakura Gumi’s “Sakura Mankai“) which is given 160.03 BPM, but clearly 80.015 BPM is closer to the real answer.

But theoretically, a musical score written in x BPM can be easily rewritten in 2x BPM or 0.5x BPM. We just need to double or halve every note’s duration. Of course, by this modification a note might be moved to another measure. In a sense the program is correct.

What kind of baffles me is that I can probably sense the beat of a music intuitively, but I wonder how one makes an algorithm that can find BPM. Ah, sound processing, an area where I have practically null experience.

Low-quality free speakers

Monday, August 11th, 2008 by Agro Rachmatullah

Low quality speakers

Pictured above are speakers you get for free when you buy a non-branded computer at computer shops. It has “QC. PASS” stickers on the back side and the writing “DS-693 MULTI-MEDIA SPEAKER SYSTEM” on the front side.

The quality? Well, it sounds WORSE that my laptop’s built in speakers. The quality check pass stickers apparently mean “at least it made a sound”. I would very much prefer my headphone.

The progress on computer go - pro player defeated at 9-stone handicap

Sunday, August 10th, 2008 by Agro Rachmatullah

Go is a board game with very simple and elegant rules, but with a mathematical complexity far far above chess. It is a game with lots of pattern recognition involved, so a skilled human player is particularly good at intuitively making judgments just by glancing a position.

We all know how Gary Kasparov was beaten by Deep Blue some time ago, so in essence computers now can play better chess than human. Go, with its enormous computational complexity, is regarded by many as the last bastion to defend human intelligence in strategy games.

Around 5 years ago, the best computer program can still be defeated by a professional even with a 25 stone handicap (e.g., getting free 25 moves at the start of the game). Now it plays much much better, and at the recent U.S. Go Congress (7 August 2008) a supercomputer beat a professional player at 9 stone handicap. Here’s the details of the match:

(more…)

Yumeko AdManager 0.0.1

Friday, August 8th, 2008 by Agro Rachmatullah

After a day’s worth of PHP hacking coupled with some swearing, I’ve finally finished a rudimentary ad manager! What does it do? Well, basically it rotates through a pool of ads. A life demo can be seen here. Refresh the demo page several times and see the ads magically rotating.

It’s called Yumeko AdManager because… Well, probably because it will be used on my Japanese learning site Yumeko. Because Google AdSense still don’t allow us to use it on Indonesian web sites.

This program is licensed under GPL 2 and you can download it here (there’s a documentation, yay!). I even made a special page for it here in case I’m inclined to update it.

Here are some of its features:

  • Relative appearance rate of ads can be set
  • Tracks appearance count
  • Tracks click count
  • Expiry date for ads can (uhm… must) be set

What’s obviously lacking is an interface to add and manage ads. Yes, you need to play around using tools such as PHPMyAdmin to add the database rows. But anyway it’s all explained in the documentation :).

Other than PHP, I’m also interested in learning more about this black horse JavaScript to make… ah, let’s call it “interactive programs”. But alas, there’s only so much hours in a day…

Morning Musume/Hello! Project song chord

Wednesday, August 6th, 2008 by Agro Rachmatullah

I ripped this quite a long time ago from a Japanese song chord site. Not as easy as saving the pages, since the pages has a nasty Javascript that makes the page displays nothing when viewed from the disk. I had to make a program that extracts the contents out of it.

So there, you can have your guitar chord/piano chord/whatever of the H!P songs. Included artists are Momusu, Berryz Koubou, Matsuura Aya, Abe Natsumi, Fujimoto Miki, Goto Maki, Iida Kaori, Melon Kinenbi, Mini Moni, Nakazawa Yuko, Pucchi Moni, Tanpopo, v-u-den, and W. Download here.

HTTP redirection using PHP fails when you use UTF-8 encoding

Tuesday, August 5th, 2008 by Agro Rachmatullah

To redirect a page by putting the instruction on the HTTP header, PHP makes it very easy:

<?php
header("Location: http://www.agronesia.net");
?>

The catch to call header successfully is that you must not output anything beforehand. So, no space before the opening PHP tag. Also no calls to print or echo beforehand. Else you will get an error message like this:

Warning: Cannot modify header information - headers already sent by (output started at H:\xampp\htdocs\bla\test2.php:1) in H:\xampp\htdocs\bla\test2.php on line 2

That also means you cannot have a UTF-8 encoded document. That’s because UTF-8 text files output this BOM thing at the start of the file. Oh, and if you use include, the included files also cannot have any funky BOM stuffs.

You guessed it right. I got tripped by this problem. Because I often type Japanese, I set Notepad++ to use UTF-8 as its default encoding. @#^#&%$@*!!!

PHP variable naming sucks

Tuesday, August 5th, 2008 by Agro Rachmatullah

PHP is a language that deserves curse. For variable names, we always have to use the $ sign. The purpose is of course to add one more thing a programmer can forget. And when you do forget, PHP treats the misnamed variable as a string which in my case causes the script to run but wrongly.

Here’s the golden bug on my script:

$mysql_db = "some_db_name";
mysql_select_db(mysql_db);

No wonder my carefully crafted INSERT query didn’t have any effect…

Google Pinyin: A Chinese Input Method Editor (IME) for Windows

Tuesday, August 5th, 2008 by Agro Rachmatullah

Google Pinyin, a Chinese IME

No, I don’t know stuffs about Chinese. Probably except the first two newbie lessons on ChinesePod. What interests me most about Chinese is how its hanzi sound map to Japanese kanji’s, how many characters used in Chinese are alien in Japanese, and how simplification makes the character between traditional and simplified Chinese awfully different.

I was reading about the romanization of Chinese today when I found the link for Google Pinyin, a Chinese IME. Before, when I need to access a Chinese hanzi I would draw it using Microsoft Japanese IME’s handwriting recognition. Of course many of the simplified characters like 吗 isn’t available there. The solution is to write the traditional characters like 嗎 and get the simplified equivalent through the dictionary program Wakan. Clumsy I know. That’s why when I read about Google Pinyin I thought “Let’s try a Chinese IME for the sake of it”. The fact that Google makes an IME also interested me much.

First of all, why the need for Google Pinyin at all? Well, because Microsoft’s built in Chinese IME sucks? Probably. I’ve tried both (very shallowly!) and I can say that the Google one seems to be more fun and easy to use.

To use it, just go to its website, download the program, and install it. The link is 下载 which in Japan would be read as kasai but I won’t even guess how it sounds in Chinese. Then you need to install Microsoft’s Chinese IME from the Control Panel. After that just switch to Chinese from the language bar. The default will be Google Pinyin but you can switch to Windows XP’s IME using Ctrl+Shift.

Thanks for reading. 我叫アグロ。我很好。我爱你。你呢?谢谢。谢谢谢谢谢谢谢谢谢谢谢谢谢谢。(笑)