Initial working implementation of patterns, includes constant and sine.
Fix bugs with multiple patterns. Add more types of patterns.