     };
        return values;
    }

    // Add variable to track scheduled notes
    let scheduledNotes = [];
    
    // Add stop function
    function stop() {
        if (!audioContext) return;
        
        // Stop all active instruments
        Object.values(instruments).forEach(instrument => {
            if (instrument && typeof instrument.stop === 'function') {
                instrument.stop(audioContext.currentTime);
            }
        });
        
        // Clear scheduled notes
        