nt = getMidiNoteName(rootValue);
        updateControls();
    });

    // Add note name calculation function:
    function getMidiNoteName(midiNumber) {
        const notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];
        const note = notes[midiNumber % 12];
        const octave = Math.floor(midiNumber / 12) - 1;
        return `${midiNumber} (${note}${octave})`;
    }

    // Update loadPieceConfig to store the current config
    function loadPieceConfig(config) {
        currentConfig = 