For a long set of piano keys, especially if they are scrappy and possibly different widths, I sew them onto a strip of muslin and do foundation piecing. You can cut the muslin border to the exact length you want, then sew down the piano keys. The foundation controls any stretching.