Parcourir la source

Metronome is actually good now, adcThruMute works

master
Pete Shadbolt il y a 9 ans
Parent
révision
f4953c139d
2 fichiers modifiés avec 22 ajouts et 16 suppressions
  1. +19
    -13
      main.ck
  2. +3
    -3
      main.py

+ 19
- 13
main.ck Voir le fichier

@@ -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
}
}
}

+ 3
- 3
main.py Voir le fichier

@@ -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)


Chargement…
Annuler
Enregistrer