Nissan Sentra revving?

My 2007 Nissan Sentra has been revving up by itself up to 2200rpm and keeping it there for a few seconds then dropping down to about 1500rpm than going back up to 2200 over and over. I’m also noticing a knocking sound that sounds kinda like a sewing machine. It’s doesn’t make the sound the entire time but it does... show more My 2007 Nissan Sentra has been revving up by itself up to 2200rpm and keeping it there for a few seconds then dropping down to about 1500rpm than going back up to 2200 over and over. I’m also noticing a knocking sound that sounds kinda like a sewing machine. It’s doesn’t make the sound the entire time but it does it most of the time. I’ve noticed that when I remove the small rubber hose that connects the intake hose to part of the engine that the surging stops but the idle is still high. I just replaced the spark plugs and did an oil change, replaced the throttle body, intake hose and pcv valve, all the vacuum lines look fine and I’ve done the idle relearn too many times to count and it didn’t work so idk what else it could be. Any ideas?
3 answers 3