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
['A3 G{G}', 'd4 f2 e>a d2 c>a (f>e)(A>c) B2'  
X:1
L:1/8
M:4/4
K:D
|: A3 G{G} TF3 E | D2 (d>c){c} B3 A | G2 (g>f){f} Te3 d | (c>d)(e>f) e4 | A3 G{G} F3 E | 
 D2 d>c{c} TB3 A | G2 g>f{f} e3 d | (A>B) (d>e) d4 :: f2 e>a d2 c>a | (f>e)(A>c) B2 (c>d) | 
 e2 (f>^g) a>fB>e | c2 (TB>A) A4 | d3 =c{c} TB3 A | G2 g>f{f} e3 d | A2 (a>g) (f>d)(B>c) | 
 d2 (D>E) D4 :|  