Measurements of the double-differential π± production cross-section in the range of momentum 100 MeV/c p<∈800 MeV/c and angle 0.35 rad∈ θ<∈ 2.15 rad in proton-beryllium, proton-aluminium and proton-lead collisions are presented. The data were taken with the HARP detector in the T9 beam line of the CERN PS. The pions were produced by proton beams in a momentum range from 3 GeV/c to 12.9 GeV/c hitting a target with a thickness of 5% of a nuclear interaction length. The tracking and identification of the produced particles was performed using a small-radius cylindrical time projection chamber (TPC) placed inside a solenoidal magnet. Incident particles were identified by an elaborate system of beam detectors. Results are obtained for the double-differential cross-sections d2σ/dpdθ at six incident proton beam momenta (3 GeV/c, 5 GeV/c, 8 GeV/c, 8.9 GeV/c (Be only), 12 GeV/c and 12.9 GeV/c (Al only)) and compared to previously available data.