//Beat Detection, VU Meter Visualization int x, y; //variables to access the sound data arrays int basscounter = 0; //a counter to keep track of increasing value of sound data int wavegap = 0; //difference between previous sound and current for (y = 0; y < 2; y ++) { int last=this_mod->waveformData[y][0]; //gets the first sound sample for (x = 1; x < 576; x ++) //go through each sample { last = this_mod->waveformData[y][x]; //update sound sample //calculate gap between previous sound sample and current wavegap = abs(this_mod->waveformData[0][x]^128)+abs(this_mod->waveformData[1][x]^128)+1; //if the difference between the last played wave and current wave is big enough //increment basscounter if (wavegap > 383) basscounter++; } //if enough bass potential played, redraw the face if (basscounter > 31) //do changes to the visualization once there is enough bass change in the music //if enough bass potential played, redraw the eyebrows if (basscounter > 71) //some more changes that would occur less often if (y) { //if VU meter (y=1) //do changes } else { //if not //do other changes }