dSequence
        });
    }

    // Function to update all music state
    function updateMusicState() {
        ensureProjectData();  // Create projectData if needed
        
        const bpm = parseInt(document.getElementById('bpm').value);
        const beatsPerChord = parseInt(document.getElementById('chordLength').value);
        const root = parseInt(document.getElementById('root').value);
        const modeValue = parseInt(document.getElementById('mode').value);
        const chordSequence = documen