commit f1e34816f4c3def4f6df1db8ff055611fdda4f95
parent adab8df0bb1bb00c11c10aefdd5ab077aef6bde5
Author: Christopher A. Oliver <caowasteland@gmail.com>
Date: Sat, 3 Oct 2015 18:27:19 -0400
1) Add pink noise as a sound type.
2) Permit access to stereo width and unison widgets for
noise since they have had an effect.
3) Silently limit noise unison to two since either L and
R differ or they don't.
Diffstat:
4 files changed, 90 insertions(+), 42 deletions(-)
diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp
@@ -62,7 +62,7 @@ static const Ports voicePorts = {
rParamZyn(Unison_vibratto, "Subvoice vibratto"),
rParamZyn(Unison_vibratto_speed, "Subvoice vibratto speed"),
rOption(Unison_invert_phase, rOptions(none, random, 50%, 33%, 25%), "Subvoice Phases"),
- rOption(Type, rOptions(Sound,Noise), "Type of Sound"),
+ rOption(Type, rOptions(Sound,White,Pink), "Type of Sound"),
rParamZyn(PDelay, "Voice Startup Delay"),
rToggle(Presonance, "Resonance Enable"),
rParamI(Pextoscil, rMap(min, -1), rMap(max, 16), "External Oscilator Selection"),
diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp
@@ -86,6 +86,9 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars)
NoteGlobalPar.Punch.Enabled = 0;
for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) {
+ for (int i = 0; i < 14; i++)
+ pinking[nvoice][i] = 0.0;
+
pars.VoicePar[nvoice].OscilSmp->newrandseed(prng());
NoteVoicePar[nvoice].OscilSmp = NULL;
NoteVoicePar[nvoice].FMSmp = NULL;
@@ -105,6 +108,10 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars)
if(unison < 1)
unison = 1;
+ // Since noise unison of greater than two is touch goofy...
+ if (pars.VoicePar[nvoice].Type != 0 && unison > 2)
+ unison = 2;
+
//compute unison
unison_size[nvoice] = unison;
@@ -1423,7 +1430,7 @@ inline void ADnote::ComputeVoiceOscillatorPitchModulation(int /*nvoice*/)
/*
* Computes the Noise
*/
-inline void ADnote::ComputeVoiceNoise(int nvoice)
+inline void ADnote::ComputeVoiceWhiteNoise(int nvoice)
{
for(int k = 0; k < unison_size[nvoice]; ++k) {
float *tw = tmpwave_unison[k];
@@ -1432,6 +1439,25 @@ inline void ADnote::ComputeVoiceNoise(int nvoice)
}
}
+inline void ADnote::ComputeVoicePinkNoise(int nvoice)
+{
+ for(int k = 0; k < unison_size[nvoice]; ++k) {
+ float *tw = tmpwave_unison[k];
+ float *f = &pinking[nvoice][k > 0 ? 7 : 0];
+ for(int i = 0; i < synth.buffersize; ++i) {
+ float white = (RND-0.5)/4.0;
+ f[0] = 0.99886*f[0]+white*0.0555179;
+ f[1] = 0.99332*f[1]+white*0.0750759;
+ f[2] = 0.96900*f[2]+white*0.1538520;
+ f[3] = 0.86650*f[3]+white*0.3104856;
+ f[4] = 0.55000*f[4]+white*0.5329522;
+ f[5] = -0.7616*f[5]-white*0.0168980;
+ tw[i] = f[0]+f[1]+f[2]+f[3]+f[4]+f[5]+f[6]+white*0.5362;
+ f[6] = white*0.115926;
+ }
+ }
+}
+
/*
@@ -1454,27 +1480,34 @@ int ADnote::noteout(float *outl, float *outr)
if((NoteVoicePar[nvoice].Enabled != ON)
|| (NoteVoicePar[nvoice].DelayTicks > 0))
continue;
- if(NoteVoicePar[nvoice].noisetype == 0) //voice mode=sound
- switch(NoteVoicePar[nvoice].FMEnabled) {
- case MORPH:
- ComputeVoiceOscillatorMorph(nvoice);
- break;
- case RING_MOD:
- ComputeVoiceOscillatorRingModulation(nvoice);
- break;
- case PHASE_MOD:
- ComputeVoiceOscillatorFrequencyModulation(nvoice, 0);
- break;
- case FREQ_MOD:
- ComputeVoiceOscillatorFrequencyModulation(nvoice, 1);
- break;
- //case PITCH_MOD:ComputeVoiceOscillatorPitchModulation(nvoice);break;
- default:
- ComputeVoiceOscillator_LinearInterpolation(nvoice);
- //if (config.cfg.Interpolation) ComputeVoiceOscillator_CubicInterpolation(nvoice);
- }
- else
- ComputeVoiceNoise(nvoice);
+ switch (NoteVoicePar[nvoice].noisetype) {
+ case 0: //voice mode=sound
+ switch(NoteVoicePar[nvoice].FMEnabled) {
+ case MORPH:
+ ComputeVoiceOscillatorMorph(nvoice);
+ break;
+ case RING_MOD:
+ ComputeVoiceOscillatorRingModulation(nvoice);
+ break;
+ case PHASE_MOD:
+ ComputeVoiceOscillatorFrequencyModulation(nvoice, 0);
+ break;
+ case FREQ_MOD:
+ ComputeVoiceOscillatorFrequencyModulation(nvoice, 1);
+ break;
+ //case PITCH_MOD:ComputeVoiceOscillatorPitchModulation(nvoice);break;
+ default:
+ ComputeVoiceOscillator_LinearInterpolation(nvoice);
+ //if (config.cfg.Interpolation) ComputeVoiceOscillator_CubicInterpolation(nvoice);
+ }
+ break;
+ case 1:
+ ComputeVoiceWhiteNoise(nvoice);
+ break;
+ default:
+ ComputeVoicePinkNoise(nvoice);
+ break;
+ }
// Voice Processing
diff --git a/src/Synth/ADnote.h b/src/Synth/ADnote.h
@@ -99,7 +99,8 @@ class ADnote:public SynthNote
inline void ComputeVoiceOscillatorPitchModulation(int nvoice);
/**Generate Noise Samples for Voice*/
- inline void ComputeVoiceNoise(int nvoice);
+ inline void ComputeVoiceWhiteNoise(int nvoice);
+ inline void ComputeVoicePinkNoise(int nvoice);
/**Fadein in a way that removes clicks but keep sound "punchy"*/
inline void fadein(float *smps) const;
@@ -249,6 +250,9 @@ class ADnote:public SynthNote
/* INTERNAL VALUES OF THE NOTE AND OF THE VOICES */
/********************************************************/
+ //pinking filter (Paul Kellet)
+ float pinking[NUM_VOICES][14];
+
//the size of unison for a single voice
int unison_size[NUM_VOICES];
diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl
@@ -558,19 +558,6 @@ voiceonbutton->redraw();} open
xywh {5 540 520 50} box UP_FRAME
} {
Fl_Dial {} {
- label Stereo
- tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
- code0 {o->init("Unison_stereo_spread");}
- class Fl_Osc_Dial
- }
- Fl_Counter {} {
- label Unison
- tooltip {Unison size} xywh {15 563 65 18} labelfont 1 align 5 minimum 1 maximum 64 step 1 value 1 textfont 1 textsize 11
- code0 {o->init("Unison_size", 1);}
- code1 {o->lstep(5);}
- class Fl_Osc_Counter
- }
- Fl_Dial {} {
label Vibrato
tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->init("Unison_vibratto");}
@@ -718,8 +705,11 @@ o->redraw();}
code0 {char tmp[10];snprintf(tmp,10,"%d",nvoice+1);o->label(strdup(tmp));}
} {}
Fl_Choice {} {
- callback {if (o->value()==0){ voicemodegroup->activate(); noiselabel->hide();}
- else{ voicemodegroup->deactivate(); noiselabel->show();}}
+ callback {switch (o->value()) {
+ case 0: voicemodegroup->activate(); whitenoiselabel->hide(); pinknoiselabel->hide(); break;
+ case 1: voicemodegroup->deactivate(); whitenoiselabel->show(); pinknoiselabel->hide(); break;
+ default: voicemodegroup->deactivate(); whitenoiselabel->hide(); pinknoiselabel->show(); break;
+}} open
tooltip {Oscillator Type (sound/noise)} xywh {5 515 65 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10
code0 {o->init("Type");}
class Fl_Osc_Choice
@@ -729,8 +719,12 @@ o->redraw();}
xywh {5 5 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label NOISE
- xywh {15 15 100 20} labelfont 1 labelsize 11 labelcolor 1
+ label White
+ xywh {15 15 100 20} labelfont 1 labelsize 11 labelcolor 55
+ }
+ MenuItem {} {
+ label Pink
+ xywh {25 25 100 20} labelfont 1 labelsize 11 labelcolor 211
}
}
Fl_Check_Button bypassfiltercheckbutton {
@@ -759,10 +753,27 @@ bypassfiltercheckbutton->redraw();}
code0 {o->init("PFilterEnabled");}
class Fl_Osc_Check
}
- Fl_Box noiselabel {
+ Fl_Box whitenoiselabel {
label {White Noise}
xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 53 hide
}
+ Fl_Box pinknoiselabel {
+ label {Pink Noise}
+ xywh {150 430 300 65} labelfont 1 labelsize 50 labelcolor 212 hide
+ }
+ Fl_Dial {} {
+ label Stereo
+ tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
+ code0 {o->init("Unison_stereo_spread");}
+ class Fl_Osc_Dial
+ }
+ Fl_Counter {} {
+ label Unison selected
+ tooltip {Unison size} xywh {15 563 65 18} labelfont 1 align 5 minimum 1 maximum 64 step 1 value 1 textfont 1 textsize 11
+ code0 {o->init("Unison_size", 1);}
+ code1 {o->lstep(5);}
+ class Fl_Osc_Counter
+ }
}
Fl_Check_Button voiceonbutton {
label On