@@ -37,7 +37,7 @@ define(function (require) {
37
37
AudioVoice . call ( this ) ;
38
38
39
39
this . oscillator = new p5 . Oscillator ( ) ;
40
- this . oscillator . disconnect ( ) ;
40
+ // this.oscillator.disconnect();
41
41
42
42
this . env = new p5 . Env ( ) ;
43
43
this . env . setRange ( 1 , 0 ) ;
@@ -52,12 +52,13 @@ define(function (require) {
52
52
53
53
// oscillator --> env --> filter --> this.output (gain) --> p5.soundOut
54
54
55
- this . oscillator . connect ( this . filter ) ;
55
+ // this.oscillator.connect(this.filter);
56
56
this . env . setInput ( this . oscillator ) ;
57
57
this . env . connect ( this . filter ) ;
58
58
this . filter . connect ( this . output ) ;
59
59
60
60
this . oscillator . start ( ) ;
61
+ this . connect ( ) ;
61
62
62
63
//Audiovoices are connected to soundout by default
63
64
@@ -102,7 +103,7 @@ define(function (require) {
102
103
// set range of env (TO DO: allow this to be scheduled in advance)
103
104
var vel = velocity || 1 ;
104
105
105
- this . triggerAttack ( note , velocity , secondsFromNow ) ;
106
+ this . triggerAttack ( note , vel , secondsFromNow ) ;
106
107
this . triggerRelease ( secondsFromNow + susTime ) ;
107
108
} ;
108
109
@@ -117,15 +118,13 @@ define(function (require) {
117
118
* @method triggerAttack
118
119
*/
119
120
p5 . MonoSynth . prototype . triggerAttack = function ( note , velocity , secondsFromNow ) {
120
-
121
- var now = p5sound . audiocontext . currentTime ;
121
+ //scheduling in relation to audioContext.currentTime will be handeled by oscillator.frew() and env.ramp()
122
122
var tFromNow = secondsFromNow || 0 ;
123
- var t = now + tFromNow ;
124
123
var n = p5 . prototype . midiToFreq ( note ) ;
125
-
126
124
this . _isOn = true ;
127
- this . oscillator . freq ( n , 0 , t ) ;
128
- this . env . ramp ( this . output , t , velocity ) ;
125
+
126
+ this . oscillator . freq ( n , 0 , tFromNow ) ;
127
+ this . env . ramp ( this . output , tFromNow , velocity ) ;
129
128
} ;
130
129
131
130
/**
@@ -169,7 +168,7 @@ define(function (require) {
169
168
this . oscillator . setType ( options . oscillator . type ) ;
170
169
171
170
this . env . setADSR ( options . env . attack , options . env . decay ,
172
- options . env . sustain , options . env . release ) ;
171
+ options . env . sustain , options . env . release ) ;
173
172
174
173
this . filter . setType ( options . filter . type ) ;
175
174
this . filter . set ( options . filter . freq , options . filter . res ) ;
0 commit comments