Browse Source

Built SampleChan class

master
Pete Shadbolt 9 years ago
parent
commit
40cc369cef
3 changed files with 45 additions and 26 deletions
  1. +0
    -2
      main.ck
  2. +4
    -4
      run.sh
  3. +41
    -20
      scratch.ck

+ 0
- 2
main.ck View File

@@ -11,8 +11,6 @@ adc => LiSa sample => mixer; // Sampler

// Levels
//0 => adc.gain;
1 => sample.feedback;
.5 => sample.gain;
.5 => adcThru.gain;

// Start recording and playing in a loop


+ 4
- 4
run.sh View File

@@ -1,6 +1,6 @@
#!/bin/bash
#chuck --bufsize64 scratch.ck
chuck --bufsize64 main.ck &
python ./main.py
pkill -SIGINT chuck
chuck --bufsize64 scratch.ck
#chuck --bufsize64 main.ck &
#python ./main.py
#pkill -SIGINT chuck


+ 41
- 20
scratch.ck View File

@@ -1,27 +1,48 @@
// Effects chain
Gain mixer => dac; // Main mixer
adc => Gain adcThru => mixer; // Monitor the input
adc => LiSa sample => mixer; // Sampler
// TODO: turn off adcThru when recording
public class SampleChan
{
// Chain
LiSa sample => LPF filter;

// Setup
UGen @ mySource;
10::second => sample.duration; //This is the max duration
0::second => sample.recPos => sample.playPos;
1.0 => sample.feedback;
1 => sample.loop;
setLoopPoint(1::second);
filter.set(10000, 1);

//Times
10::second => sample.duration;
0::second => sample.recPos;
0::second => sample.playPos;
1::second => sample.loopEnd => sample.loopEndRec;
public void setLoopPoint( dur length ) {
length => sample.loopEnd => sample.loopEndRec;
}

// Start recording and playing in a loop
1 => sample.loop => sample.record => sample.play;
public void outputTo(UGen ugen) {
1 => sample.play;
filter => ugen;
}

// Levels
//0 => adc.gain;
1 => sample.feedback;
.5 => sample.gain;
.5 => adcThru.gain;
public void recordFrom(UGen ugen) {
1 => sample.record;
ugen => sample;
ugen @=> mySource;
}

.5::second => now;
2::second => sample.loopEnd => sample.loopEndRec;
public void stopRecording() {
0 => sample.record;
mySource =< sample;
}
}

// Effects chain
Gain mixer => dac; // Main mixer
//adc => Gain adcThru => mixer; // Monitor the input
SampleChan sample; // Sampler

sample.outputTo(mixer);
sample.recordFrom(adc);

2::second => now;
sample.stopRecording();
5::second=>now;

while(true) { 1::second => now; }
/*while(true) { 1::second => now; }*/

Loading…
Cancel
Save