Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // set properties by extracting from filename with regex;
- Items.setWithRegex("fileName", "articulation", "([^`]*)");
- Items.setWithRegex("fileName", "distance", "distance=(\\w+)[`.]");
- Items.setWithRegex("fileName", "speed", "speed=(\\w+)[`.]");
- Items.setWithRegex("fileName", "dynamic", "vl=(\\w+)[`.]");
- Items.setWithRegex("fileName", "string", "str=(\\w+)[`.]");
- Items.setWithRegex("fileName", "fret", "fret=(\\d+)[`.]");
- Items.setWithRegex("fileName", "note", "n=(.*?)[`.]");
- Items.setWithRegex("fileName", "strokedir", "stroke=(\\w+)[`.]");
- Items.setWithRegex("fileName", "rr", "rr=(\\d+)[`.]");
- // create articulation groups by translating multiple key words to one word
- ArticulationGroupTranslator = Items.createTranslator(
- "Harmonic,Mute,PalmMute,Resonance,Strum,Sustain=Core",
- "PalmMuteRel,HarmonicRel,Release=Releases",
- "FX", /*default*/
- "SlideUp,SlideDown,PullOff,HammerOn=Legato",
- );
- Items.setWithTranslator("articulation", "group", ArticulationGroupTranslator);
- // setup name-value pairs
- MakeValuePairsForProperty("string", "E1,A1,D2,G2,B2,E3")
- MakeValuePairsForProperty("strokedir", "dn,up")
- MakeValuePairsForProperty("dynamic", "soft,med,loud");
- // calculate note from fret and string and get numerical values for properties
- for (i = 0; i < Items.count(); ++i)
- {
- item = Items.get(i);
- if (item.hasProperty("fret"))
- item.noteNum = item.fret + Midi.num(item.lookup("string"));
- else if (item.hasProperty("note"))
- item.noteNum = Midi.num(item.note);
- }
- // set "new file name" property with a tag script
- Items.setWithTagScript("new_file_name",
- "<articulation>[_<speed>][_<distance>][_str<string#>][_<dynamic>][_<note>][_<strokedir>][_rr<rr>]");
- for (i = 0; i < Items.count(); ++i)
- {
- item = Items.get(i);
- // Set "NewName" tab to see if we are renaming correcting
- item.new_file_dir = item.fileDir + "/" + item.group + "/" + item.articulation + "/";
- new_file_path = item.new_file_dir + item.new_file_name + "." + item.fileExt;
- item.new_file_path = new_file_path;
- /*UNCOMMENT ONE*/
- // Create dummy files to test results
- //File.createFile(item.fileDir() + "/../dummy/" + item.fileName() );
- // Move/rename files
- //item.filePath(new_file_path);
- }
- // Set tree structure
- //Tree.set("group/articulation/dynamic/speed/distance/strokedir/fileName");
- Tree.set("group/articulation/dynamic/strokedir/new_file_name");
- // Create zones
- for (i = 0; i < Items.count(); ++i)
- {
- item = Items.get(i);
- RR = parseInt(item.rr) - 1;
- Direction = parseInt(item.strokedirNum);
- String = parseInt(item.stringNum);
- Dynamic = parseInt(item.dynamicNum);
- item.max_vel =
- item.min_vel = 1 + RR*2 + Direction + String*4 + Dynamic*24;
- // if (item.articulation != "Sustain" &&
- // item.articulation != "E1") continue;
- item.low_note =
- item.high_note = item.lookup("note");
- }
Advertisement
Add Comment
Please, Sign In to add comment