Enhancing the Swanepoel method: precise envelope detection of thin-film transmission spectra | Synapse