Each RGB Channel is (intended to be) independently controllable from each of the others
The sketch is too long for me to more than skim, and I'd like to compare the "doChan" side-by-side, but I'm betting they differ only in the arrays they reference.
Even if there are other differences, I'd also bet that some simple tables would sort them out too.
This:
switch(*chan)
135. {
136. case '0':
137. chan0sort(red,grn,blu,mode,audC,audB,audS,save);
138. break;
139. case '1':
140. chan1sort(red,grn,blu,mode,audC,audB,audS,save);
141. break;
142. case '2':
143. chan2sort(red,grn,blu,mode,audC,audB,audS,save);
144. break;
145. case '3':
146. chan3sort(red,grn,blu,mode,audC,audB,audS,save);
147. break;
148. case '4':
149. chan4sort(red,grn,blu,mode,audC,audB,audS,save);
150. break;
151. }
becomes
137. chanSort(channel [*chan], red,grn,blu,mode,audC,audB,audS,save);
with a single two dimensional array.