1- import { OscillatorSynthNode, ADSREnvelopeSynthNode, SynthTime , Seconds, Hertz, Notes, Normal, Pitch } from 'synth'
1+ import { OscillatorSynthNode, ADSREnvelopeSynthNode, Time , Seconds, Hertz, Notes, Normal, Pitch } from 'synth'
22import { context } from 'synth/playground'
33
44const oscillator = new OscillatorSynthNode(context)
@@ -9,17 +9,17 @@ envelope.connect(context.output)
99
1010oscillator.frequency.initialValue = Pitch.frequency('A4')
1111oscillator.waveShape.value = 'sawtooth'
12- envelope.attack.initialValue = SynthTime .note.toNotes()
13- envelope.decay.initialValue = SynthTime .note.toNotes()
12+ envelope.attack.initialValue = Time .note.toNotes()
13+ envelope.decay.initialValue = Time .note.toNotes()
1414envelope.sustain.initialValue = Normal(0.5)
15- envelope.release.initialValue = SynthTime .note.toNotes()
15+ envelope.release.initialValue = Time .note.toNotes()
1616
17- let time = SynthTime .start
17+ let time = Time .start
1818for (let i = 0; i < 5; i++) {
1919 envelope.attackAt(time)
20- time = time.add(SynthTime .note)
20+ time = time.add(Time .note)
2121 envelope.releaseAt(time)
22- time = time.add(SynthTime .note)
22+ time = time.add(Time .note)
2323 oscillator.frequency.curve.rampValueUntil(time, Hertz(440 + 40 * i))
2424 context.secondsPerNote.rampValueUntil(time, Seconds(1 / (i + 1)))
2525}
0 commit comments