Code:

const int ARRAY_LENGTH = 50;

float knockTimes[ARRAY_LENGTH];

float knockDelays[ARRAY_LENGTH-1];

float knockRatios[ARRAY_LENGTH-1]; // Elements 0-48

int knocks;

int knockCounter;

void getKnockRatios(float *delayArray, float *ratioArray, int knockCounter) {

// Finds the ratio of the knocks relative to the first delay.

// This allows the knock sequence to be tempo independent.

for (int i = 0; i < knockCounter-1; i++) {

ratioArray[i] = delayArray[i] / delayArray[0];

}

// for (int j = knockCounter-1; j < ARRAY_LENGTH; j++) { // Remove any extra delays from previous knock. THIS IS WHERE THE PROBLEM IS.

// ratioArray[j] = 0; /////// When j reaches 49 (ARRAY_LENGTH-1) this overwrites your counts

// }

float knockTimes[ARRAY_LENGTH];

float knockDelays[ARRAY_LENGTH-1];

float knockRatios[ARRAY_LENGTH-1]; // Elements 0-48

int knocks;

int knockCounter;

void getKnockRatios(float *delayArray, float *ratioArray, int knockCounter) {

// Finds the ratio of the knocks relative to the first delay.

// This allows the knock sequence to be tempo independent.

for (int i = 0; i < knockCounter-1; i++) {

ratioArray[i] = delayArray[i] / delayArray[0];

}

// for (int j = knockCounter-1; j < ARRAY_LENGTH; j++) { // Remove any extra delays from previous knock. THIS IS WHERE THE PROBLEM IS.

// ratioArray[j] = 0; /////// When j reaches 49 (ARRAY_LENGTH-1) this overwrites your counts

// }