Static and dynamic characterization of AlN and nanocrystalline diamond membranes