diff --git a/Array-ext.sc b/Array-ext.sc index 96868cc..6de219b 100644 --- a/Array-ext.sc +++ b/Array-ext.sc @@ -1,26 +1,87 @@ + Array { + +/* + method for substitution of a + Number with a Structure + inside a Structure: + + a = [3, 2, 1, 2, 1] + a.subst(3, [2, 1, 2]) // ==> [ 3, 2, 1, [ 2, [ 2, 1, 2 ] ], 1 ] + + This actually is a subdivision of a element in our score representation + +*/ + + subst { arg index, thisStruct; + + case + {thisStruct.isKindOf(Array)} + {^this.put(index, [this.at(index), thisStruct])} + + {thisStruct.isKindOf(Number)} + {^this.put(index, thisStruct)}; + } + gdc { if(this.containsSeqColl.not, { ^this.reduce({arg a, b; a.asInteger gcd: b.asInteger}) }); } - - - asRC { + + max { + + if(this.containsSeqColl.not, { + ^this.reduce({arg a, b; a max: b}) + }); + } + + + min { + + if(this.containsSeqColl.not, { + ^this.reduce({arg a, b; a min: b}) + }); + } + + + minSize { + + ^(this.collect {|i| i.size}).min + } + + + maxSize { + + ^(this.collect {|i| i.size}).max + } + + + asRhythmicCell { + ^RhythmicCell(this) + } + + + asRC { ^RhythmicCell(this) } + asRhythmicSeq { + + ^RhythmicSeq(this) + } + + asRS { - + ^RhythmicSeq(this) } - + addRC { arg thisRSeq; thisRSeq.put(this) @@ -33,5 +94,6 @@ thisRSeq.put(i) }; } - + + } \ No newline at end of file diff --git a/LilyRhythm.scd b/LilyRhythm.scd index c1d6d56..78c1551 100644 --- a/LilyRhythm.scd +++ b/LilyRhythm.scd @@ -39,6 +39,8 @@ Post << f.([1,2,3,4], 5, 8) +x.edit + a = [ [3, [1, [2, [1, 1, [1, [1, 1, 1]], 1, 1, 1]], 1, 4, 2]], [4, [2, [2, [1, 1, 1, 1, 1, 1]], 1, 4, 2]], @@ -50,8 +52,39 @@ a = [ [4, [4, [2, [1, 1, 1, 1, 1, 1, 1]], 2, 4, 1]] ]; -a.asRS.plot +a.scramble.asRS + +[[1, 2, 3, 4], [[9, 1, 2], [8, 2, 3], [7, 4, 3]]].flop +Help.gui + + +x = RhythmicGroup2(); +x.putMeasure([2, 4, 3, 2, 3, 4, 2]); +x.putStruct([[2, 1, 3, 2, 1], [1, 2, 1, 3, 2], [2, 1, 3, 2, 1, 2, 3, 2], [2, 1, 2, 3, 1]]); +x.voiceArray +x.structMatrix +[ + [2, 4, 3, 2, 3, 4, 2], + [[2, 1, 3, 2, 1], [1, 2, 1, 3, 2], [2, 1, 3, 2, 1, 2, 3, 2], [2, 1, 2, 3, 1]] +].flop + + +x.voice +x.plot + + +x.edit +x.voiceArray + +x.structArray +x.measureArray +x.string + +(a.scramble.asRS) +x.put(a.scramble.asRS) + +x.plot a = [[10,20],[30, 40, 50], 60, 70, [80, 90, 100]]; diff --git a/RhythmicGroup.sc b/RhythmicGroup.sc index 0ec47ec..cd6adf0 100644 --- a/RhythmicGroup.sc +++ b/RhythmicGroup.sc @@ -33,7 +33,13 @@ RhythmicGroup : LilyShowableObj { putArray { arg thisArray; thisArray.do { |i| - this.put(i) + + case + {i.isKindOf(RhythmicSeq)} + {this.put(i)} + + {i.isKIndOf(Array)} + {this.put(i.asRS)}; } } @@ -45,7 +51,6 @@ RhythmicGroup : LilyShowableObj { this.voiceArray.do { |i| outString = outString ++ i.staffString }; - ^outString } @@ -55,13 +60,9 @@ RhythmicGroup : LilyShowableObj { var outString = String.new; outString = outString ++ "\\score {\n\t<<\n\t\t"; - outString = outString ++ this.string; - // outString = outString ++ "\n \\midi { } \n\t \\layout { }\n"; - outString = outString ++ "\n >> \n}\n\n"; - ^outString } diff --git a/RhythmicSystem.sc b/RhythmicSystem.sc index 0ad28ef..d789255 100644 --- a/RhythmicSystem.sc +++ b/RhythmicSystem.sc @@ -1,7 +1,7 @@ /* # Init # - +"Ctk".include a = RhythmicSystem([2, 3, 4]) // <--- Init with measures a.putMeasure([2, 3, 2]) // <---you can add more later @@ -70,7 +70,7 @@ RhythmicSystem : LilyShowableObj { /////////////////////////////////////////// - // Manipulations an measures and struct // + // Manipulations on measures and struct // /////////////////////////////////////////// scrambleMeasures {