A box-type generator driven by an engine, wherein a generator assembly is enclosed by a box-type soundproof hood assembly assembled by at least two pieces of soundproof hoods; wherein a front air inlet located at a lower portion of a front end surface of the box-type soundproof hood assembly, a controller, a front fan and a front air duct, a permanent magnetic generator, the engine, a left back air inlet and a right back air inlet, a back fan and a back air duct, and a double-cavity type muffler assembly are successively arranged approximately in a line from upstream to downstream in a flow direction of cooling air; wherein cooling air is inhaled into the front air duct from the front air inlet; wherein the controller is arranged behind the front end surface and a large surface of the controller is parallel to and covers the front air inlet, and an oil tank is arranged above the controller; and wherein the front fan, the back fan and the permanent magnetic generator are all driven by the engine, and the cooling air flows from front to back both in the front air duct and in the back air duct; characterized in that: the double-cavity type muffler assembly comprises an upper cavity and a lower cavity, an air intake tube, a connecting pipe and an air outlet; in an arrangement of the front and back air duct and the double-cavity type muffler assembly along the line, the front air duct and the upper cavity of the double-cavity type muffler assembly are arranged in an upper portion of the box-type soundproof hood assembly, while the back air duct and the lower cavity of the double-cavity type muffler assembly are arranged in a lower portion of the box-type soundproof hood assembly, and the upper portion and the lower portion are separated; wherein the cooling air in the front air duct successively cools the controller, the front fan, the permanent magnetic generator, a portion of the engine above a cylinder, an air intake tube of the double-cavity type muffler assembly and the upper cavity of the double-cavity type muffler assembly; wherein the left back air inlet and the right back air inlet are respectively provided on a left soundproof hood and a right soundproof hood of the box-type soundproof hood assembly at positions behind an air inlet of the front fan and near an air filter and a lower portion of the engine, and air is inhaled into the back air duct from the left back air inlet and the right back air inlet; and wherein the cooling air in the back air duct successively cools a portion of the engine below the cylinder, the back fan and the lower cavity of the double-cavity type muffler assembly. the double-cavity type muffler assembly comprises an upper cavity and a lower cavity, an air intake tube, a connecting pipe and an air outlet; in an arrangement of the front and back air duct and the double-cavity type muffler assembly along the line, the front air duct and the upper cavity of the double-cavity type muffler assembly are arranged in an upper portion of the box-type soundproof hood assembly, while the back air duct and the lower cavity of the double-cavity type muffler assembly are arranged in a lower portion of the box-type soundproof hood assembly, and the upper portion and the lower portion are separated; wherein the cooling air in the front air duct successively cools the controller, the front fan, the permanent magnetic generator, a portion of the engine above a cylinder, an air intake tube of the double-cavity type muffler assembly and the upper cavity of the double-cavity type muffler assembly; wherein the left back air inlet and the right back air inlet are respectively provided on a left soundproof hood and a right soundproof hood of the box-type soundproof hood assembly at positions behind an air inlet of the front fan and near an air filter and a lower portion of the engine, and air is inhaled into the back air duct from the left back air inlet and the right back air inlet; and wherein the cooling air in the back air duct successively cools a portion of the engine below the cylinder, the back fan and the lower cavity of the double-cavity type muffler assembly.