File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ <h2>DTMF</h2>
216216 attackControl . addEventListener (
217217 "input" ,
218218 ( ev ) => {
219- attackTime = parseFloat ( ev . target . value ) ;
219+ attackTime = parseInt ( ev . target . value , 10 ) ;
220220 } ,
221221 false
222222 ) ;
@@ -226,12 +226,13 @@ <h2>DTMF</h2>
226226 releaseControl . addEventListener (
227227 "input" ,
228228 ( ev ) => {
229- releaseTime = parseFloat ( ev . target . value ) ;
229+ releaseTime = parseInt ( ev . target . value , 10 ) ;
230230 } ,
231231 false
232232 ) ;
233233
234234 // Expose attack time & release time
235+ const sweepLength = 2 ;
235236 function playSweep ( time ) {
236237 const osc = new OscillatorNode ( audioCtx , {
237238 frequency : 380 ,
@@ -245,12 +246,12 @@ <h2>DTMF</h2>
245246 sweepEnv . gain . linearRampToValueAtTime ( 1 , time + attackTime ) ;
246247 sweepEnv . gain . linearRampToValueAtTime (
247248 0 ,
248- time + attackTime + releaseTime
249+ time + sweepLength - releaseTime
249250 ) ;
250251
251252 osc . connect ( sweepEnv ) . connect ( audioCtx . destination ) ;
252253 osc . start ( time ) ;
253- osc . stop ( time + attackTime + releaseTime ) ;
254+ osc . stop ( time + sweepLength ) ;
254255 }
255256
256257 // Expose frequency & frequency modulation
You can’t perform that action at this time.
0 commit comments