Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: parse scale files into Tuning
name
code content
// read all scales provided at // https://www.huygens-fokker.org/microtonality/scales.html // turn into a dictionary with keys equal to filenames // a "parser" based on description at // https://www.huygens-fokker.org/scala/seq_format.html // 2023, Till Bovermann | https://tai-studio.org // download scl files from https://www.huygens-fokker.org/docs/scales.zip // unzip with // unzip -aa scales.zip to a directory // example path: var path = "/Users/tboverma/Downloads/scl"; t = "%/*.scl".format(path).pathMatch.collectAs({|path| var rawContents, description, numKeys, degrees, octaveRatio, tuning, a, b; // read file, ignore comments rawContents = File.readAllString(path).split($\n).select{|row| row.first != $! }; // description is in first line description = rawContents[0].replace(13.asAscii, ""); // number of elements is in second line numKeys = rawContents[1].asInteger; // read only numKeys elements degrees = numKeys.collect{|i| // strip leading white space and ignore everything after first white space var val = rawContents[2 + i].stripWhiteSpace.split($ ).first; val.includes($.).if({ // we see cents val.asFloat/100 }, { // we see fractions val.includes($/).if({ #a, b = val.split($/).collect(_.asInteger); a/b }, { val.asInteger }) - 1 * 12 }) }; // octave ratio is last element octaveRatio = degrees.last / 12 + 1; // a Tuning object requires a leading 0 and omits the octave jump degrees = [0] ++ degrees.drop(-1); // create a Tuning object tuning = Tuning(degrees, octaveRatio, description); path.basename.splitext.first.asSymbol -> tuning }, Event);
code description
A "parser" for Scala tunings as suggested here: https://scsynth.org/t/scales-and-tunings-without-scale-or-tuning/8014/7
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change