Skip to content

Commit

Permalink
Added File writer class. This lets me write out .wav files to use on …
Browse files Browse the repository at this point in the history
…SoundCloud
  • Loading branch information
rl337 committed Feb 15, 2015
1 parent 3b8b59a commit 6984ffb
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/DoubleStrokeDrumWarmupPlay.ck
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Machine.add(me.dir() + "/classes/Chordable.ck");
Machine.add(me.dir() + "/classes/BPM.ck");
Machine.add(me.dir() + "/classes/Drum.ck");
Machine.add(me.dir() + "/classes/SndBufDrum.ck");
Machine.add(me.dir() + "/classes/WavFileWriter.ck");


Machine.add(me.dir() + "/DoubleStrokeDrumWarmupScore.ck");
4 changes: 4 additions & 0 deletions src/DoubleStrokeDrumWarmupScore.ck
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ right.bus => dac;
BPM bpm;
bpm.tempo(120);

WavFileWriter writer;
writer.init("a.wav", 1.0);
dac => writer.bus;

[
[
9,0,0,0, 9,0,0,0,
Expand Down
1 change: 1 addition & 0 deletions src/SingleStrokeDrumWarmupPlay.ck
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Machine.add(me.dir() + "/classes/Chordable.ck");
Machine.add(me.dir() + "/classes/BPM.ck");
Machine.add(me.dir() + "/classes/Drum.ck");
Machine.add(me.dir() + "/classes/SndBufDrum.ck");
Machine.add(me.dir() + "/classes/WavFileWriter.ck");


Machine.add(me.dir() + "/SingleStrokeDrumWarmupScore.ck");
112 changes: 110 additions & 2 deletions src/SingleStrokeDrumWarmupScore.ck
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ right.bus => dac;
BPM bpm;
bpm.tempo(120);

WavFileWriter writer;
writer.init("a.wav", 1.0);
dac => writer.bus;

[
[
9,0,0,0, 0,0,0,0,
Expand All @@ -29,7 +33,59 @@ bpm.tempo(120);
9,0,0,0, 9,0,0,0,

9,0,9,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 0,0,9,0,

0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,

0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,
0,0,0,0, 9,0,0,0,

9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,

9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,

9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,

9,0,9,0, 9,0,9,0,
9,0,9,0, 9,0,9,0,
9,0,9,0, 9,0,9,0,
9,0,9,0, 9,0,9,0,

9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,
9,0,0,0, 9,0,0,0,

9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,

9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0,
9,0,0,0, 0,0,0,0
]
] @=> int pattern[][];

Expand Down
17 changes: 17 additions & 0 deletions src/classes/WavFileWriter.ck
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

public class WavFileWriter {
WvOut output;
Pan2 bus;

function void init(string filename, float gain) {

if (filename.length() != 0) {
filename => output.wavFilename;

bus => output => blackhole;
gain => bus.gain;

null @=> output;
}
}
}

0 comments on commit 6984ffb

Please sign in to comment.