History

sampler testing

Matthew Wang committed 6 years ago

Commit 730c1421 parent 84569b62 files · +42 −11Browse files

Unified · Split

2 files
  1. LEAF/Src/leaf-sampling.c +1 −1
  2. LEAF_JUCEPlugin/Source/MyTest.cpp +41 −10
LEAF/Src/leaf-sampling.c+1−1
@@ -471,7 +471,7 @@ void tSampler_setRate (tSampler* const sp, float rate) · 470 unmodified lines
471471 p->dir = 1;
472472 }
473473
474− p->inc = LEAF_clip(0.f, rate, 8.0f);
474+ p->inc = rate; //LEAF_clip(0.f, rate, 8.0f); any reason to clip this?
475475 p->iinc = 1.f / p->inc;
476476 }
477477
LEAF_JUCEPlugin/Source/MyTest.cpp+41−10
@@ -21,6 +21,10 @@ tSVF bp1; · 20 unmodified lines
2121 tSVF bp2;
2222 tFormantShifter fs;
2323
24+tSampler samp;
25+tBuffer buff;
26+tEnvelope env;
27+
2428 float gain;
2529 float freq;
2630 float dtime;
@@ -28,6 +32,7 @@ bool buttonState; · 1 unmodified line
2832 int ratio = 2;
2933 float x = 0.0f;
3034 float y = 0.0f;
35+float a, b, c, d;
3136
3237 #define MSIZE 500000
3338 char memory[MSIZE];
@@ -42,36 +47,62 @@ void LEAFTest_init (float sampleRate, int blockSize) · 8 unmodified lines
4247 tSVF_init(&bp2, SVFTypeBandpass, 1000, 4.0f);
4348
4449 tFormantShifter_init(&fs, 2048, 20);
50+
51+ // Init and set record
52+ tBuffer_init (&buff, leaf.sampleRate); // init, 1 second buffer
53+ tBuffer_setRecordMode (&buff, RecordOneShot); // RecordOneShot records once through
54+
55+ // Init and set play
56+ tSampler_init (&samp, &buff); // init, give address of record buffer
57+ tSampler_setMode (&samp, PlayLoop); //set in Loop Mode
58+ tSampler_setRate(&samp, 1.f); // Rate of 1.0
4559 }
4660
4761 float LEAFTest_tick (float input)
4862 {
49− float sample = tNoise_tick(&noise);
50− sample *= 0.5f;
51− float b = tSVF_tick(&bp1, sample);
52− b += tSVF_tick(&bp2, sample);
63+// float sample = tNoise_tick(&noise);
64+// sample *= 0.5f;
65+// float b = tSVF_tick(&bp1, sample);
66+// b += tSVF_tick(&bp2, sample);
67+//
68+// return (tFormantShifter_tick(&fs, input));
5369
54− return (tFormantShifter_tick(&fs, input));
70+ tBuffer_tick(&buff, input);
71+
72+ return tSampler_tick(&samp);
5573 }
5674
57−
75+int firstFrame = 1;
5876 bool lastState = false, lastPlayState = false;
5977 void LEAFTest_block (void)
6078 {
79+ if (firstFrame == 1)
80+ {
81+ tBuffer_record(&buff); // starts recording
82+ tSampler_play(&samp); // start spitting samples out
83+ firstFrame = 0;
84+ }
85+
6186 float val = getSliderValue("mod freq");
6287
6388 x = val * 3.5f + 0.5f;
6489
65− DBG("fwarp: " + String(x));
90+ a = val * tBuffer_getLength(&buff);
91+
92+ DBG("start: " + String(a));
6693
6794 val = getSliderValue("mod depth");
6895
6996 y = val * 49.0f + 1.0f;
97+ b = val * 20.0f - 5.0f;
98+
99+ DBG("rate: " + String(b));
70100
71− DBG("intensity: " + String(y));
101+ tSampler_setStart(&samp, a);
102+ tSampler_setRate(&samp, b);
72103
73− tFormantShifter_setShiftFactor(&fs, x);
74− tFormantShifter_setIntensity(&fs, y);
104+// tFormantShifter_setShiftFactor(&fs, x);
105+// tFormantShifter_setIntensity(&fs, y);
75106
76107 }
77108

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t