We present a measurement of the momentum spectra of π ±, K±, p±, Λ, Λ, and K0S produced in interactions of negatively charged pions with carbon nuclei at beam momenta of 158 and 350 GeV/c. The total production cross sections are measured as well. The data were collected with the large-acceptance spectrometer of the fixed target experiment NA61/SHINE at the CERN SPS. The obtained double-differential p−pT spectra provide a unique reference dataset with unprecedented precision and large phase-space coverage to tune models used for the simulation of particle production in extensive air showers in which pions are the most numerous projectiles