My Lady and her Mayd upon a merry pin,Also (without music, without author's name, and with slight differences) in An Antidote Against Melancholy: Made Up in Pills. Compounded of Witty Ballads, Jovial Songs, and Merry Catches (London: Mer. Melancholicus, 1661), p. 86.
they made a match at farting, who should the wager win.
Jone lights three Candles then, and sets them bolt upright,
with the first fart she blew them out,
with the next she gave them light.
In comes my Lady then with all her might and maine,
and blew them out, and in, and out, and in, and out againe.
Oxford English Dictionary, s.v. pin, n.1, phrase P1.a:
in (also on) a (merry, etc.) pin : in a (good, etc.) mood or state of mind; of a disposition indicated by the modifying word.