12.29.2009

pwtracker: An .au file creator written in C99

Download pwtracker.zip
License: Public Domain

As an exercise to sharpen my C skills (and out of admiration for older video game music), I've been writing a C program to make some audio files from scratch. It's not very advanced, but it allows you to define a sampling function which in turn it uses to create an .au file.

What you need to know:
  • There are two versions of the program. The first version (pwt1) gives you access to the massive array of audio data in case you wanted to mess with it, otherwise you should use the second version (pwt2), which uses a buffer to keep the memory usage close to nothing. The makefile provided is set to create both versions.

  • The "sample" function in sample.c is the sampling function I spoke of.

  • waves.c/waves.h provide some waveforms for you to play around with.

  • notes.c/notes.h provide two functions: noteKey(), which converts a string like "A#4" to the corresponding piano key number, and keyFreq(), which converts that number into the corresponding frequency.

  • All options are within #defines in the main1.c, main2.c and sample.c files. There aren't any command-line switches, you just edit the code, compile and run it to make the audio file.

  • The code was written with portability in mind and should compile almost anywhere, so long as you compile as C99.

Enjoy.

Touchpads and Games that require use of a mouse, like OpenArena

Last night I installed the openarena package on Ubuntu and at first, the gameplay totally sucked because it seemed like I couldn't use the mouse and the keyboard at the same time. Then it occurred to me that it was probably because I was using a touchpad...the game couldn't be this popular if the mouse sucked.

Anyway, if you're experiencing any sort of keyboard/touchpad problems while playing a game on Ubuntu, go to Preferences>Mouse and then to the Touchpad tab. Uncheck "Disable touchpad while typing". This same problem probably affects all OSes, but that's how you'd fix it on Ubuntu.