Move step phase generation code to own program

The code was embeded in BKBuffer.c and not really accessible.