 // Global variables
    let domLoaded = false;
    let instrumentsLoaded = false;
    let tm = null;
    let prog = null;
    let audioContext = null;
    let chord_instrument, arp_instrument, bass_instrument, top_instrument, random_instrument;
    let currentLines = [];
    let currentTimeManipulator = null;
    let currentProgression = null;
    let instruments = {};
    let currentConfig = null;
    let projectData = null;  // Will be created when needed

    // Function to ensure projectData exists
   