Imagine I have a section of pipe that increases in cross-section at some point. If the gas in the pipe before this section is being displaced with a piston, will the gas increase its pressure and reduce its velocity while going through increasing area, or will it maintain its velocity and pressure at expense of energy delivered by the piston?
See the gas law. The pressure x volume / temperature remain constant. For the speed component see the kinetic theory in the wiki article. https://en.wikipedia.org/wiki/Ideal_gas_law