Skip to content

Commit

Permalink
introduce onetwentyeighth notes to BPM
Browse files Browse the repository at this point in the history
changed DrumPattern to init its BPM to a passed in value instead of hard coding 120bpm
updated score files to initialize drum patterns properly
  • Loading branch information
rl337 committed Mar 8, 2015
1 parent 96f9a87 commit 8a1927a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/DoubleStrokeDrumWarmupScore.ck
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ kit.init(audio_dir, 0.9, 0.9, 0.75);
kit.bus => dac;

DrumPattern left;
left.init();
left.init(120);

DrumPattern right;
right.init();
right.init(120);

WavFileWriter writer;
writer.init("a.wav", 1.0);
Expand Down
20 changes: 10 additions & 10 deletions src/FlamAccentDrumWarmupScore.ck
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ kit.init(audio_dir, 0.9, 0.9, 0.75);
kit.bus => dac;

DrumPattern left;
left.init();
left.init(240);

DrumPattern right;
right.init();
right.init(240);

WavFileWriter writer;
writer.init("a.wav", 1.0);
Expand All @@ -21,28 +21,28 @@ left.addRepeated(
[
9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
6,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,

0,6,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,4,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
6,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
],
left.bpm.sixtyfourthNote,
4
16
);

right.addRepeated(
[
0,6,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,4,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
6,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,

9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
6,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
],
left.bpm.sixtyfourthNote,
4
16
);

kit.play(left, right);
4 changes: 2 additions & 2 deletions src/SingleStrokeDrumWarmupScore.ck
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ kit.init(audio_dir, 0.9, 0.9, 0.75);
kit.bus => dac;

DrumPattern left;
left.init();
left.init(120);

DrumPattern right;
right.init();
right.init(120);

WavFileWriter writer;
writer.init("a.wav", 1.0);
Expand Down
2 changes: 2 additions & 0 deletions src/classes/BPM.ck
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class BPM {
static dur sixteenthNote;
static dur thirtysecondNote;
static dur sixtyfourthNote;
static dur onetwentyeighthNote;

function void tempo(float bpm) {
60.0 / bpm => float spb;
Expand All @@ -13,6 +14,7 @@ public class BPM {
eighthNote * 0.5 => sixteenthNote;
sixteenthNote * 0.5 => thirtysecondNote;
thirtysecondNote * 0.5 => sixtyfourthNote;
sixtyfourthNote * 0.5 => onetwentyeighthNote;
}

}
6 changes: 3 additions & 3 deletions src/classes/DrumPattern.ck
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public class DrumPattern {

0 => int REST;

function void init() {
bpm.tempo(120);
function void init(int init_bpm) {
bpm.tempo(init_bpm);

0 => ptr;

bpm.sixtyfourthNote / 1.0::second => tempo;
bpm.onetwentyeighthNote / 1.0::second => tempo;

int values[0] @=> pattern;
}
Expand Down

0 comments on commit 8a1927a

Please sign in to comment.