History

Resolved some 808 issues.

mulshine committed 7 years ago

Commit c019bb21 parent 423d8464 files · +145 −67Browse files

Unified · Split

4 files
  1. .DS_Store +0 −0
  2. LEAF/.gitignore +11 −0
  3. LEAF/Src/leaf-808.c +2 −31
  4. LEAF/Src_cpp/leaf-808.cpp +133 −37
.DS_Store+0−0

Binary file not shown.

LEAF/.gitignore+11−0
@@ -0,0 +1,11 @@
1+*.DS_Store
2+*.app
3+*.a
4+*.appex
5+*.vst
6+*.vst3
7+*.component
8+*.xcuserstate
9+*.zip
10+*.swp
11+*/Builds
LEAF/Src/leaf-808.c+2−31
@@ -140,7 +140,6 @@ float t808Hihat_tick(t808Hihat* const hihat) { · 139 unmodified lines
140140
141141 sample *= gainScale;
142142
143−<<<<<<< HEAD
144143 sample = (hihat->oscNoiseMix * sample) + ((1.0f-hihat->oscNoiseMix) * myNoise);
145144
146145 sample = tSVF_tick(&hihat->bandpassOsc, sample);
@@ -150,18 +149,7 @@ float t808Hihat_tick(t808Hihat* const hihat) { · 3 unmodified lines
150149 sample = tHighpass_tick(&hihat->highpass, sample);
151150 sample += ((0.5f * tEnvelope_tick(&hihat->envStick)) * tSVF_tick(&hihat->bandpassStick, tNoise_tick(&hihat->stick)));
152151 sample = tanhf(sample * 2.0f);
153−=======
154− sample = (hihat->oscNoiseMix * sample) + ((1.0f-hihat->oscNoiseMix) * (0.8f * tNoise_tick(&hihat->n)));
155−
156− sample = tSVF_tick(&hihat->bandpassOsc, sample);
157−
158− sample *= tEnvelope_tick(&hihat->envGain);
159−
160− sample = 0.85f * LEAF_clip(0.0f, tHighpass_tick(&hihat->highpass, sample), 1.0f);
161−
162− sample += 0.15f * tEnvelope_tick(&hihat->envStick) * tSVF_tick(&hihat->bandpassStick, tNoise_tick(&hihat->stick));
163−
164−>>>>>>> dattorro
152+
165153 return sample;
166154 }
167155
@@ -191,7 +179,6 @@ void t808Hihat_setOscBandpassFreq(t808Hihat* const hihat, float freq) · 23 unmodified lines
191179 tSVF_setFreq(&hihat->bandpassOsc,freq);
192180 }
193181
194−<<<<<<< HEAD
195182 void t808Hihat_setOscBandpassQ(t808Hihat* const hihat, float Q)
196183 {
197184 tSVF_setQ(&hihat->bandpassOsc,Q);
@@ -206,18 +193,7 @@ void t808Hihat_setStickBandPassFreq(t808Hihat* const hihat, float freq) · 8 unmodified lines
206193 void t808Hihat_setOscFreq(t808Hihat* const hihat, float freq)
207194 {
208195 hihat->freq = freq;
209−=======
210196
211−void t808Hihat_setOscFreq(t808Hihat* const hihat, float freq)
212−{
213− tSquare_setFreq(&hihat->p[0], 2.0f * freq);
214− tSquare_setFreq(&hihat->p[1], 3.00f * freq);
215− tSquare_setFreq(&hihat->p[2], 4.16f * freq);
216− tSquare_setFreq(&hihat->p[3], 5.43f * freq);
217− tSquare_setFreq(&hihat->p[4], 6.79f * freq);
218− tSquare_setFreq(&hihat->p[5], 8.21f * freq);
219−
220−>>>>>>> dattorro
221197 }
222198
223199 void t808Hihat_init(t808Hihat* const hihat)
@@ -234,15 +210,10 @@ void t808Hihat_init(t808Hihat* const hihat) · 10 unmodified lines
234210 tSVF_init(&hihat->bandpassStick, SVFTypeBandpass,2500.0,1.5f);
235211 tSVF_init(&hihat->bandpassOsc, SVFTypeBandpass,3500,0.5f);
236212
237−<<<<<<< HEAD
238213 tEnvelope_init(&hihat->envGain, 0.0f, 50.0f, OFALSE);
239214 tEnvelope_init(&hihat->noiseFMGain, 0.0f, 500.0f, OFALSE);
240215 tEnvelope_init(&hihat->envStick, 0.0f, 4.0f, OFALSE);
241−=======
242− tEnvelope_init(&hihat->envGain, 5.0f, 50.0f, OFALSE);
243− tEnvelope_init(&hihat->envStick, 5.0f, 15.0f, OFALSE);
244−>>>>>>> dattorro
245−
216+
246217 tHighpass_init(&hihat->highpass, 7000.0f);
247218
248219 hihat->freq = 40.0f;
LEAF/Src_cpp/leaf-808.cpp+133−37
@@ -123,6 +123,16 @@ float t808Hihat_tick(t808Hihat* const hihat) { · 122 unmodified lines
123123 float sample = 0.0f;
124124 float gainScale = 0.1666f;
125125
126+
127+ float myNoise = tNoise_tick(&hihat->n);
128+
129+ tSquare_setFreq(&hihat->p[0], ((2.0f + hihat->stretch) * hihat->freq));
130+ tSquare_setFreq(&hihat->p[1], ((3.00f + hihat->stretch) * hihat->freq));
131+ tSquare_setFreq(&hihat->p[2], ((4.16f + hihat->stretch) * hihat->freq));
132+ tSquare_setFreq(&hihat->p[3], ((5.43f + hihat->stretch) * hihat->freq));
133+ tSquare_setFreq(&hihat->p[4], ((6.79f + hihat->stretch) * hihat->freq));
134+ tSquare_setFreq(&hihat->p[5], ((8.21f + hihat->stretch) * hihat->freq));
135+
126136 for (int i = 0; i < 6; i++)
127137 {
128138 sample += tSquare_tick(&hihat->p[i]);
@@ -130,22 +140,23 @@ float t808Hihat_tick(t808Hihat* const hihat) { · 1 unmodified line
130140
131141 sample *= gainScale;
132142
133− sample = (hihat->oscNoiseMix * sample) + ((1.0f-hihat->oscNoiseMix) * (0.8f * tNoise_tick(&hihat->n)));
143+ sample = (hihat->oscNoiseMix * sample) + ((1.0f-hihat->oscNoiseMix) * myNoise);
134144
135145 sample = tSVF_tick(&hihat->bandpassOsc, sample);
136146
137− sample *= tEnvelope_tick(&hihat->envGain);
138−
139− sample = 0.85f * LEAF_clip(0.0f, tHighpass_tick(&hihat->highpass, sample), 1.0f);
140−
141− sample += 0.15f * tEnvelope_tick(&hihat->envStick) * tSVF_tick(&hihat->bandpassStick, tNoise_tick(&hihat->stick));
142−
147+ float myGain = tEnvelope_tick(&hihat->envGain);
148+ sample *= (myGain*myGain);//square the output gain envelope
149+ sample = tHighpass_tick(&hihat->highpass, sample);
150+ sample += ((0.5f * tEnvelope_tick(&hihat->envStick)) * tSVF_tick(&hihat->bandpassStick, tNoise_tick(&hihat->stick)));
151+ sample = tanhf(sample * 2.0f);
152+
143153 return sample;
144154 }
145155
146156 void t808Hihat_setDecay(t808Hihat* const hihat, float decay)
147157 {
148158 tEnvelope_setDecay(&hihat->envGain,decay);
159+ tEnvelope_setDecay(&hihat->noiseFMGain,decay);
149160 }
150161
151162 void t808Hihat_setHighpassFreq(t808Hihat* const hihat, float freq)
@@ -153,21 +164,35 @@ void t808Hihat_setHighpassFreq(t808Hihat* const hihat, float freq) · 1 unmodified line
153164 tHighpass_setFreq(&hihat->highpass,freq);
154165 }
155166
167+void t808Hihat_setStretch(t808Hihat* const hihat, float stretch)
168+{
169+ hihat->stretch = stretch;
170+}
171+
172+void t808Hihat_setFM(t808Hihat* const hihat, float FM_amount)
173+{
174+ hihat->FM_amount = FM_amount;
175+}
176+
156177 void t808Hihat_setOscBandpassFreq(t808Hihat* const hihat, float freq)
157178 {
158179 tSVF_setFreq(&hihat->bandpassOsc,freq);
159180 }
160181
182+void t808Hihat_setOscBandpassQ(t808Hihat* const hihat, float Q)
183+{
184+ tSVF_setQ(&hihat->bandpassOsc,Q);
185+}
186+
187+void t808Hihat_setStickBandPassFreq(t808Hihat* const hihat, float freq)
188+{
189+ tSVF_setFreq(&hihat->bandpassStick,freq);
190+}
191+
161192
162193 void t808Hihat_setOscFreq(t808Hihat* const hihat, float freq)
163194 {
164− tSquare_setFreq(&hihat->p[0], 2.0f * freq);
165− tSquare_setFreq(&hihat->p[1], 3.00f * freq);
166− tSquare_setFreq(&hihat->p[2], 4.16f * freq);
167− tSquare_setFreq(&hihat->p[3], 5.43f * freq);
168− tSquare_setFreq(&hihat->p[4], 6.79f * freq);
169− tSquare_setFreq(&hihat->p[5], 8.21f * freq);
170−
195+ hihat->freq = freq;
171196 }
172197
173198 void t808Hihat_init(t808Hihat* const hihat)
@@ -184,19 +209,22 @@ void t808Hihat_init(t808Hihat* const hihat) · 10 unmodified lines
184209 tSVF_init(&hihat->bandpassStick, SVFTypeBandpass,2500.0,1.5f);
185210 tSVF_init(&hihat->bandpassOsc, SVFTypeBandpass,3500,0.5f);
186211
187− tEnvelope_init(&hihat->envGain, 5.0f, 50.0f, OFALSE);
188− tEnvelope_init(&hihat->envStick, 5.0f, 15.0f, OFALSE);
189−
212+ tEnvelope_init(&hihat->envGain, 0.0f, 50.0f, OFALSE);
213+ tEnvelope_init(&hihat->noiseFMGain, 0.0f, 500.0f, OFALSE);
214+ tEnvelope_init(&hihat->envStick, 0.0f, 4.0f, OFALSE);
215+
190216 tHighpass_init(&hihat->highpass, 7000.0f);
191217
192− float freq = 40.0f;
218+ hihat->freq = 40.0f;
219+ hihat->stretch = 0.0f;
220+ hihat->FM_amount = 1000.0f;
193221
194− tSquare_setFreq(&hihat->p[0], 2.0f * freq);
195− tSquare_setFreq(&hihat->p[1], 3.00f * freq);
196− tSquare_setFreq(&hihat->p[2], 4.16f * freq);
197− tSquare_setFreq(&hihat->p[3], 5.43f * freq);
198− tSquare_setFreq(&hihat->p[4], 6.79f * freq);
199− tSquare_setFreq(&hihat->p[5], 8.21f * freq);
222+ tSquare_setFreq(&hihat->p[0], 2.0f * hihat->freq);
223+ tSquare_setFreq(&hihat->p[1], 3.00f * hihat->freq);
224+ tSquare_setFreq(&hihat->p[2], 4.16f * hihat->freq);
225+ tSquare_setFreq(&hihat->p[3], 5.43f * hihat->freq);
226+ tSquare_setFreq(&hihat->p[4], 6.79f * hihat->freq);
227+ tSquare_setFreq(&hihat->p[5], 8.21f * hihat->freq);
200228 }
201229
202230 void t808Snare_on(t808Snare* const snare, float vel)
@@ -262,19 +290,19 @@ float t808Snare_tick(t808Snare* const snare) · 59 unmodified lines
262290 {
263291 for (int i = 0; i < 2; i++)
264292 {
265− tTriangle_setFreq(&snare->tone[i], snare->tone1Freq + (50.0f * tEnvelope_tick(&snare->toneEnvOsc[i])));
293+ tTriangle_setFreq(&snare->tone[i], snare->tone1Freq + (20.0f * tEnvelope_tick(&snare->toneEnvOsc[i])));
266294 tone[i] = tTriangle_tick(&snare->tone[i]);
267295
268− tSVF_setFreq(&snare->toneLowpass[i], 2000 + (500 * tEnvelope_tick(&snare->toneEnvFilter[i])));
296+ tSVF_setFreq(&snare->toneLowpass[i], 2000.0f + (500.0f * tEnvelope_tick(&snare->toneEnvFilter[i])));
269297 tone[i] = tSVF_tick(&snare->toneLowpass[i], tone[i]) * tEnvelope_tick(&snare->toneEnvGain[i]);
270298 }
271299
272300 float noise = tNoise_tick(&snare->noiseOsc);
273− tSVF_setFreq(&snare->noiseLowpass, snare->noiseFilterFreq +(500 * tEnvelope_tick(&snare->noiseEnvFilter)));
301+ tSVF_setFreq(&snare->noiseLowpass, snare->noiseFilterFreq + (1000.0f * tEnvelope_tick(&snare->noiseEnvFilter)));
274302 noise = tSVF_tick(&snare->noiseLowpass, noise) * tEnvelope_tick(&snare->noiseEnvGain);
275303
276304 float sample = (snare->toneNoiseMix)*(tone[0] * snare->toneGain[0] + tone[1] * snare->toneGain[1]) + (1.0f-snare->toneNoiseMix) * (noise * snare->noiseGain);
277−
305+ sample = tanhf(sample * 2.0f);
278306 return sample;
279307 }
280308
@@ -284,21 +312,24 @@ void t808Snare_init(t808Snare* const snare) · 3 unmodified lines
284312 for (int i = 0; i < 2; i++)
285313 {
286314 tTriangle_init(&snare->tone[i]);
315+
287316 tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
288− tSVF_init(&snare->toneLowpass[i], SVFTypeLowpass, 2000, 1.0f);
289− tEnvelope_init(&snare->toneEnvOsc[i], 3.0f, 20.0f, OFALSE);
290− tEnvelope_init(&snare->toneEnvGain[i], 10.0f, 200.0f, OFALSE);
291− tEnvelope_init(&snare->toneEnvFilter[i], 3.0f, 200.0f, OFALSE);
317+ tSVF_init(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f);
318+ tEnvelope_init(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE);
319+ tEnvelope_init(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE);
320+ tEnvelope_init(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE);
292321
293322 snare->toneGain[i] = 0.5f;
294323 }
295324
296−
325+ snare->tone1Freq = ratio[0] * 100.0f;
326+ snare->tone2Freq = ratio[1] * 100.0f;
327+ snare->noiseFilterFreq = 3000.0f;
297328 tNoise_init(&snare->noiseOsc, WhiteNoise);
298− tSVF_init(&snare->noiseLowpass, SVFTypeLowpass, 2000, 3.0f);
299− tEnvelope_init(&snare->noiseEnvGain, 10.0f, 125.0f, OFALSE);
300− tEnvelope_init(&snare->noiseEnvFilter, 3.0f, 100.0f, OFALSE);
301− snare->noiseGain = 0.3f;
329+ tSVF_init(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f);
330+ tEnvelope_init(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE);
331+ tEnvelope_init(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE);
332+ snare->noiseGain = 1.0f;
302333 }
303334
304335 void t808Snare_free (t808Snare* const snare)
@@ -320,3 +351,68 @@ void t808Snare_free (t808Snare* const snare) · 15 unmodified lines
320351 }
321352
322353
354+void t808Kick_init (t808Kick* const kick)
355+{
356+ tCycle_init(&kick->tone);
357+ kick->toneInitialFreq = 40.0f;
358+ kick->sighAmountInHz = 7.0f;
359+ kick->chirpRatioMinusOne = 3.3f;
360+ tCycle_setFreq(&kick->tone, 50.0f);
361+ tSVF_init(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f);
362+ tEnvelope_init(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE);
363+ tEnvelope_init(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE);
364+ tEnvelope_init(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE);
365+ tNoise_init(&kick->noiseOsc, PinkNoise);
366+ tEnvelope_init(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE);
367+ kick->noiseGain = 0.3f;
368+}
369+
370+
371+void t808Kick_free (t808Kick* const kick)
372+{
373+ tCycle_free(&kick->tone);
374+ tSVF_free(&kick->toneLowpass);
375+ tEnvelope_free(&kick->toneEnvOscChirp);
376+ tEnvelope_free(&kick->toneEnvOscSigh);
377+ tEnvelope_free(&kick->toneEnvGain);
378+ tNoise_free(&kick->noiseOsc);
379+ tEnvelope_free(&kick->noiseEnvGain);
380+}
381+
382+float t808Kick_tick (t808Kick* const kick)
383+{
384+ tCycle_setFreq(&kick->tone, (kick->toneInitialFreq * (1.0f + (kick->chirpRatioMinusOne * tEnvelope_tick(&kick->toneEnvOscChirp)))) + (kick->sighAmountInHz * tEnvelope_tick(&kick->toneEnvOscSigh)));
385+ float sample = tCycle_tick(&kick->tone) * tEnvelope_tick(&kick->toneEnvGain);
386+ sample+= tNoise_tick(&kick->noiseOsc) * tEnvelope_tick(&kick->noiseEnvGain);
387+ //add distortion here
388+ sample = tSVF_tick(&kick->toneLowpass, sample);
389+ return sample;
390+}
391+
392+void t808Kick_on (t808Kick* const kick, float vel)
393+{
394+ tEnvelope_on(&kick->toneEnvOscChirp, vel);
395+ tEnvelope_on(&kick->toneEnvOscSigh, vel);
396+ tEnvelope_on(&kick->toneEnvGain, vel);
397+ tEnvelope_on(&kick->noiseEnvGain, vel);
398+
399+}
400+void t808Kick_setToneFreq (t808Kick* const kick, float freq)
401+{
402+ kick->toneInitialFreq = freq;
403+
404+}
405+
406+void t808Kick_setToneDecay (t808Kick* const kick, float decay)
407+{
408+ tEnvelope_setDecay(&kick->toneEnvGain,decay);
409+ tEnvelope_setDecay(&kick->toneEnvGain,decay * 3.0f);
410+}
411+void t808Kick_setNoiseDecay (t808Kick* const kick, float decay);
412+void t808Kick_setSighAmount (t808Kick* const kick, float sigh);
413+void t808Kick_setChirpAmount (t808Kick* const kick, float chirp);
414+void t808Kick_setToneNoiseMix (t808Kick* const kick, float toneNoiseMix);
415+void t808Kick_setNoiseFilterFreq (t808Kick* const kick, float noiseFilterFreq);
416+void t808Kick_setNoiseFilterQ (t808Kick* const kick, float noiseFilterQ);
417+
418+

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