Problems with the avarage loop

      BEATS[10] = {};

You still haven't explained what you think this does. There is no element 10 in a 10 element array. The elements are numbered 0 to 9.

You have not said what the code actually does. You have not said what you expect it to do. You have not explained how those two things are different.