This is probably your problem
z = pulseIn(A0, HIGH, 20000);
The last value is the timeout in microseconds. From the online reference:
timeout (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)
20k microseconds is 20 milliseconds. This is like putting a delay() of 20 milliseconds every time through the loop. Some of the patterns are only on/off for that amount of time, so you would see interference.
I would suggest making this much smaller. Experiment as to where the limit is by putting in a call to delayMicroseconds() instead of pulseIn() and play with the values until you find one that provides acceptable response. This will probably have to be a small fraction of the time that the fastest pattern executes.