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 :

SET PATH=%PATH%;%~dp0
FOR %%G IN (%1\*.wav) DO (
    sox %%G "temp.wav" rate -v 8000
    del %%G
    move temp.wav %%G
)
pause

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