Skip to content

Commit

Permalink
allow rests in arpeggios.
Browse files Browse the repository at this point in the history
added augmented 7th to chordable
  • Loading branch information
rl337 committed Jan 25, 2015
1 parent a3febfd commit 8616c77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/classes/Chordable.ck
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ public class Chordable {

function void arpeggio(Chord chord, int sequence[], dur duration, float gain) {
for (0 => int i; i < sequence.cap(); i++) {
v[i % v.cap()].play(chord.note(sequence[i]+inv), duration / sequence.cap(), gain);
sequence[i] => int index;
duration / sequence.cap() => dur notedur;

// a -1 represents a rest
if (sequence[i] != -1) {
v[i % v.cap()].play(chord.note(index+inv), notedur, gain);
} else {
notedur => now;
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/classes/Chords.ck
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public class Chords {
return result;
}

public static Chord Augmented7th(Scale scale, int root) {
Chord result;
result.init([scale.note(root), scale.note(root + 3), scale.note(root + 5)+1, scale.note(root+7)]);
return result;
}

public static Chord Minor(Scale scale, int root) {
Chord result;
result.init([scale.note(root), scale.note(root + 3)-1, scale.note(root + 5)]);
Expand Down

0 comments on commit 8616c77

Please sign in to comment.