Unsteady response of hydrogen and methane flames to pressure waves