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
['', 'd>B (3AAA A>B d>e', 'A>G F>G'  
X:1
L:1/8
M:4/4
K:D
 d>B |: (3AAA A>B d>e f>e | d>B (3BBB g>B d>B | (3AAA A>B d>e f>g |1 a>b a>f e2 d>B :|2 
 a>b a>f e2 d2 || A2 A>G F>G A2 | (3BBB B>A B>c d2 | (3AAA A>G F>G A>F | D>F A>F E2 D2 | 
 A2 A>G F>G A2 | (3BBB B>A B>c d>B | A>c d>A (3Bcd A>F | D>E F>D E2 D2 ||  