Montag, 27. Februar 2012

LFT Tracker Howto

Hi folks!

This time I'm back fulfilling a request by therobomaker957 on how to use lft's chiptune tracker to compose a chiptune and run the tune on an Arduino.
Well, at first, you should grab every piece of code and script from my earlier post. Then, you have to compile the tracker. Assuming you run Ubuntu oder Debian, you'll need build-essential and libsdl for this. Currently, I see no way to rund the tracker in Windows. Perhaps it'll work with cygwin, but it certainly doesn't work with a VirtualBox image of Ubuntu. I tried that before and got no sound out of it.
But before you run the tracker, I think it's time for some overview of creating music using with this concept from the early days of computer music. As the name hints at, you arrange your tune by placing key-ons and key-offs (a bit like MIDI) into several tracks. Within lft's environment, you can have four tracks in parallel, meaning you can play up to four different instruments at the same time - or the same instrument four times, e.g. to play a chord.
You can put your key-ons (key strokes) into a column of 32 rows, making one track. So if you wanted to play a beat at quarter notes for example, you'd put a note at every fourth line, leaving the rest blank (---). You can use the keyboard to enter different pitches like this (switch octaves with < and >):



This is actually the same as in FastTracker II oder MadTracker, if you've ever worked with these before.
Now, when you run the tracker (don't forget to specify a song file!), you'll see something like this:

On the right, there's the instrument editor (for an explanation of the various commands and key bindings, see lft's tracker readme file in the source zip). In the middle, you can edit the current track (0-128). On the left, you can arrange the different tracks you created into a song. Just enter the number of a track in every of the four different song columns and that track will be played there.
When you're done with editing, save your song - and then export it. The export will create an assembly source file. It contains two song configuration values (length and maxtrack) and a static array of values. However, this array is NOT the one you can paste into the chiptune Arduino sketch. As I couldn't find out how the array in the assembly file and the one in the Arduino sketch were related, I simply had the source file compiled into an object file. Then I dumped the contents of the object file and there it was - the data I needed to paste into the sketch. In the end I wrote a small script (which also uses a simple Java parser) to automate this job of compiling and dumping the assembly stuff.
If you run my script on an exported song (.s file), you should be able to get another file containing the data you can paste into your sketch. All that's left to to then is to adjust the values of MAXTRACK and SONGLEN according to the exported song and you should be the proud owner of your own chiptune playing on your favourite bit of hardware.

Hope this helps (works, even!).

Montag, 20. Februar 2012

IPM V2 approaches completion

Hey guys!

Well, it's been some time since my last post, but sometimes there's just so much work to do, you'd need a week to finish one day's load.
Anyway, during a week off at my best man's home (he is called "The AirBear"), we nearly managed to finish the second version of the Internet Personal Messenger. The IPM v2 has a new page all for itself, showing off some stages of its hardware development.




The TFT's backlight is very hungry for power, which presented us with some problems, because the wiring on the Arduino board was incapable of distributing the power from the USB port well enough to fit the whole appliance. To solve this issue, we built a "support board" which also holds all the external circuitry, like speaker amplifier, button resistor ladder, etc. The AirBear built the board from the meagre information he could deduce from my instructions, which were somewhat confusing, because I didn't ever think of documenting the wiring before ;) It drove him close to madness when I told him I needed another connection to VCC for the TFT backlight - there wasn't any space left on the small PCB! Well, a Y-cable did the trick in the end :P You can see the complete schematic here:




We also had an argument about the buttons: When almost completely finished, The AirBear had to take the whole thing apart again because the buttons seemed to be in the wrong order. When we had carefully reassembled the IPM, the buttons were STILL in the wrong order! At home, a close inspection of the daughter board yielded a solder bridge between two copper lanes, shorting a resistor and thus making it appear as if two of the buttons were identical. So, my advice here is: ALWAYS use an ohmmeter to check your board for short circuits before powering it up!


Now I hope that the hardware is working correctly and I just have to find the last bugs in the software - which cause the IPM to crash at the moment. There must be some kind of unterminated string buffer lurking in the RAM, making the firmware overwrite everything else in RAM at some point. Once, it even overwrite the EEPROM's contents with rubbish, although I really can't figure out how that could've happened. Well, let's just hope it doesn't happen again...

So far, see you in the near future :)