Small enhancements and bugfixes to Unison

(cherry picked from commit 1f30a453df88c9a508bd54b0b9d06192a0c10ddc)
This commit is contained in:
Paul
2009-09-24 21:21:38 +03:00
committed by Tobias Doerffel
parent 552d3aece2
commit effa3861be
4 changed files with 23 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
6 Mar 2002 -(dupamasa - in jur de ora 4) Mi-a venit ideea exact cum sa fac cand ma plimbam pe strada Rolirudnap
6 Mar 2002 -(dupamasa - in jur de ora 4) Mi-a venit ideea exact cum sa fac cand ma plimbam pe strada Pandurilor
7/8 Mar 2002 - Started to do diagrams
10 Mar 2002 - Started to write "voice"
11 Mar 2002 - Heard first sound
@@ -903,4 +903,7 @@
- Added unison invert phase
- Made unison frequency spread to depend on Bandwidth controllers and parameters
- Added unison vibratto speed control and other improvements
- bugfixes: Voice Amplitude Envelope and FM
- bugfixes: Voice Amplitude Envelope and FM
24 Sep 2009 (Paul Nasca)
- Small enhancements and bugfixes to Unison

View File

@@ -99,7 +99,7 @@ void ADnoteParameters::defaults(int n)
VoicePar[nvoice].Enabled=0;
VoicePar[nvoice].Unison_size=1;
VoicePar[nvoice].Unison_frequency_spread=30;
VoicePar[nvoice].Unison_frequency_spread=60;
VoicePar[nvoice].Unison_stereo_spread=64;
VoicePar[nvoice].Unison_vibratto=64;
VoicePar[nvoice].Unison_vibratto_speed=64;
@@ -206,7 +206,7 @@ REALTYPE ADnoteParameters::getBandwidthDetuneMultiplier()
REALTYPE ADnoteParameters::getUnisonFrequencySpreadCents(int nvoice){
REALTYPE unison_spread=VoicePar[nvoice].Unison_frequency_spread/127.0;
unison_spread=pow(unison_spread*2.0,2.0)*100.0;//cents
unison_spread=pow(unison_spread*2.0,2.0)*50.0;//cents
return unison_spread;
};
@@ -253,8 +253,14 @@ int ADnoteParameters::get_unison_size_index(int nvoice){
int index=0;
if (nvoice>=NUM_VOICES) return 0;
int unison=VoicePar[nvoice].Unison_size;
while(1){
if ((ADnote_unison_sizes[index]<=unison)||(ADnote_unison_sizes[index]==0)) return index;
while(1){
if (ADnote_unison_sizes[index]>=unison) {
return index;
};
if (ADnote_unison_sizes[index]==0) {
return index-1;
};
index++;
};
return 0;
@@ -581,7 +587,7 @@ void ADnoteParameters::getfromXMLsection(XMLwrapper *xml,int n)
VoicePar[nvoice].Unison_stereo_spread=xml->getpar127("unison_stereo_spread",VoicePar[nvoice].Unison_stereo_spread);
VoicePar[nvoice].Unison_vibratto=xml->getpar127("unison_vibratto",VoicePar[nvoice].Unison_vibratto);
VoicePar[nvoice].Unison_vibratto_speed=xml->getpar127("unison_vibratto_speed",VoicePar[nvoice].Unison_vibratto_speed);
VoicePar[nvoice].Unison_invert_phase=xml->getpar127("Unison_invert_phase",VoicePar[nvoice].Unison_invert_phase);
VoicePar[nvoice].Unison_invert_phase=xml->getpar127("unison_invert_phase",VoicePar[nvoice].Unison_invert_phase);
VoicePar[nvoice].Type=xml->getpar127("type",VoicePar[nvoice].Type);
VoicePar[nvoice].PDelay=xml->getpar127("delay",VoicePar[nvoice].PDelay);

View File

@@ -134,7 +134,7 @@ ADnote::ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE ve
REALTYPE diff=max-min;
for (int k=0;k<unison;k++){
unison_values[k]=(unison_values[k]-(max+min)*0.5)/diff;//the lowest value will be -1 and the highest will be 1
unison_base_freq_rap[nvoice][k]=pow(2.0,(unison_spread*unison_values[k]*0.5)/1200);
unison_base_freq_rap[nvoice][k]=pow(2.0,(unison_spread*unison_values[k])/1200);
};
};
};
@@ -147,15 +147,14 @@ ADnote::ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE ve
};
unison_vibratto[nvoice].step=new REALTYPE[unison];
unison_vibratto[nvoice].position=new REALTYPE[unison];
unison_vibratto[nvoice].amplitude=(unison_real_spread-1.0)*unison_vibratto_a*0.5;
unison_vibratto[nvoice].amplitude=(unison_real_spread-1.0)*unison_vibratto_a;
REALTYPE increments_per_second=SAMPLE_RATE/(REALTYPE)SOUND_BUFFER_SIZE;
REALTYPE vibratto_base_period=0.25*pow(2.0,(1.0-pars->VoicePar[nvoice].Unison_vibratto_speed/127.0)*4.0);
for (int k=0;k<unison;k++){
unison_vibratto[nvoice].position[k]=RND*0.9-0.45;
unison_vibratto[nvoice].position[k]=RND*1.8-0.9;
REALTYPE vibratto_period=vibratto_base_period*pow(2.0,RND*2.0-1.0);//make period to vary randomly from 50% to 200% vibratto base period
unison_vibratto[nvoice].position[k]=0;
REALTYPE m=4.0/(vibratto_period*increments_per_second);
if (RND<0.5) m=-m;
unison_vibratto[nvoice].step[k]=m;

View File

@@ -177,7 +177,7 @@ class ADvoiceUI {open : {public Fl_Group}
Function {make_window()} {open
} {
Fl_Window ADnoteVoiceParameters {
label Voice open
label Voice
xywh {69 185 765 575} type Double
class Fl_Group visible
} {
@@ -553,17 +553,17 @@ voiceonbutton->redraw();} open
} {
Fl_Dial {} {
label Stereo
callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} selected
callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();}
tooltip {Stereo Spread} xywh {285 540 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code0 {o->value(pars->VoicePar[nvoice].Unison_stereo_spread);}
class WidgetPDial
}
Fl_Choice {} {
label Unison
callback {pars->set_unison_size_index(nvoice,(int) o->value());} open
callback {pars->set_unison_size_index(nvoice,(int) o->value());} open selected
tooltip {Unison size} xywh {10 545 75 20} down_box BORDER_BOX labelfont 1 align 5 textfont 1 textsize 10
code0 {o->add("OFF");char tmp[100];for (int i=1;ADnote_unison_sizes[i];i++){snprintf(tmp,100,"size %d",ADnote_unison_sizes[i]);o->add(tmp);};}
code1 {o->value(pars->VoicePar[nvoice].PDetuneType);}
code1 {o->value(pars->get_unison_size_index(nvoice));}
} {}
Fl_Dial {} {
label Vibratto