commit 86c78d999072214c8a85881c0b21de9d029963d3
parent 95ee486b64fef423a81037bf49de9f10fca08677
Author: paulnasca <paulnasca>
Date: Sun, 22 Feb 2004 12:26:14 +0000
*** empty log message ***
Diffstat:
4 files changed, 66 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -536,6 +536,8 @@
14 Feb 2004 - Se poate incarca si instrumente
- Rezolvata o problema la coarse detune
- Corectate cateva erori la incarcarea XML-ului
- - frecventa LFO-ul de la instrumente are valoare reala intre 0..1
- - corectata eroarea care facea ca functia de rezonanta sa fie trasata incorect
- - adaugata compresie gzip la fisiere si decompresie automata la incarcare (folosesc biblioteca zlib)
+ - Frecventa LFO-ul de la instrumente are valoare reala intre 0..1
+ - Corectata eroarea care facea ca functia de rezonanta sa fie trasata incorect
+ - Adaugata compresie gzip la fisiere si decompresie automata la incarcare (folosesc biblioteca zlib)
+15 Feb 2004 - O mica modificare la envelope parameters in sensul ca envelope-ul prestabilit la FM nu mai este liniar
+22 Feb 2004 - Adaugat normalize Full RMS la Oscil
diff --git a/src/Params/EnvelopeParams.C b/src/Params/EnvelopeParams.C
@@ -60,7 +60,6 @@ REALTYPE EnvelopeParams::getdt(char i){
* ADSR/ASR... initialisations
*/
void EnvelopeParams::ADSRinit(char A_dt,char D_dt,char S_val,char R_dt){
- Plinearenvelope=1;
Envmode=1;
PA_dt=A_dt;PD_dt=D_dt;PS_val=S_val;PR_dt=R_dt;
Pfreemode=0;
@@ -150,6 +149,7 @@ void EnvelopeParams::saveloadbuf(Buffer *buf){
tmp=0xfe;
buf->rwbyte(&tmp);//if tmp!=0xfe error
+ if (Envmode==1) Plinearenvelope=1;
for (n=0x80;n<0xF0;n++){
if (buf->getmode()==0) {
diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C
@@ -63,7 +63,7 @@ void OscilGen::defaults(){
Pbasefuncpar=64;
Pwaveshapingfunction=0;
Pwaveshaping=64;
- Pnormalizemethod=1;
+ Pnormalizemethod=2;
Pfiltertype=0;
Pfilterpar=64;
Pfilterbeforews=0;
@@ -434,17 +434,20 @@ void OscilGen::prepare(){
};
spectrumadjust();
-
- REALTYPE sum=0;
- for (j=1;j<OSCIL_SIZE/2;j++) {
- REALTYPE term=oscilFFTfreqs[j]*oscilFFTfreqs[j]+oscilFFTfreqs[OSCIL_SIZE-j]*oscilFFTfreqs[OSCIL_SIZE-j];
- if (Pnormalizemethod==0) sum+=sqrt(term);
- else sum+=term;
+
+ //normalize (sum or RMS) - the "Full RMS" normalisation is located in the "::get()" function
+ if ((Pnormalizemethod==0)||(Pnormalizemethod==1)){
+ REALTYPE sum=0;
+ for (j=1;j<OSCIL_SIZE/2;j++) {
+ REALTYPE term=oscilFFTfreqs[j]*oscilFFTfreqs[j]+oscilFFTfreqs[OSCIL_SIZE-j]*oscilFFTfreqs[OSCIL_SIZE-j];
+ if (Pnormalizemethod==0) sum+=sqrt(term);
+ else sum+=term;
+ };
+ if (sum<0.000001) sum=1.0;
+ if (Pnormalizemethod==1) sum=sqrt(sum)*2.0;
+ sum*=0.5;
+ for (j=1;j<OSCIL_SIZE;j++) oscilFFTfreqs[j]/=sum;
};
- if (sum<0.000001) sum=1.0;
- if (Pnormalizemethod==1) sum=sqrt(sum)*2.0;
- sum*=0.5;
- for (j=1;j<OSCIL_SIZE;j++) oscilFFTfreqs[j]/=sum;
oscilFFTfreqs[0]=0.0;//remove the DC
@@ -553,6 +556,24 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){
if ((freqHz>0.1)&&(resonance!=0)) res->applyres(nyquist-1,outoscilFFTfreqs,freqHz);
+
+ //Full RMS normalize
+ if (Pnormalizemethod==2){
+ REALTYPE sum=0;
+ for (int j=1;j<OSCIL_SIZE/2;j++) {
+ REALTYPE term=outoscilFFTfreqs[j]*outoscilFFTfreqs[j]+outoscilFFTfreqs[OSCIL_SIZE-j]*outoscilFFTfreqs[OSCIL_SIZE-j];
+ sum+=term;
+ };
+ if (sum<0.000001) sum=1.0;
+ sum=sqrt(sum);
+
+ if ((freqHz>0.1)&&(resonance!=0)) sum/=dB2rap(res->Pgain);//apply the ressonance gain
+
+ for (int j=1;j<OSCIL_SIZE;j++) outoscilFFTfreqs[j]/=sum;
+ };
+
+
+
fft->freqs2smps(outoscilFFTfreqs,smps);
for (i=0;i<OSCIL_SIZE;i++) smps[i]*=0.25;//correct the amplitude
diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl
@@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
-version 1.0104
+version 1.0200
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2003 Nasca Octavian Paul} {}
@@ -205,7 +205,7 @@ class ADOscilharmonic {: {public Fl_Group}
Function {make_window()} {private
} {
Fl_Window harmonic {
- private xywh {421 154 90 225} hide
+ private xywh {421 154 90 225} type Double hide
class Fl_Group
} {
Fl_Slider mag {
@@ -289,7 +289,7 @@ class ADOscilEditor {} {
Function {make_window()} {} {
Fl_Window osceditUI {
label {ADsynth Oscillator Editor}
- xywh {121 91 750 590} hide
+ xywh {121 91 750 590} type Double hide
} {
Fl_Group oscildisplaygroup {
xywh {15 5 360 300} box ENGRAVED_FRAME
@@ -321,7 +321,7 @@ oldosc->redraw();}
} {
Fl_Choice {} {
label {H.rnd}
- callback {oscil->Pamprandtype=(int) o->value();} selected
+ callback {oscil->Pamprandtype=(int) o->value();}
tooltip {Harmonic Amplitude Randomness} xywh {291 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10
code0 {o->value(oscil->Pamprandtype);}
} {
@@ -616,12 +616,6 @@ oldosc->redraw();}
label {Clr.}
tooltip {Auto clear when using the oscillator as base function} xywh {105 310 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10
}
- Fl_Light_Button {} {
- label {RMS normalize}
- callback {oscil->Pnormalizemethod=(int) o->value();}
- tooltip {Normalize type (harmonic's sum/RMS) of the oscillator} xywh {680 360 65 30} box THIN_UP_BOX value 1 labelfont 1 labelsize 10 align 148
- code0 {o->value(oscil->Pnormalizemethod);}
- }
Fl_Group {} {
xywh {375 305 160 30} box ENGRAVED_BOX
} {
@@ -736,6 +730,25 @@ oldosc->redraw();}
class WidgetPDial
}
}
+ Fl_Choice {} {
+ label Normalize
+ callback {oscil->Pnormalizemethod=(int) o->value();} open selected
+ tooltip {Normalize type (harmonic's sum/RMS) of the oscillator} xywh {680 370 60 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10
+ code0 {o->value(oscil->Pnormalizemethod);}
+ } {
+ menuitem {} {
+ label Sum
+ xywh {65 65 100 20} labelfont 1 labelsize 10
+ }
+ menuitem {} {
+ label RMS
+ xywh {75 75 100 20} labelfont 1 labelsize 10
+ }
+ menuitem {} {
+ label {F.RMS}
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
+ }
}
}
Function {ADOscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Master *master_)} {} {
@@ -761,7 +774,7 @@ class ADvoicelistitem {: {public Fl_Group}
Function {make_window()} {private
} {
Fl_Window ADnoteVoiceListItem {
- private xywh {335 489 615 27} hide
+ private xywh {335 489 615 27} type Double hide
class Fl_Group
} {
Fl_Group voicelistitemgroup {
@@ -883,7 +896,7 @@ class ADvoiceUI {: {public Fl_Group}
Function {make_window()} {} {
Fl_Window ADnoteVoiceParameters {
label Voice
- xywh {110 101 765 525} hide
+ xywh {110 101 765 525} type Double hide
class Fl_Group
} {
Fl_Group voiceparametersgroup {
@@ -1464,7 +1477,7 @@ class ADnoteUI {} {
} {
Fl_Window ADnoteGlobalParameters {
label {ADsynth Global Parameters of the Instrument}
- xywh {112 194 535 405} hide
+ xywh {112 194 535 405} type Double hide
} {
Fl_Group {} {
label FREQUENCY
@@ -1649,7 +1662,7 @@ resui->resonancewindow->show();}
}
Fl_Window ADnoteVoiceList {
label {ADsynth Voices list}
- xywh {32 266 650 260} hide
+ xywh {32 266 650 260} type Double hide
} {
Fl_Text_Display {} {
label {No.}
@@ -1691,7 +1704,7 @@ resui->resonancewindow->show();}
}
Fl_Window ADnoteVoice {
label {ADsynth Voice Parameters}
- xywh {53 58 765 560} hide
+ xywh {53 58 765 560} type Double hide
} {
Fl_Group advoice {
xywh {0 0 760 525} box BORDER_BOX