Compose a tune that integrates the letter-based representation of the determined musical pattern and the given melodic idea.
X:1
L:1/8
M:2/4
K:G
['B A G E G A B']  
X:1
L:1/8
M:2/4
K:G
 d e d2 | B A G E | G A B d | A4 | d e d d | B A G E | G A B E | D4 |]  