A rectangular baler comprising a bale chamber delimited by a plurality of walls including a movable wall section, an actuator for exerting a pressure on the movable wall section, a plunger for compressing crop material in the bale chamber, and a density control system comprising: a position calculating module configured to calculate a new position for the movable wall section based on an input representative for bale density of compressed crop material in the bale chamber; and a position control module configured to control the actuator to position the movable wall section in the calculated position.