Skip to content

Commit

Permalink
set env range according to the number of voices
Browse files Browse the repository at this point in the history
  • Loading branch information
b2renger committed Mar 19, 2016
1 parent 247daaa commit 4721470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions examples/polyphonic_AdditiveSynth/sketch.js
Expand Up @@ -82,8 +82,7 @@ function AdditiveSynth(){

this.oscbank =[];
this.amplitude = new p5.Amplitude();
this.env.setRange(0.2,0);



for (var i = 0 ; i < this.harmonics.length; i++){
this.oscbank.push(new p5.Oscillator(midiToFreq(this.note),this.osctype) );
Expand Down
2 changes: 2 additions & 0 deletions src/polysynth.js
Expand Up @@ -89,9 +89,11 @@ p5.PolySynth = function(num,synthVoice){
this.voices = [];
this.num_voices = num;
this.poly_counter=0;
this.maxRange = 1/num;

for (var i = 0 ; i < this.num_voices ; i++){
this.voices.push(new synthVoice());
this.voices[i].env.setRange(this.maxRange,0);
}
}

Expand Down

0 comments on commit 4721470

Please sign in to comment.