Using the given motif as a foundation, craft a musical piece adhering to the outlined form.
X:1
L:1/8
M:4/4
K:D
['dB ABAG FGAc BGdG BG G2 ABAG', 'd2 de f2 ef gfed cAeA'  
X:1
L:1/8
M:4/4
K:D
 dB | ABAG FGAc | BGdG BG G2 | ABAG FGAg | fdec d2 :| de | f2 ef gfed | cAeA cAAg | fdfa gfed | 
 cABc d2 de | f2 ef gfed | cAeA cAAf | gfed cdeg | fgec d2 ||  