History

mostly working minblep sampler

Matthew Wang committed 6 years ago

Commit 382ddd11 parent d634fb36 files · +480 −101Browse files

Showing the changes to TestPlugin (1 of 6 files). Show all

Unified · Split

TestPlugin/Source/MyTest.cpp+44−55
@@ -14,21 +14,6 @@ static void leaf_pool_report(void); · 13 unmodified lines
14static void leaf_pool_dump(void);14static void leaf_pool_dump(void);
15static void run_pool_test(void);15static void run_pool_test(void);
16 16
17tNoise noise;
18tSVF bp1;
19tSVF bp2;
20tFormantShifter fs;
21
22tSampler samp;
23tBuffer buff;
24tEnvelope env;
25
26tAutotune at;
27
28tPhasor phasor;
29
30tHighpass hipass;
31
32tMBSaw bsaw;17tMBSaw bsaw;
33tMBTriangle btri;18tMBTriangle btri;
34tMBPulse bpulse;19tMBPulse bpulse;
@@ -42,6 +27,9 @@ tEnvelopeFollower ef; · 7 unmodified lines
42 27
43tCycle sine;28tCycle sine;
44 29
30tBuffer samp;
31tMBSampler sampler;
32
45float gain;33float gain;
46float dtime;34float dtime;
47bool buttonState;35bool buttonState;
@@ -53,7 +41,7 @@ float a, b, c, d; · 5 unmodified lines
53float* bufIn;41float* bufIn;
54float* bufOut;42float* bufOut;
55 43
56#define MSIZE 50000044#define MSIZE 2048000
57char memory[MSIZE];45char memory[MSIZE];
58 46
59void LEAFTest_init (float sampleRate, int blockSize)47void LEAFTest_init (float sampleRate, int blockSize)
@@ -76,6 +64,12 @@ void LEAFTest_init (float sampleRate, int blockSize) · 16 unmodified lines
76 64
77 tCycle_init(&sine);65 tCycle_init(&sine);
78 tCycle_setFreq(&sine, 100);66 tCycle_setFreq(&sine, 100);
67
68 tBuffer_init(&samp, 5.0f * leaf.sampleRate);
69 tMBSampler_init(&sampler, &samp);
70
71 tMBSampler_setMode(&sampler, PlayLoop);
72 tMBSampler_setEnd(&sampler, samp->bufferLength);
79}73}
80 74
81inline double getSawFall(double angle) {75inline double getSawFall(double angle) {
@@ -90,6 +84,11 @@ inline double getSawFall(double angle) { · 8 unmodified lines
90float lastFreq;84float lastFreq;
91float LEAFTest_tick (float input)85float LEAFTest_tick (float input)
92{86{
87 tBuffer_tick(&samp, input);
88
89 return tMBSampler_tick(&sampler);
90
91
93// tMBSaw_setFreq(&bsaw, x);92// tMBSaw_setFreq(&bsaw, x);
94// tMBTriangle_setFreq(&btri, x);93// tMBTriangle_setFreq(&btri, x);
95// tMBPulse_setFreq(&bpulse, x);94// tMBPulse_setFreq(&bpulse, x);
@@ -102,21 +101,21 @@ float LEAFTest_tick (float input) · 6 unmodified lines
102// return tMBPulse_tick(&bpulse);101// return tMBPulse_tick(&bpulse);
103 102
104 103
105 float freq = 1.0f/tPeriodDetection_tick(&pd, input) * leaf.sampleRate;104// float freq = 1.0f/tPeriodDetection_tick(&pd, input) * leaf.sampleRate;
106 tPitchDetector_tick(&detector, input);105// tPitchDetector_tick(&detector, input);
107 float altFreq = tPitchDetector_getFrequency(&detector);106// float altFreq = tPitchDetector_getFrequency(&detector);
108 107//
109 if (fabsf(1.0f - (freq / altFreq)) < 0.05f)108// if (fabsf(1.0f - (freq / altFreq)) < 0.05f)
110// if (tZeroCrossingCounter_tick(&zc, input) < 0.05 && freq > 0.0f)109//// if (tZeroCrossingCounter_tick(&zc, input) < 0.05 && freq > 0.0f)
111 {110// {
112 tCycle_setFreq(&sine, altFreq);111// tCycle_setFreq(&sine, altFreq);
113 }112// }
114 113//
115 float g = tEnvelopeFollower_tick(&ef, input);114// float g = tEnvelopeFollower_tick(&ef, input);
116 115//
117 lastFreq = freq;116// lastFreq = freq;
118 117//
119 return tCycle_tick(&sine) * g * 2.0f + input;118// return tCycle_tick(&sine) * g * 2.0f + input;
120}119}
121 120
122int firstFrame = 1;121int firstFrame = 1;
@@ -129,37 +128,27 @@ void LEAFTest_block (void) · 6 unmodified lines
129 DBG(tPitchDetector_getFrequency(&detector));128 DBG(tPitchDetector_getFrequency(&detector));
130 DBG(tPitchDetector_getPeriodicity(&detector));129 DBG(tPitchDetector_getPeriodicity(&detector));
131 }130 }
132 // if (firstFrame == 1)
133 // {
134 // tBuffer_record(&buff); // starts recording
135 // tSampler_play(&samp); // start spitting samples out
136 // firstFrame = 0;
137 // }
138 131
139 float val = getSliderValue("mod freq");132 float val = getSliderValue("on/off");
140 133
141 x = val;134 if (val > 0.5f && !sampler->active)
142 135 {
143 136 tBuffer_record(&samp);
137 tMBSampler_play(&sampler);
138 }
139 else if (val < 0.5f && sampler->active)
140 {
141 tMBSampler_stop(&sampler);
142 }
144 143
145 // a = val * tBuffer_getBufferLength(&buff);144 val = getSliderValue("mod freq");
146 145
147// DBG("start: " + String(a));146 tMBSampler_setStart(&sampler, val * 5.0f * leaf.sampleRate);
147
148 148
149 val = getSliderValue("mod depth");149 val = getSliderValue("mod depth");
150 150
151 y = val * 2.0f - 1.0f;151 tMBSampler_setRate(&sampler, val * 8.0f - 4.0f);
152// DBG(String(y));
153 // b = val * tBuffer_getBufferLength(&buff);
154
155// DBG("rate: " + String(b));
156 //
157 // tSampler_setStart(&samp, a);
158 // tSampler_setEnd(&samp, b);
159 // tSampler_setRate(&samp, b);
160
161 // tFormantShifter_setShiftFactor(&fs, x);
162 // tFormantShifter_setIntensity(&fs, y);
163 152
164}153}
165 154

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