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
471 p->dir = 1;471 p->dir = 1;
472 }472 }
473 473
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?
475 p->iinc = 1.f / p->inc;475 p->iinc = 1.f / p->inc;
476}476}
477 477
LEAF_JUCEPlugin/Source/MyTest.cpp+41−10
@@ -21,6 +21,10 @@ tSVF bp1; · 20 unmodified lines
21tSVF bp2;21tSVF bp2;
22tFormantShifter fs;22tFormantShifter fs;
23 23
24tSampler samp;
25tBuffer buff;
26tEnvelope env;
27
24float gain;28float gain;
25float freq;29float freq;
26float dtime;30float dtime;
@@ -28,6 +32,7 @@ bool buttonState; · 1 unmodified line
28int ratio = 2;32int ratio = 2;
29float x = 0.0f;33float x = 0.0f;
30float y = 0.0f;34float y = 0.0f;
35float a, b, c, d;
31 36
32#define MSIZE 50000037#define MSIZE 500000
33char memory[MSIZE];38char memory[MSIZE];
@@ -42,36 +47,62 @@ void LEAFTest_init (float sampleRate, int blockSize) · 8 unmodified lines
42 tSVF_init(&bp2, SVFTypeBandpass, 1000, 4.0f);47 tSVF_init(&bp2, SVFTypeBandpass, 1000, 4.0f);
43 48
44 tFormantShifter_init(&fs, 2048, 20);49 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
45}59}
46 60
47float LEAFTest_tick (float input)61float LEAFTest_tick (float input)
48{62{
49 float sample = tNoise_tick(&noise);63// float sample = tNoise_tick(&noise);
50 sample *= 0.5f;64// sample *= 0.5f;
51 float b = tSVF_tick(&bp1, sample);65// float b = tSVF_tick(&bp1, sample);
52 b += tSVF_tick(&bp2, sample);66// b += tSVF_tick(&bp2, sample);
67//
68// return (tFormantShifter_tick(&fs, input));
53 69
54 return (tFormantShifter_tick(&fs, input));70 tBuffer_tick(&buff, input);
71
72 return tSampler_tick(&samp);
55}73}
56 74
57 75int firstFrame = 1;
58bool lastState = false, lastPlayState = false;76bool lastState = false, lastPlayState = false;
59void LEAFTest_block (void)77void LEAFTest_block (void)
60{78{
79 if (firstFrame == 1)
80 {
81 tBuffer_record(&buff); // starts recording
82 tSampler_play(&samp); // start spitting samples out
83 firstFrame = 0;
84 }
85
61 float val = getSliderValue("mod freq");86 float val = getSliderValue("mod freq");
62 87
63 x = val * 3.5f + 0.5f;88 x = val * 3.5f + 0.5f;
64 89
65 DBG("fwarp: " + String(x));90 a = val * tBuffer_getLength(&buff);
91
92 DBG("start: " + String(a));
66 93
67 val = getSliderValue("mod depth");94 val = getSliderValue("mod depth");
68 95
69 y = val * 49.0f + 1.0f;96 y = val * 49.0f + 1.0f;
97 b = val * 20.0f - 5.0f;
98
99 DBG("rate: " + String(b));
70 100
71 DBG("intensity: " + String(y));101 tSampler_setStart(&samp, a);
102 tSampler_setRate(&samp, b);
72 103
73 tFormantShifter_setShiftFactor(&fs, x);104// tFormantShifter_setShiftFactor(&fs, x);
74 tFormantShifter_setIntensity(&fs, y);105// tFormantShifter_setIntensity(&fs, y);
75 106
76}107}
77 108

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