From f4953c139d5c11db83acb23680dd793f8d03553d Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Thu, 22 Jan 2015 11:04:03 +0000 Subject: [PATCH] Metronome is actually good now, adcThruMute works --- main.ck | 32 +++++++++++++++++++------------- main.py | 6 +++--- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/main.ck b/main.ck index 69e3d23..980c817 100644 --- a/main.ck +++ b/main.ck @@ -1,7 +1,6 @@ //TODO: turn off adcThru when recording, and turn it back on afterwards //TODO: Effects break panning for some unknown reason //TODO varying number of bars -//TODO: Subdivide metronome (still a bit wierd) NRev reverb => LPF lpf => HPF hpf => Dyno outputLimiter => dac; outputLimiter.limit(); reverb @=> UGen @ outputWet; // Reference to wet output @@ -14,7 +13,7 @@ inputLimiter.limit(); inputLimiter @=> UGen @ mainInput; // Default parameters -.5 => float adcThruLevel; +1 => float adcThruLevel; 1 => int adcThruMute; adcThruLevel * adcThruMute => adcThru.gain; 10000 => lpf.freq; @@ -105,11 +104,7 @@ class LoopPedal public void setWet( float ratio ) { ratio => wet.gain; 1-ratio => dry.gain;} public void clear() { sample.clear(); } public void recordFrom(UGen ugen) { ugen => sample; } - public int beat() { return Math.round(4 * sample.playPos() / sample.loopEnd()) $ int; } - public dur remaining() { - sample.loopEnd() => dur ltime; - return (ltime - sample.playPos()) % (ltime/4.); - } + public dur remaining() { return sample.loopEnd() - sample.playPos(); } public void outputTo(UGen wetSink, UGen drySink) { 1 => sample.play; @@ -130,17 +125,28 @@ class Metronome SinOsc s => ADSR a; 0.5 => s.gain; a.set(0.001, .1, .5, .05); - 0.01::second => dur plipTime; + 10::ms => dur plipTime; fun void mute(int value) { if (value){ a => dac; } else { a =< dac; } } fun void run() { - while(true){ - 500 + 500*(pedals[0].beat()==1) => s.freq; - a.keyOn(); plipTime => now; a.keyOff(); - pedals[0].remaining() => now; - } + while(true) { + // Compute the beat time + pedals[0].sample.loopEnd()/4. - plipTime => dur beatTime; + + // Beep four times + 1000 => s.freq; + a.keyOn(); plipTime => now; a.keyOff(); + beatTime => now; + 500 => s.freq; + a.keyOn(); plipTime => now; a.keyOff(); + beatTime => now; + a.keyOn(); plipTime => now; a.keyOff(); + beatTime => now; + a.keyOn(); plipTime => now; a.keyOff(); + pedals[0].remaining() => now; // Sync + } } } diff --git a/main.py b/main.py index 8335ba2..efdf21c 100644 --- a/main.py +++ b/main.py @@ -75,9 +75,9 @@ class InputPanel(wx.Panel): label.SetFont(font) sizer.Add(label, 0, wx.TOP | wx.BOTTOM | wx.RIGHT, 5) - self.gain = OSCSlider(self, "Gain", default_value=.5, align=False) + self.gain = OSCSlider(self, "Gain", default_value=.5, max_value = 1.2, align=False) sizer.Add(self.gain, 1, wx.ALL, 5) - self.thru = OSCSlider(self, "Thru", default_value=.5, align=False) + self.thru = OSCSlider(self, "Thru", default_value=1, max_value = 1.2, align=False) sizer.Add(self.thru, 1, wx.ALL, 5) self.mute = wx.ToggleButton(self, 0, "Mute") @@ -115,7 +115,7 @@ class DelayPanel(wx.Panel): label.SetFont(font) sizer.Add(label, 0, wx.TOP | wx.BOTTOM | wx.RIGHT, 5) - self.delayTime = OSCSlider(self, "Time", default_value=1, max_value=10, min_value=0.5, align=False) + self.delayTime = OSCSlider(self, "Time", default_value=2, max_value=10, min_value=0.5, align=False) sizer.Add(self.delayTime, 1, wx.ALL, 5) self.feedback = OSCSlider(self, "Hold", default_value=.99, align=False)