        const soundMap = {
            'chords': 'piano',
            'arpeggio': 'harp',
            'bass': 'bass',
            'top': 'flute',
            'random': 'tuba'
        };
        strudelPattern += `.sound("${soundMap[lineType.id] || 'piano'}")`;
        
        // Add gain based on velocity if available
        if (notes[0].velocity !== undefined) {
            const avgVelocity = notes.reduce((sum, note) => sum + note.velocity, 0) / notes.length;
            strudelPattern += `.gain(${avgVe