A method for adaptive signal processing, comprising the steps of - illuminating the content in a container with a light source from one side of the container; - measuring the optical signal with a sensor resulting from light shining through the container and its content; - assigning voltage values to the measured optical signals; - preparing a voltage curve from sampled measurements of voltage values over time; - determining a voltage level of a background noise level; - performing a first plausibility check to verify whether a target signal is already present at the beginning of the measurement; by a. reducing the voltage values by a defined factor to a preset fallback level if the median of measured voltage values at the beginning of the voltage curve is outside a tolerance range with a value that is more than 50% higher than an expected target value of a system calibration; or b. proceeding with the median voltage values if the measured voltage at the beginning of the voltage curve is within the tolerance range or is lower than the expected target value of the system calibration; - determining the voltage level of a target signal by calculating the median of a group of the highest measured voltage values; i. performing a second plausibility check by determining whether the median of a group of highest target voltage values is at least 20% higher compared to the defined voltage values of the background noise level or the preset fallback level; - only proceeding with the method if the median of the group of the highest voltage values differs at least by 20% from the defined voltage values of the background noise level or a preset fallback level by determining discrimination limits between the voltage values relating to a background noise level and a target level, respectively, by setting the discrimination limit in the middle between the background noise level and signal level. - illuminating the content in a container with a light source from one side of the container; - measuring the optical signal with a sensor resulting from light shining through the container and its content; - assigning voltage values to the measured optical signals; - preparing a voltage curve from sampled measurements of voltage values over time; - determining a voltage level of a background noise level; - performing a first plausibility check to verify whether a target signal is already present at the beginning of the measurement; by a. reducing the voltage values by a defined factor to a preset fallback level if the median of measured voltage values at the beginning of the voltage curve is outside a tolerance range with a value that is more than 50% higher than an expected target value of a system calibration; or b. proceeding with the median voltage values if the measured voltage at the beginning of the voltage curve is within the tolerance range or is lower than the expected target value of the system calibration; a. reducing the voltage values by a defined factor to a preset fallback level if the median of measured voltage values at the beginning of the voltage curve is outside a tolerance range with a value that is more than 50% higher than an expected target value of a system calibration; or b. proceeding with the median voltage values if the measured voltage at the beginning of the voltage curve is within the tolerance range or is lower than the expected target value of the system calibration; - determining the voltage level of a target signal by calculating the median of a group of the highest measured voltage values; i. performing a second plausibility check by determining whether the median of a group of highest target voltage values is at least 20% higher compared to the defined voltage values of the background noise level or the preset fallback level; i. performing a second plausibility check by determining whether the median of a group of highest target voltage values is at least 20% higher compared to the defined voltage values of the background noise level or the preset fallback level; - only proceeding with the method if the median of the group of the highest voltage values differs at least by 20% from the defined voltage values of the background noise level or a preset fallback level by determining discrimination limits between the voltage values relating to a background noise level and a target level, respectively, by setting the discrimination limit in the middle between the background noise level and signal level.