An automatic peak-extraction technique