Thursday, December 18, 2008

The wonder of OpenMP

It took me about 5 minutes to make an app multithreaded with openMP.

Step 1 : Turn on openMP flag


Step 2 :  Add #pragma omp parallel for to the existing for statement like so
#pragma omp parallel for
for ( int i = 0; i < parlist.count(); i++)
    // Do your code here.
   // Cannot jump out of for loop. No breaks, no returns.
Step 3 : Profit!

Wednesday, December 10, 2008

Some audio madness

I just found the most awesome command line utility for audio processing. EVER! SoX.

I don't think I'll ever need anything other than this and batch files to do transcoding of audio or even batch processing of audio ever again. GUI's are nice and all, but nothing beats command line apps!

Also, another wav editor instead of audacity which people seem to have many complaints about. Wavosaur.

And lastly, for those musicians out there. LMMS. A Digital Audio Workstation app that now finally has windows support. Awesome!

Here is a sample batch file that you can put inside your SoX folder :

FOR %%G IN (%1\*.wav) DO (
    sox %%G "temp.wav" rate -v 8000
    del %%G
    move temp.wav %%G

I would use this for downsampling 44khz audio recordings to 8k for the Wii Remote. i.e. Lit's phone calls. It's destructive since it converts in place, so make sure your audio is under version control!

Wednesday, December 3, 2008

Multithreaded compiling with VC Express or make -j

For posterity: To turn on multicore compiles in VC Express 2008, in the commandline options of the compiler options. Add a /MP

Thursday, June 19, 2008

Youtube and load balancing.

It seems that youtube doesn't like people who load balance. Simply put, the IP that loads the webpage and probably the flash element needs to be the same one getting the video stream from one of their MANY servers.

The way I solved it was to bind certain IP ranges to a single WAN connection.

This seems to have gotten most of them. I may be missing a few or assigned too large a subnet, but at least my videos usually don't say "We're sorry, this video is no longer available" anymore.