It could something as simple as loose heat shields. They are attached to the exhaust system, and will rattle badly if loose. It could also have a problem with an exhaust hanger allowing the exhaust system to vibrate. These types of problems could be checked quickly by an under car inspection. Since the exhaust vibration changes with engine speed, pressing the accelerator makes the sound occur.
Please press Accept if this answer is helpful. Thanks!