metronome tweaks and score update
This commit is contained in:
parent
230ebbd2fa
commit
92381afc3c
Binary file not shown.
|
|
@ -120,8 +120,8 @@ transportView = {
|
|||
// update clock and metronome
|
||||
clockStringFunc = {
|
||||
arg curBeat; var measure, beat;
|
||||
beat = (((curBeat / 2) % 4) + 1).trunc.asString;
|
||||
measure = ((curBeat / 8) + 1).trunc.asString;
|
||||
beat = (((curBeat / 2) % 4) + 1).trunc.asInteger.asString;
|
||||
measure = ((curBeat / 8) + 1).trunc.asInteger.asString;
|
||||
if(measure.size == 1, {measure = " " ++ measure});
|
||||
if(measure.size == 2, {measure = " " ++ measure});
|
||||
measure ++ ":" ++ beat};
|
||||
|
|
@ -164,9 +164,10 @@ transportView = {
|
|||
if(File.exists(baseDir +/+ "hl_6_fundamental.wav").not ||
|
||||
File.exists(baseDir +/+ "hl_6_harmonics.wav").not ||
|
||||
File.exists(baseDir +/+ "hl_5_high_noise.wav").not ||
|
||||
File.exists(baseDir +/+ "hl_4_low_noise.wav").not, {
|
||||
File.exists(baseDir +/+ "hl_4_low_noise.wav").not ||
|
||||
File.exists(baseDir +/+ "click.wav").not, {
|
||||
var matrixH4, matrixH5, matrixH6, dataH4, dataH5, dataH6,
|
||||
patternH4, patternH5, patternH6Fund, patternH6Harms;
|
||||
patternH4, patternH5, patternH6Fund, patternH6Harms, click;
|
||||
matrixH4 = ~matricize.value([~tileMap[4]], 4, 0, ~transform);
|
||||
matrixH5 = ~matricize.value([~tileMap[5]], 5, 0, ~transform);
|
||||
matrixH6 = ~matricize.value([~tileMap[6]], 6, 0, ~transform);
|
||||
|
|
@ -176,7 +177,8 @@ transportView = {
|
|||
patternH4 = ~genPattern.value(dataH4, "hl_4_low_noise", 16, true, cond); cond.hang;
|
||||
patternH5 = ~genPattern.value(dataH5, "hl_5_high_noise", 4, true, cond); cond.hang;
|
||||
patternH6Fund = ~genPattern.value([dataH6[0]], "hl_6_fundamental", 1, true, cond); cond.hang;
|
||||
patternH6Harms = ~genPattern.value(dataH6[1..3], "hl_6_harmonics", 1, true, cond); cond.hang});
|
||||
patternH6Harms = ~genPattern.value(dataH6[1..3], "hl_6_harmonics", 1, true, cond); cond.hang;
|
||||
click = ~genPattern.value([(0..7).wrapExtend(8 * 129)], "click", 2, true, cond); cond.hang});
|
||||
|
||||
// load buffers if the transform has changed
|
||||
if(~loadedTransform != ~transform, {var baseDir;
|
||||
|
|
@ -190,7 +192,7 @@ transportView = {
|
|||
|
||||
// play / stop functionality (create synth if it does not exist
|
||||
{if(~play == nil, {~play = Synth.new(\play, [\hash, hash, \playRate, 0, \startTrig, 0,
|
||||
\sineBuf1, ~buf1, \sineBuf2, ~buf2, \highNoiseBuf, ~buf3, \lowNoiseBuf, ~buf4])});
|
||||
\sineBuf1, ~buf1, \sineBuf2, ~buf2, \highNoiseBuf, ~buf3, \lowNoiseBuf, ~buf4, \tempo, ~tempo])});
|
||||
pauseButton.value = 0;
|
||||
if(elem.value == 0, {
|
||||
clock.string = clockStringFunc.value((startPos * 129).trunc * 8);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ appEnvironment.push;
|
|||
~transform = [2, 1, 0, 1, 0, 0, 0];
|
||||
~tileMap = ~mapAll.value(6 /*max depth*/, ~transform);
|
||||
~layoutState = 0;
|
||||
~dur = 0.125;
|
||||
~tempo = 120;
|
||||
~dur = 0.125 * (120/~tempo);
|
||||
~continuousPlay = false;
|
||||
|
||||
// launch
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ SynthDef(\hl_4_low_noise, {arg amp = 1, pos = 0;
|
|||
Out.ar(0, Pan2.ar(LPF.ar(WhiteNoise.ar(Lag.kr(amp * (1 / 4), 0.05)), 300), pos))
|
||||
}).store;
|
||||
|
||||
// synth for click (only generates files for practice purposes)
|
||||
SynthDef(\click, {arg tick;
|
||||
Out.ar([0, 1], 10 * BPF.ar(
|
||||
WhiteNoise.ar * EnvGen.kr(Env.perc(0.01, 0.1), tick % 2 <= 0),
|
||||
440 * ((tick % 8 <= 0) + 1), 0.02))
|
||||
}).store;
|
||||
|
||||
// synth for amp curves for score
|
||||
SynthDef(\lamp, {arg freq, amp = 1;
|
||||
Out.ar(0, Lag.ar(K2A.ar(amp), 2))
|
||||
|
|
@ -24,14 +31,14 @@ SynthDef(\play, {arg sinePlayer1, sinePlayer2, highNoisePlayer, lowNoisePlayer,
|
|||
sineBuf1 = 0, sineBuf2 = 1, highNoiseBuf = 2, lowNoiseBuf = 3,
|
||||
eTracks, eTracksPanned, eMaster,
|
||||
eVol = #[0.8, 0.8, 0.8, 0.8], eMute = #[1, 1, 1, 1], ePan = #[0, 0, 0, 0], masterVol = 1, masterMute = 1,
|
||||
playRate = 0, startPos = 0, startTrig = 0, hash;
|
||||
playRate = 0, startPos = 0, startTrig = 0, hash, tempo;
|
||||
var dStartTrig, phasor, countOff, imp, curBeat;
|
||||
|
||||
countOff = PulseCount.kr(Impulse.kr(4), startTrig) * startTrig;
|
||||
countOff = PulseCount.kr(Impulse.kr(4 * (tempo/120)), startTrig) * startTrig;
|
||||
dStartTrig = countOff > 17;
|
||||
phasor = Phasor.ar(dStartTrig, Select.kr(playRate * dStartTrig, [0, BufRateScale.kr(sineBuf1)]),
|
||||
0, BufFrames.kr(sineBuf1), startPos * BufFrames.kr(sineBuf1));
|
||||
curBeat = ((A2K.kr(phasor) / BufFrames.kr(sineBuf1)) * BufDur.kr(sineBuf1) * 4).trunc;
|
||||
curBeat = ((A2K.kr(phasor) / BufFrames.kr(sineBuf1)) * BufDur.kr(sineBuf1) * 4 * (tempo/120)).trunc;
|
||||
curBeat = Select.kr(dStartTrig, [countOff - 18, curBeat]);
|
||||
|
||||
sinePlayer1 = PlayBuf.ar(2, sineBuf1, playRate * dStartTrig, dStartTrig, startPos * BufFrames.kr(sineBuf1));
|
||||
|
|
@ -46,7 +53,7 @@ SynthDef(\play, {arg sinePlayer1, sinePlayer2, highNoisePlayer, lowNoisePlayer,
|
|||
Out.ar(0, eMaster);
|
||||
|
||||
// optional click - uncomment and send to an output not used
|
||||
//Out.ar(2, 10 * BPF.ar(WhiteNoise.ar * EnvGen.kr(Env.perc(0.01, 0.1), curBeat % 2 <= 0), 440 * ((curBeat % 8 <= 0) + 1), 0.02));
|
||||
// Out.ar(1, 10 * BPF.ar(WhiteNoise.ar * EnvGen.kr(Env.perc(0.01, 0.1), curBeat % 2 <= 0), 440 * ((curBeat % 8 <= 0) + 1), 0.02));
|
||||
SendTrig.kr(Changed.kr(curBeat), hash, curBeat);
|
||||
imp = Impulse.kr(10);
|
||||
SendReply.kr(imp, '/masterLevel', [Amplitude.kr(eMaster)], hash);
|
||||
|
|
@ -63,7 +70,8 @@ SynthDef(\play, {arg sinePlayer1, sinePlayer2, highNoisePlayer, lowNoisePlayer,
|
|||
"hl_6_harmonics", {Pmono(\hl_6_sine, \freq, 31.midicps + ((31.midicps * 4) * (p + 1)),
|
||||
\dur, ~dur, \amp, Pseq(seq * (1 / pow(1 + ((p + 1) * 4), 1))), \pos, 0)},
|
||||
"hl_5_high_noise", {Pmono(\hl_5_high_noise, \dur, ~dur * durMult, \amp, Pseq(seq), \pos, 0)},
|
||||
"hl_4_low_noise", {Pmono(\hl_4_low_noise, \dur, ~dur * durMult, \amp, Pseq(seq), \pos, 0)})}));
|
||||
"hl_4_low_noise", {Pmono(\hl_4_low_noise, \dur, ~dur * durMult, \amp, Pseq(seq), \pos, 0)},
|
||||
"click", {Pmono(\click, \tick, Pseq(seq), \dur, ~dur * durMult)})}));
|
||||
if(genAudio, {File.mkdir(~dir +/+ ".." +/+ "audio" +/+ "transform_" ++ ~transform.join ++ "_audio");
|
||||
pattern.render(~dir +/+ ".." +/+ "audio" +/+ "transform_" ++ ~transform.join ++ "_audio" +/+ ins ++ ".wav", ~dur * durMult * data[0].size,
|
||||
headerFormat: "WAV", sampleRate: s.sampleRate, action: {if(cond != nil, {cond.unhang})})});
|
||||
|
|
|
|||
Loading…
Reference in a new issue