Chapter 1

Test

export default function* (SCHED, INPUT, showUI = false) {
    const melodySynth = new Tone.PolySynth(Tone.Synth, {
        envelope: {
            attack: 0.2,
            release: 0.1
        }
    })

    const droneSynth = new Tone.Player(assets.audio.blackBoxDrone)

    const vib = new Tone.Vibrato(0, 0.000007070506370279221)
    const filter = new Tone.Filter(1111, 'bandpass')
    filter.Q.value = 1
    filter.detune.value = 0
    const chorus = new Tone.Chorus(1, 2.5, 6)
    const delay = new Tone.FeedbackDelay(0, 0)
    const reverb = new Tone.Reverb(1.5)
    const gain = new Tone.Gain(2)
    const compressor = new Tone.Compressor(-30, 3)
    const pan = new Tone.Panner()
    melodySynth.connect(vib)
    droneSynth.connect(vib)
    vib.connect(filter)
    filter.connect(delay)
    delay.connect(reverb)
    reverb.connect(chorus)
    chorus.connect(gain)
    gain.connect(compressor)
    compressor.connect(pan)
    pan.toDestination()

    try {
        while (!reverb.ready) yield
        yield* interact(INPUT, vib, pan, melodySynth, droneSynth)
    } finally {
        SCHED.add(function* () {
            gain.gain.linearRampTo(0, 1)
            yield* coro.seconds(1)
            vib.disconnect()
            chorus.disconnect()
            delay.disconnect()
            reverb.disconnect()
            gain.disconnect()
        })
    }
}