The traditional lung function testing devices evaluate the respiratory function of individuals by measuring airflow and pressure changes during expiration and inspiration. These techniques primarily rely on mechanical differential pressure sensors or turbine sensors to assess the blowing and suction capacity of subjects and determine their lung function parameters, including Peak Expiratory Flow (PEF) and Forced Vital Capacity (FVC). In this study, we present a wearable respiratory function testing system called the wearable respiratory spectrometer, which is developed based on dynamic humidity sensing technology. By exploring the principles and quantitative design of respiratory detection and conducting simulations with humidity sensors, we investigate the comprehensive characteristics of the system. According to Darcy's law, the gas flow measured by the wearable respiratory spectrometer is directly proportional to the pressure difference inside and outside the device, aligning with the differential pressure sensing principle. Based on these foundations and the structural characteristics of the system, we establish a quantitative relationship between PEF, FVC, and the changes in sensor electrical signals. The experimental results validate a linear positive correlation between the maximum rate of relative humidity change inside the spectrometer and PEF. Additionally, the simulated tidal volume experiments of the spectrometer show that under conditions ranging from 180 to 840 L/min, the indication error of PEF is less than 10%, the adjacent test error is less than 5%, and the frequency response test error is less than 12%, meeting the industry standards for peak expiratory flow meters. Moreover, we compare the spectrometer with traditional portable lung function testing devices in simulated tidal volume experiments under different PEF (300 to 720 L/min) and FVC (3 to 6 L) conditions. The results demonstrate that the average indication error of measured PEF and FVC by the spectrometer are approximately 0.35% and 0.23%, respectively, both significantly lower than those of the portable lung function testing devices, thus fully verifying the accuracy and reliability of this system for real-time lung function assessment. Importantly, under simulated freebreathing conditions (PEF from 12 to 24 L/min, FVC from 0.5 to 0.7 L), the changes in the electrical signals of the spectrometer maintain a linear relationship with the tidal volume. Therefore, the wearable respiratory spectrometer can provide long-term, free, dynamic, and quantitative monitoring of natural and weak nasal breathing. The measured respiratory spectra of individuals have enormous potential in real-time monitoring of lung function and remote monitoring of respiratory system diseases.