Mercurial > hg > silvet
diff yeti/scratch/generateTemplatesC.yeti @ 56:4fa3ea96eb65
Merge from branch preshift
author | Chris Cannam |
---|---|
date | Tue, 08 Apr 2014 13:30:43 +0100 |
parents | eec530c4300d |
children | 97b77e7cb94c |
line wrap: on
line diff
--- a/yeti/scratch/generateTemplatesC.yeti Mon Apr 07 17:34:19 2014 +0100 +++ b/yeti/scratch/generateTemplatesC.yeti Tue Apr 08 13:30:43 2014 +0100 @@ -14,9 +14,10 @@ "tenorsax", "violin", "piano-maps-SptkBGCl", - "piano1", - "piano2", - "piano3", +//!!! restore these? +// "piano1", +// "piano2", +// "piano3", ]; hardcodedRanges = [ @@ -45,6 +46,7 @@ noteCount = 88; templateHeight = 545; +shiftRange = 2; convert instrument lines ostr = (notes = map do line: @@ -69,9 +71,15 @@ ostr.writeln " {"; for notes do note: ostr.write " { "; + for [0..shiftRange-1] do s: + ostr.write "0.0, "; + done; for (vec.list note) do v: ostr.write "\(v), "; done; + for [0..shiftRange-1] do s: + ostr.write "0.0, "; + done; ostr.writeln "},"; done; ostr.writeln " }"; @@ -88,15 +96,17 @@ "", "/* note: intended to parse as both C and C++ */", "", - "#define SILVET_TEMPLATE_NOTE_COUNT \(noteCount)", - "#define SILVET_TEMPLATE_HEIGHT \(templateHeight)", - "#define SILVET_TEMPLATE_COUNT \(length instruments)", + "#define SILVET_TEMPLATE_COUNT \(length instruments) /* Number of instruments */", + "#define SILVET_TEMPLATE_NOTE_COUNT \(noteCount) /* Number of notes per instrument */ ", + "#define SILVET_TEMPLATE_HEIGHT \(templateHeight) /* Frequency bins per template */", + "#define SILVET_TEMPLATE_MAX_SHIFT \(shiftRange) /* Zeros at either end of template */ ", + "#define SILVET_TEMPLATE_SIZE \(templateHeight + 2 * shiftRange) /* Height + 2 * max shift space */ ", "", "typedef struct {", " const char *name;", " int lowest;", " int highest;", - " float data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_HEIGHT];", + " float data[SILVET_TEMPLATE_NOTE_COUNT][SILVET_TEMPLATE_SIZE];", "} silvet_template_t;", "", "static int silvet_templates_lowest_note = \(overallLowest);",