adamrenklint / qwak

Definition and parser for qwak, a simple and expressive minimal text syntax for programming step-based web audio event sequences
https://www.npmjs.com/package/qwak
Other
10 stars 2 forks source link

Generate raw qwak from pattern #9

Closed adamrenklint closed 8 years ago

adamrenklint commented 8 years ago

To allow for recording and editing of notes in a parsed pattern, there must be a way to generate a raw qwak string from that modified pattern.

const pattern = qwak.parse('/qwak');
pattern.sequences[0].notes[2].position = '1.1.01';
const raw = qwak.generate(pattern);
expect(raw).to.equal(/q&w_ak/);

Since there might be several valid forms of representing a pattern, maybe several iterations should be done, and the shortest, or simplest, one wins.